GNU bug report logs -
#9634
Coreutils 8.13 - Orphaned symlinks start with 'argetm' when using dircolors
Previous Next
Full log
Message #8 received at 9634 <at> debbugs.gnu.org (full text, mbox):
On 09/29/2011 09:48 PM, Jason Glassey wrote:
> I had seen this was a bug supposed to be fixed in Coreutils 8.3, but I
> can still replicate this bug in
> Coreutils 8.13
>
> In my .bashrc file, I have this alias:
>
> alias ls='ls -Lp --color=auto --group-directories-first'
>
> Symlinks appear fine when the target exist, but when the symlink
> becomes orphaned (such as a
> symlink to a removable drive), the symlink starts with 'argetm'
>
> I only get this problem when I use the '--dereference' option, and
> when the target does not exist
> when using dircolors.
Confirmed. I'll fix it with something like the following,
and I'll add a test too.
cheers,
Pádraig.
diff --git a/src/ls.c b/src/ls.c
index 680a7c3..e7d0a5c 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -4203,10 +4203,7 @@ print_color_indicator (const struct fileinfo *f, bool symlink_target)
type = C_STICKY;
}
else if (S_ISLNK (mode))
- type = ((!linkok
- && (!STRNCMP_LIT (color_indicator[C_LINK].string, "target")
- || color_indicator[C_ORPHAN].string))
- ? C_ORPHAN : C_LINK);
+ type = C_LINK;
else if (S_ISFIFO (mode))
type = C_FIFO;
else if (S_ISSOCK (mode))
@@ -4241,6 +4238,14 @@ print_color_indicator (const struct fileinfo *f, bool symlink_target)
}
}
+ /* Adjust the color for orphaned symlinks. */
+ if (type == C_LINK && !linkok)
+ {
+ if (!STRNCMP_LIT (color_indicator[C_LINK].string, "target")
+ || color_indicator[C_ORPHAN].string)
+ type = C_ORPHAN;
+ }
+
{
const struct bin_str *const s
= ext ? &(ext->seq) : &color_indicator[type];
This bug report was last modified 13 years and 321 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.