On 2026-01-13 06:10, Douglas McIlroy wrote:
without the check, the following weird behavior
is possible.I suspect this is what motivated the check.

      *w FILE/   creat makes an ordinary file named FILE
      *r FILE/    open fails with "Not a directory"
      !ls FILE*
      FILE

That's not what happens on GNU/Linux or any system conforming to POSIX.1-2001 or later, since creat cannot ignore trailing slashes. The old behavior of allowing (but not requiring) creat to ignore trailing slashes was declared to be nonconforming in POSIX.1-2001. See:

https://pubs.opengroup.org/onlinepubs/9799919799/xrat/V4_xbd_chap01.html#tag_21_04_16

So without the check, GNU ed has the following behavior, which is fine:

w FILE/
FILE/: Is a directory
?
r FILE/
FILE/: No such file or directory
?
!ls FILE*
ls: cannot access 'FILE*': No such file or directory
!


Reply via email to