On 30/08/17 19:12, Pádraig Brady wrote: > On 30/08/17 18:08, Assaf Gordon wrote: >> Hello Pádraig and all, >> >> On 30/08/17 03:12 AM, Pádraig Brady wrote: >>> https://pixelbeat.org/cu/coreutils-ss.tar.xz >>> tar -xf coreutils-ss.tar.xz >>> cd coreutils-8.27.103-db8d1/ >>> ./configure && make check VERBOSE=yes >> >> Many previously issues are now fixed. >> >> New failures: >> >> On alpine-Linux (musl-libc and busybox) - everything now compiles fine, >> but two tests fail: >> >> ==== >> FAIL: tests/misc/tty >> [...] >> + test -t 0 >> + returns_ 1 tty >> not a tty >> + returns_ 1 tty -s >> + fail=1 >> + returns_ 2 tty a >> tty: extra operand 'a' >> Try 'tty --help' for more information. >> + returns_ 2 tty -s a >> tty: extra operand 'a' >> Try 'tty --help' for more information. >> + test -w /dev/full >> + test -c /dev/full >> + test -t 0 >> + returns_ 3 tty >> tty: write error >> + returns_ 4 tty >> not a tty >> + fail=1 >> + returns_ 4 tty -s >> + Exit 1 >> + set +e >> + exit 1 >> ====== >> FAIL: tests/ln/sf-1 >> [...] >> + printf %0*d 256 0 >> ash: %0*d: invalid format > >> (I guess printf(1) in Busybox's "ash" does not accept this format). > > Indeed: > $ sudo dnf install busybox > $ busybox ash -c 'printf %0*d 256 0' > ash: %0*d: invalid format > > Since this is the only ash specific issue it seems, I'll avoid like: > > -long_name=$(printf '%0*d' $name_max_plus1 0) > +long_name=$(yes 0 | head -n$name_max_plus1 | tr -d '\n') > >> >> On Mac OS X, a gnulib test fails (but no coreutils test failures): >> ==== >> FAIL: test-utime >> ================ >> >> test-utime.c:112: assertion 'utime (BASE "link/", NULL) == -1' failed >> FAIL test-utime (exit status: 134) >> ==== >> >> >> >> Existing Failures; >> >> On OpenSolaris 5.10/5.11, "tests/misc/tty" still fails: >> === >> + test -t 0 >> + returns_ 1 tty >> not a tty >> + returns_ 1 tty -s >> + fail=1 >> + returns_ 2 tty a >> tty: extra operand 'a' >> Try 'tty --help' for more information. >> + returns_ 2 tty -s a >> tty: extra operand 'a' >> Try 'tty --help' for more information. >> + test -w /dev/full >> + returns_ 4 tty >> + returns_ 4 tty -s >> + Exit 1 >> + set +e >> + exit 1 >> + exit 1 >> === > > Looks like solaris doesn't distinguish ENOTTY and EBADF > It returns ENOENT in all isatty() failure cases :/ > > I might change things so that tty doesn't distinguish > these failure cases on input. > I.E. just return 1 for all errors on input
I'm going with the two attached patches to avoid these issues. cheers, Pádraig
>From 5ee9c8f7a6d3f2cec5eb4b086f05a60f67c8b052 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= <[email protected]> Date: Wed, 30 Aug 2017 20:05:31 -0700 Subject: [PATCH 1/2] tests: avoid printf '0*d' construct unsupported by ash * tests/ln/sf-1.sh: Generate specific length with space padding which is supported. Reported by Assaf Gordon on Alpine Linux. --- tests/ln/sf-1.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ln/sf-1.sh b/tests/ln/sf-1.sh index c6dafdf..36d5b29 100755 --- a/tests/ln/sf-1.sh +++ b/tests/ln/sf-1.sh @@ -37,7 +37,7 @@ esac name_max=$(stat -f -c %l .) && test "$name_max" -lt $((1024*1024)) || name_max=1 # skip this portion of the test name_max_plus1=$(expr $name_max + 1) -long_name=$(printf '%0*d' $name_max_plus1 0) +long_name=$(printf '%*s' $name_max_plus1 | tr ' ' '0') for f in '' f; do ln -s$f missing ENOENT_link || fail=1 -- 2.9.3 >From 2f98755bb8c5af989d495999419f0db1097afc38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= <[email protected]> Date: Wed, 30 Aug 2017 20:14:22 -0700 Subject: [PATCH 2/2] tty: don't distinguish input errors * src/tty.c (main): Don't distinguish ENOTTY from other errors, because isatty() doesn't portably distinguish errors. Solaris returns ENOENT for all input errors for example. Musl also returns ENOENT, and ENODEV may be returned as disscussed at: http://openwall.com/lists/musl/2017/04/06/6 * tests/misc/tty.sh: Adjust accordingly. --- src/tty.c | 9 ++------- tests/misc/tty.sh | 5 ++--- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/tty.c b/src/tty.c index 994b356..5e88c87 100644 --- a/src/tty.c +++ b/src/tty.c @@ -35,8 +35,7 @@ enum { TTY_STDIN_NOTTY = 1, TTY_FAILURE = 2, - TTY_WRITE_ERROR = 3, - TTY_STDIN_ERROR = 4 + TTY_WRITE_ERROR = 3 }; /* The official name of this program (e.g., no 'g' prefix). */ @@ -118,17 +117,13 @@ main (int argc, char **argv) errno = ENOENT; if (silent) - return (isatty (STDIN_FILENO) ? EXIT_SUCCESS - : (errno == ENOTTY || errno == EINVAL) ? TTY_STDIN_NOTTY - : TTY_STDIN_ERROR); + return isatty (STDIN_FILENO) ? EXIT_SUCCESS : TTY_STDIN_NOTTY; int status = EXIT_SUCCESS; char const *tty = ttyname (STDIN_FILENO); if (! tty) { - if (errno != ENOTTY && errno != EINVAL) - error (TTY_STDIN_ERROR, errno, _("standard input")); tty = _("not a tty"); status = TTY_STDIN_NOTTY; } diff --git a/tests/misc/tty.sh b/tests/misc/tty.sh index 904b5d6..aa3203b 100755 --- a/tests/misc/tty.sh +++ b/tests/misc/tty.sh @@ -27,6 +27,8 @@ fi returns_ 1 tty </dev/null || fail=1 returns_ 1 tty -s </dev/null || fail=1 +returns_ 1 tty <&- 2>/dev/null || fail=1 +returns_ 1 tty -s <&- || fail=1 returns_ 2 tty a || fail=1 returns_ 2 tty -s a || fail=1 @@ -38,7 +40,4 @@ if test -w /dev/full && test -c /dev/full; then returns_ 3 tty </dev/null >/dev/full || fail=1 fi -returns_ 4 tty <&- 2>/dev/null || fail=1 -returns_ 4 tty -s <&- || fail=1 - Exit $fail -- 2.9.3
