bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#9634: Coreutils 8.13 - Orphaned symlinks start with 'argetm' when us


From: Pádraig Brady
Subject: bug#9634: Coreutils 8.13 - Orphaned symlinks start with 'argetm' when using dircolors
Date: Fri, 30 Sep 2011 21:38:49 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0) Gecko/20110816 Thunderbird/6.0

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];






reply via email to

[Prev in Thread] Current Thread [Next in Thread]