[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[patches] Improve ldd handling of non-bash shells



I've applied this patch, originally from 
<http://sourceware.org/ml/libc-alpha/2007-01/msg00041.html>, to EGLIBC 
trunk and 2.8 branch to improve ldd's handling of non-bash shells.  It's 
still a bash script and still uses $"" for message translation, but you 
can now use it in a non-bash environment without it completely falling 
over at least in this pipefail test.

2008-09-08  Pete Eberlein  <eberlein@xxxxxxxxxx>

	* elf/ldd.bash.in: Make pipefail check more robust when using
	non-bash shells.

Index: elf/ldd.bash.in
===================================================================
--- elf/ldd.bash.in	(revision 6911)
+++ elf/ldd.bash.in	(working copy)
@@ -110,7 +110,7 @@
 # environments where the executed program might not have permissions
 # to write to the console/tty.  But only bash 3.x supports the pipefail
 # option, and we don't bother to handle the case for older bash versions.
-if set -o pipefail 2> /dev/null; then
+if x=`set -o` && test "$x" != "${x#*pipefail}" && set -o pipefail ; then
   try_trace() {
     eval $add_env '"$@"' | cat
   }

-- 
Joseph S. Myers
joseph@xxxxxxxxxxxxxxxx