]> git.ipfire.org Git - thirdparty/coreutils.git/commit
ls: protect newlines for non terminal output
authorPádraig Brady <P@draigBrady.com>
Fri, 10 Jul 2026 14:42:34 +0000 (15:42 +0100)
committerPádraig Brady <P@draigBrady.com>
Sat, 1 Aug 2026 11:38:28 +0000 (12:38 +0100)
commit0acbfaf9724fd41cb14f9265bab77cd957d251df
tree80896cc33cb2daf327d6e4587ccad79d32db58cd
parent04590790d46b4349a996bbd6ca2698a644660787
ls: protect newlines for non terminal output

Add extra protection for newlines that might be output to log files etc.

* doc/coreutils.texi (ls invocation): Expand --literal description.
* src/ls.c (quote_name_buf): Replace '\n' with '?' if appropriate.
* tests/ls/dired.sh: Add a negative test case.
* tests/ls/zero-option.sh: Likewise.
* tests/ls/m-option.sh: Likewise. Also add a positive test case.
* NEWS: Mention the improvement.
NEWS
doc/coreutils.texi
src/ls.c
tests/ls/dired.sh
tests/ls/m-option.sh
tests/ls/zero-option.sh