2021-06-28 20:01:03 +0700, Robert Elz:
[...]
> [email protected] said:
>   | On the zsh mailing list, where the issue was initially brought up by
>   | Vincent, there was also the mention that EBADF error was explicitly
>   | ignore as a special case, as some systems have or used to have
>   | non-usable /dev/null,
> 
> Weird, just out of interest, which are those?  And do any of them
> claim to be (any facsimile of) posix conformant?

No idea, that was a vague recollection of one of zsh's
maintainers. One can imagine it being the case on some embedded
systems or minimalist container / chroot, like ones created by
non-priviledged users. I'd call them pathological corner cases
though, probably not worth taking into account.

>   | so users were using >&- instead to silence output.
> 
>   | If stdout is closed, one could argue the user explicitly wants the
>   | output to be discarded.
> 
> if a utility is invoked with any of stdin/out/err closed then what happens
> is very explicitly unspecified in POSIX.

All good points.

My Solaris test cases corrected to use EPIPE instead of EBADF:

$ (trap "" PIPE; sleep 1; /usr/xpg4/bin/sh -c 'grep root /etc/passwd; echo "$?" 
>&2') | :
0
$ (trap "" PIPE; sleep 1; /bin/sh -c 'grep root /etc/passwd; echo "$?" >&2') | :
0
$ (trap "" PIPE; sleep 1; /bin/sh -c 'pwd; echo "$?" >&2') | :
0

-- 
Stephane

  • Re: utilities and w... Don Cragun via austin-group-l at The Open Group
    • Re: utilities ... [email protected] via austin-group-l at The Open Group
      • Re: utilit... Don Cragun via austin-group-l at The Open Group
      • Re: utilit... Geoff Clare via austin-group-l at The Open Group
      • Re: utilit... Robert Elz via austin-group-l at The Open Group
        • Re: ut... Stephane Chazelas via austin-group-l at The Open Group
        • Re: ut... Geoff Clare via austin-group-l at The Open Group
          • Re... Stephane Chazelas via austin-group-l at The Open Group
        • Re: ut... Joerg Schilling via austin-group-l at The Open Group
        • Re: ut... Robert Elz via austin-group-l at The Open Group
          • Re... Stephane Chazelas via austin-group-l at The Open Group
            • ... [email protected] via austin-group-l at The Open Group
              • ... Vincent Lefevre via austin-group-l at The Open Group
              • ... Vincent Lefevre via austin-group-l at The Open Group
              • ... Geoff Clare via austin-group-l at The Open Group
          • Re... Vincent Lefevre via austin-group-l at The Open Group
          • Re... Robert Elz via austin-group-l at The Open Group
            • ... Vincent Lefevre via austin-group-l at The Open Group
              • ... Philip Guenther via austin-group-l at The Open Group
            • ... Robert Elz via austin-group-l at The Open Group
          • Re... Geoff Clare via austin-group-l at The Open Group

Reply via email to