[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: changelog bug-closing should not be used unless the code changes

Ben: I think you should re-open this bug.

Single Unix Specification says:

     A handle which is a stream is considered to be closed when either
     an fclose() or freopen() is executed on it (the result of freopen()
     is a new stream, which cannot be a handle on the same open file
     description as its previous value), or when the process owning that
     stream terminates with exit() or abort(). A file descriptor is
     closed by close(), _exit() or the exec functions when FD_CLOEXEC is
     set on that file descriptor.
     When these rules are followed, regardless of the sequence of
     handles used, implementations will ensure that an application, even
     one consisting of several processes, will yield correct results: no
     data will be lost or duplicated when writing, and all data will be
     written in order, except as requested by seeks. It is
     implementation-dependent whether, and under what conditions, all
     input is seen exactly once.

For this be true, it must also be true that no data will be lost when a
command line like the following is executed, and the file system is full:

$ command blah blah... >file

For example, the program could wait (presumably in select()) if the file
system was full when trying to exit() with non-empty buffers.

Exiting without writing the data [and even more, without providing a
failure notice] is clearly a violation of this standard.


Reply to: