On 04/07/2021 18:32, Robert Elz via austin-group-l at The Open Group wrote:
     Date:        Thu, 1 Jul 2021 11:45:40 +0100
     From:        "Geoff Clare via austin-group-l at The Open Group" 
<austin-group-l@opengroup.org>
     Message-ID:  <20210701104540.GA4023@localhost>

   | it just requires pwd to write the directory to file descriptor 1.

Where does it say that?

I think the definition of "write", in Base Definitions, tries to say so, but I also think the definition is wrong.

3.449 Write

To output characters to a file, such as standard output or standard
error. Unless otherwise stated, standard output is the default output
destination for all uses of the term "write''; see the distinction
between display and write in Display.

Note the "to a file", not "to a stream". If an implementation uses stdio to achieve a write, the write has only completed once the stream has been flushed: until that happens, no file access has been performed.

However, if that interpretation is correct, the rest of the definition is wrong, as standard output and standard error are streams, not files, so the definition should read something like

> 3.449 Write
>
> To output characters to a file, such as the files associated with
> standard output or standard error. Unless otherwise stated, the file
> associated with standard output is the default output destination for
> all uses of the term "write''; see the distinction between display and
> write in Display.

Alternatively, "write" could be defined in a way such that writing to a stream is defined as writing to the file associated with that stream.

Cheers,
Harald van Dijk

P.S.: The fact that the underlying file descriptor of standard output is fd 1 rather than some other fd is specified under "stderr, stdin, stdout - standard I/O streams", look for "STDOUT_FILENO", but I think that is ultimately no longer relevant.

Reply via email to