On 29/08/17 11:06, Assaf Gordon wrote:
> Hello,
> 
> On 29/08/17 02:49 AM, Pádraig Brady wrote:
>>   https://pixelbeat.org/cu/coreutils-ss.tar.xz
> 
> Two more failures
> 
> 
> 1.
> on older Cent OS 6.5, and on OpenSolaris 5.11/i86pc,
> "tests/misc/tty" tails.
> 
> Cent Os 6.5:
> 
> FAIL: tests/misc/tty
> ====================
> + test -t 0
> + returns_ 1 tty
> not a tty
> + returns_ 1 tty -s
> + 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
> + returns_ 3 tty
> tty: standard input: Invalid argument
> + fail=1
> + returns_ 3 tty
> tty: write error: No space left on device
> + returns_ 4 tty
> + returns_ 4 tty -s
> + Exit 1
> ==============
> 
> OpenSolaris:
> ====
> [....]
> + 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
> [....]

The centos failure looks to be a test failure.
Updated tty patch is attached.

cheers

>From 2e3b00d0af7977ba53e1e8e6800940835b6b18fe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <[email protected]>
Date: Wed, 30 Aug 2017 00:55:34 -0700
Subject: [PATCH] tty: fix exit code on Solaris

* src/tty.c (main): All systems mention that EINVAL
may be returned as well as (the POSIX compliant) ENOTTY.
* tests/misc/tty.sh: Fix a test issue where we assume
standard input is always a valid tty.
Reported by Assaf Gordon on OpenSolaris 5.10 and 5.11.
---
 src/tty.c         | 4 ++--
 tests/misc/tty.sh | 4 +++-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/tty.c b/src/tty.c
index e84c353..994b356 100644
--- a/src/tty.c
+++ b/src/tty.c
@@ -119,7 +119,7 @@ main (int argc, char **argv)
 
   if (silent)
     return (isatty (STDIN_FILENO) ? EXIT_SUCCESS
-            : errno == ENOTTY ? TTY_STDIN_NOTTY
+            : (errno == ENOTTY || errno == EINVAL) ? TTY_STDIN_NOTTY
             : TTY_STDIN_ERROR);
 
   int status = EXIT_SUCCESS;
@@ -127,7 +127,7 @@ main (int argc, char **argv)
 
   if (! tty)
     {
-      if (errno != ENOTTY)
+      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 5931350..904b5d6 100755
--- a/tests/misc/tty.sh
+++ b/tests/misc/tty.sh
@@ -32,7 +32,9 @@ returns_ 2 tty a || fail=1
 returns_ 2 tty -s a || fail=1
 
 if test -w /dev/full && test -c /dev/full; then
-  returns_ 3 tty >/dev/full || fail=1
+  if test -t 0; then
+    returns_ 3 tty >/dev/full || fail=1
+  fi
   returns_ 3 tty </dev/null >/dev/full || fail=1
 fi
 
-- 
2.9.3

Reply via email to