[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: wrong color for broken symlinks
From: |
Jim Meyering |
Subject: |
Re: wrong color for broken symlinks |
Date: |
Tue, 24 Apr 2007 09:33:31 +0200 |
Jim Meyering <address@hidden> wrote:
...
>> diff --git a/src/ls.c b/src/ls.c
>> index f412dff..c0e332b 100644
>> --- a/src/ls.c
>> +++ b/src/ls.c
>> @@ -2578,7 +2578,7 @@ gobble_file (char const *name, enum filetype type,
>> ino_t i
>> node,
>> && (type == symbolic_link || type == unknown)
>> && (dereference == DEREF_ALWAYS
>> || (command_line_arg && dereference != DEREF_NEVER)
>> - || color_symlink_as_referent))
>> + || color_symlink_as_referent || check_symlink_color))
>> /* Command line dereferences are already taken care of by the above
>> assertion that the inode number is not yet known. */
>> || (print_inode && inode == NOT_AN_INODE_NUMBER)
>
> I'll apply that as soon as I write a test.
I wrote the ChangeLog entry and applied Eric's patch:
http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=1d85945
Here's the test, NEWS, etc:
http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=383713e
2007-04-24 Jim Meyering <address@hidden>
* THANKS: Add Andreas Frische.
* NEWS: Mention today's ls --color fix.
* tests/ls-2/tests (sl-dangle): Add a test for today's fix.
diff --git a/NEWS b/NEWS
index c4678e7..0542cd9 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,11 @@ GNU coreutils NEWS -*-
outline -*-
ls -x DIR would sometimes output the wrong string in place of the
first entry. [introduced in coreutils-6.8]
+ ls --color would mistakenly color a dangling symlink as if it were
+ a regular symlink. This would happen only when the dangling symlink
+ was not a command-line argument and in a directory with d_type support.
+ [introduced in coreutils-6.0]
+
ls --color, (with a custom LS_COLORS envvar value including the
ln=target attribute) would mistakenly output the string "target"
before the name of each symlink. [introduced in coreutils-6.0]
diff --git a/THANKS b/THANKS
index 63fcc39..2033c38 100644
--- a/THANKS
+++ b/THANKS
@@ -26,6 +26,7 @@ Alexey Vyskubov address@hidden
Alfred M. Szmidt address@hidden
Andi Kleen address@hidden
Andre Novaes Cunha address@hidden
+Andreas Frische address@hidden
Andreas Gruenbacher address@hidden
Andreas Jaeger address@hidden
Andreas Luik address@hidden
diff --git a/tests/ls-2/tests b/tests/ls-2/tests
index 3f2fc1d..9bf4057 100755
--- a/tests/ls-2/tests
+++ b/tests/ls-2/tests
@@ -130,6 +130,19 @@ my @Tests =
['sl-target', '--color=always d',
{OUT => "\e[0m\e[01;34mX\e[0m\n\e[m"}, $target, $target2],
+ # Test for another bug fixed in coreutils-6.10.
+ # This one bites only for a system/file system with d_type support.
+ ['sl-dangle', '--color=always d',
+ {OUT => "\e[0m\e[40;31;01mX\e[0m\n\e[m"},
+ {PRE => sub {
+ mkdir 'd',0755 or die "d: $!\n";
+ symlink 'non-existent', 'd/X' or die "d/X: $!\n";
+ $ENV{LS_COLORS}='or=40;31;01'
+ }},
+ {POST => sub {unlink 'd/X' or die "d/X: $!\n";
+ rmdir 'd' or die "d: $!\n" }},
+ ],
+
# 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)
# must not be a command line argument.