summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS4
-rw-r--r--THANKS.in1
-rw-r--r--src/ls.c11
-rwxr-xr-xtests/misc/ls-misc.pl15
4 files changed, 22 insertions, 9 deletions
diff --git a/NEWS b/NEWS
index 2e69391ce..ab205f565 100644
--- a/NEWS
+++ b/NEWS
@@ -21,6 +21,10 @@ GNU coreutils NEWS -*- outline -*-
numbers, and up to 8 times slower for some worst-case individual numbers.
[bug introduced in coreutils-7.0, with GNU MP support]
+ ls now correctly colors dangling symlinks when listing their containing
+ directories, with orphaned symlink coloring disabled in LS_COLORS.
+ [bug introduced in coreutils-8.14]
+
rm -i -d now prompts the user then removes an empty directory, rather
than ignoring the -d option and failing with an 'Is a directory' error.
[bug introduced in coreutils-8.19, with the addition of --dir (-d)]
diff --git a/THANKS.in b/THANKS.in
index 2c3f83cdc..b0061b3dd 100644
--- a/THANKS.in
+++ b/THANKS.in
@@ -153,6 +153,7 @@ David Godfrey dave@delta.demon.co.uk
David Luyer david_luyer@pacific.net.au
David Madore david.madore@ens.fr
David Malone dwmalone@cnri.dit.ie
+David Matei matei@cs.toronto.edu
Davide Canova kc.canova@gmail.com
Dawson Engler engler@stanford.edu
Dean Gaudet dean-savannah@arctic.org
diff --git a/src/ls.c b/src/ls.c
index 9494ae919..106d234f2 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -3064,12 +3064,6 @@ gobble_file (char const *name, enum filetype type, ino_t inode,
free (linkname);
}
- /* When not distinguishing types of symlinks, pretend we know that
- it is stat'able, so that it will be colored as a regular symlink,
- and not as an orphan. */
- if (S_ISLNK (f->stat.st_mode) && !check_symlink_color)
- f->linkok = true;
-
if (S_ISLNK (f->stat.st_mode))
f->filetype = symbolic_link;
else if (S_ISDIR (f->stat.st_mode))
@@ -4293,7 +4287,7 @@ print_color_indicator (const struct fileinfo *f, bool symlink_target)
/* Is this a nonexistent file? If so, linkok == -1. */
- if (linkok == -1 && color_indicator[C_MISSING].string != NULL)
+ if (linkok == -1 && is_colored (C_MISSING))
type = C_MISSING;
else if (!f->stat_ok)
{
@@ -4368,8 +4362,7 @@ print_color_indicator (const struct fileinfo *f, bool symlink_target)
/* Adjust the color for orphaned symlinks. */
if (type == C_LINK && !linkok)
{
- if (color_symlink_as_referent
- || color_indicator[C_ORPHAN].string)
+ if (color_symlink_as_referent || is_colored (C_ORPHAN))
type = C_ORPHAN;
}
diff --git a/tests/misc/ls-misc.pl b/tests/misc/ls-misc.pl
index 71647f9d6..85e3808df 100755
--- a/tests/misc/ls-misc.pl
+++ b/tests/misc/ls-misc.pl
@@ -263,6 +263,21 @@ my @Tests =
{POST => sub {unlink 's' or die "s: $!\n";
restore_ls_colors; }},
],
+ # The patch associated with sl-dangle[678] introduced a regression
+ # that was fixed after coreutils-8.19. This edge case triggers when
+ # listing a dir containing dangling symlinks, but with orphans uncolored.
+ # I.E. the same as the previous test, but listing the directory
+ # rather than the symlink directly.
+ ['sl-dangle9', '--color=always d',
+ {OUT => "$e\e[1;36ms$e\n"},
+ {PRE => sub {mkdir 'd',0755 or die "d: $!\n";
+ symlink 'dangle', 'd/s' or die "d/s: $!\n";
+ push_ls_colors('ln=1;36:or=:')
+ }},
+ {POST => sub {unlink 'd/s' or die "d/s: $!\n";
+ rmdir 'd' or die "d: $!\n";
+ restore_ls_colors; }},
+ ],
# Test for a bug that was introduced in coreutils-4.5.4; fixed in 4.5.5.
# To demonstrate it, the file in question (with executable bit set)