ls: consistently quote symlink targets

* src/ls.c (gobble_file): Disable the optimization to avoid quoting
if the symlink target itself needs quoting.  This was introduced
with the quoting alignment adjustments in v8.25-106-g01971c0
* tests/ls/symlink-quote.sh: Add a test.
* tests/local.mk: Reference the test.
* NEWS: Mention the fix.
This commit is contained in:
Pádraig Brady committed 2017-08-24 19:26:32 -07:00
1 parent 5ee49fea85
commit ac2eebc224
4 files changed
+40

No files matched your search

+5
View File
@@ -3234,6 +3234,11 @@ gobble_file (char const *name, enum filetype type, ino_t inode,
get_link_name (absolute_name, f, command_line_arg);
char *linkname = make_link_name (absolute_name, f->linkname);
/* Use the slower quoting path for this entry, though
don't update CWD_SOME_QUOTED since alignment not affected. */
if (linkname && f->quoted == 0 && needs_quoting (f->linkname))
f->quoted = -1;
/* Avoid following symbolic links when possible, ie, when
they won't be traced and when no indicator is needed. */
if (linkname