▲ | machinestops 20 hours ago | |||||||||||||
A lot of this post hinges on the fact that newlines in filenames were legal, and that people wrote shell without handling quoting correctly. While quoting (as well as ls altering filenames) is still an issue, find -print0, read -d '', and similar are no longer neccessary. Newlines are now forbidden in filenames: https://blog.toast.cafe/posix2024-xcu | ||||||||||||||
▲ | threePointFive 20 hours ago | parent | next [-] | |||||||||||||
> Newlines are now forbidden in filenames No. To quote that article > A bunch of C functions are now encouraged to report EILSEQ if the last component of a pathname to a file they are to create contains a newline This, yes, makes newlines in filenames effectively illegal on operating systems strictly conforming to the new POSIX standard. However, older systems will not be enforcing this and any operating system which exposes a syscall interface that does not require libc (such as Linux) is also not required to emit any errors. The only time even in the future that you should NOT worry about handling the newline case is on filesystems where it's is expressly forbidden, such as NTFS. | ||||||||||||||
| ||||||||||||||
▲ | CJefferson 20 hours ago | parent | prev [-] | |||||||||||||
Linux isn't POSIX compliant, and as far as I know has no plans to ban newlines in filenames, or even add an option to disable newlines. | ||||||||||||||
|