diff options
author | Pádraig Brady <P@draigBrady.com> | 2012-09-16 04:10:50 +0100 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2012-09-16 11:41:50 +0100 |
commit | a04ddb8dd3fffd3457f927a36f6840fc1465aba2 (patch) | |
tree | a62d215ecd1b67d6a6daf9c5c025252c80fa2f98 /tests | |
parent | c5ccf29bbfaab01ed893c9ca3a3843181c329317 (diff) | |
download | coreutils-a04ddb8dd3fffd3457f927a36f6840fc1465aba2.tar.xz |
ls: fix coloring of dangling symlinks in default listing mode
When listing a directory containing dangling symlinks,
and not outputting a long format listing, and orphaned links
are set to no coloring in LS_COLORS, then the symlinks
would get no color rather than reverting to the standard
symlink color. The issue was introduced in v8.13-19-g84457c4
* src/ls.c (print_color_indicator): Use the standard method
to check if coloring is specified for orphaned symlinks.
The existing method would consider 'or=00' or 'or=0' as significant
in LS_COLORS. Even 'or=' was significant as in that case the
string='or=' and the length=0. Also apply the same change
for missing symlinks for consistency.
(gobble_file): Remove the simulation of linkok, which is only
tested in print_color_indicator() which now handles this directly
by keying on the LS_COLORS values correctly.
* tests/misc/ls-misc.pl: Add a test case.
* THANKS: Add the reporter.
* NEWS: Mention the fix.
Reported-by: David Matei
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/misc/ls-misc.pl | 15 |
1 files changed, 15 insertions, 0 deletions
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) |