On 2025-08-19 14:57:47 -0700, Collin Funk wrote:
> Antonio Diaz Diaz <anto...@gnu.org> writes:
> 
> > POSIX is encouraging implementations to disallow the creation of file
> > names containing any bytes that have the encoded value of a <newline>
> > character. See
> > https://pubs.opengroup.org/onlinepubs/9799919799/utilities/compress.html
> > section CHANGE HISTORY subsection Issue 8.
> 
[...]
> 
> I don't like the idea of rejecting file names that the file system
> and/or operating system allow. If POSIX were to mandate the behavior,
> then my personal preference would be to hide it behind POSIXLY_CORRECT.

https://www.austingroupbugs.net/view.php?id=251 proposed to add the
paragraph

  Implementations are encouraged to have fopen() and freopen() report
  an [EILSEQ] error if mode begins with 'w' or 'a', the file did not
  previously exist, and the last component of pathname contains any
  bytes that have the encoded value of a <newline> character.

and similar text for other functions.

But the consequence is that it will not be possible for "compress" to
create such a file. The paragraph

  If this utility is directed to create a new directory entry that
  contains any bytes that have the encoded value of a <newline>
  character, implementations are encouraged to treat this as an error.
  A future version of this standard may require implementations to
  treat this as an error.

could just mean that this is a consequence of the failure from fopen()
to create the file. (Implementations should be regarded as a whole.)

-- 
Vincent Lefèvre <vinc...@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Pascaline project (LIP, ENS-Lyon)



Reply via email to