coreutils
[Top][All Lists]
Advanced

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

[coreutils] test: fix a dash portability problem with redirected symlink


From: Pádraig Brady
Subject: [coreutils] test: fix a dash portability problem with redirected symlinked ttys
Date: Tue, 09 Nov 2010 10:35:51 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3

Another bug I noticed with dash-0.5.6-2.fc11.i586
is that it doesn't redirect from symlinks correctly
for background processes.

$ dash -c "tty < /dev/stdin&"
$ dash -c "tty < /dev/stdin"
/dev/pts/3
$ bash -c "tty < /dev/stdin&"
/dev/pts/3
$ dash -c "tty < $(readlink -f /dev/stdin)&"
/dev/pts/3

OK to apply the following?

Note redirecting from /dev/tty works also,
but I don't know if that's better or worse.

--- a/tests/mv/i-3
+++ b/tests/mv/i-3
@@ -34,10 +34,13 @@ chmod 0 g i || framework_failure
 ls /dev/stdin >/dev/null 2>&1 \
   || skip_test_ 'there is no /dev/stdin file'

-test -r /dev/stdin 2>&1 \
+# work around a dash bug redirecting from symlinks
+tty=$(readlink -f /dev/stdin)
+
+test -r "$tty" 2>&1 \
   || skip_test_ '/dev/stdin is not readable'

-mv f g < /dev/stdin > out 2>&1 & pid=$!
+mv f g < $tty > out 2>&1 & pid=$!

 # Wait up to 3.1s for the expected prompt
 check_overwrite_prompt()



reply via email to

[Prev in Thread] Current Thread [Next in Thread]