On Tue, Jan 14, 2025, at 5:51 AM, Geoff Clare via austin-group-l at The Open 
Group wrote:
>
> [...]
>
>     If any file descriptors with numbers greater than 2 are opened by
>     those redirections, it is unspecified whether those file
>     descriptors remain open when the shell invokes another utility.
>
> [...]
>
> So I think his specific use case is not a problem; however I think
> his mail has brought to light a mismatch between the POSIX wording and
> implementations.  As I understand it, in ksh this is implemented by
> setting FD_CLOEXEC on file descriptors greater than 2 when opened by
> "exec".  This means it would never affect built-in utilities, so I
> think a better match would be:
>
>     ..., it is unspecified whether those file descriptors remain open
>     when the shell invokes a non-built-in utility.
>
> I can't think of any built-ins in POSIX that have the ability to access
> a specified fd, but it would matter if we ever want to add "read -u" to
> the standard.

Does built-in "test -t" count?  Does this have unspecified behavior?

        exec 3>&1
        test -t 3

-- 
vq

  • exec redirec... Christoph Anton Mitterer via austin-group-l at The Open Group
    • Re: exe... Lawrence Velázquez via austin-group-l at The Open Group
      • Re:... Oğuz via austin-group-l at The Open Group
      • Re:... Chet Ramey via austin-group-l at The Open Group
        • ... Martijn Dekker via austin-group-l at The Open Group
          • ... Christoph Anton Mitterer via austin-group-l at The Open Group
            • ... Lawrence Velázquez via austin-group-l at The Open Group
    • Re: exe... Lawrence Velázquez via austin-group-l at The Open Group
      • Re:... Geoff Clare via austin-group-l at The Open Group
        • ... Lawrence Velázquez via austin-group-l at The Open Group
          • ... Geoff Clare via austin-group-l at The Open Group
        • ... Christoph Anton Mitterer via austin-group-l at The Open Group
          • ... Geoff Clare via austin-group-l at The Open Group
      • Re:... Christoph Anton Mitterer via austin-group-l at The Open Group
    • Re: exe... Harald van Dijk via austin-group-l at The Open Group
      • Re:... Christoph Anton Mitterer via austin-group-l at The Open Group
        • ... Oğuz via austin-group-l at The Open Group
      • Re:... Christoph Anton Mitterer via austin-group-l at The Open Group
        • ... Geoff Clare via austin-group-l at The Open Group
          • ... Geoff Clare via austin-group-l at The Open Group

Reply via email to