bug-coreutils
[Top][All Lists]
Advanced

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

Re: How to make the colors different for a symbol link pointing to a fil


From: Eric Blake
Subject: Re: How to make the colors different for a symbol link pointing to a file and symbol link pointing to a dir?
Date: Fri, 01 Jan 2010 07:48:27 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Eric Blake on 1/1/2010 6:48 AM:
> Ahh.  You have indeed discovered a real bug, still broken in the latest
> git sources.
> It is not a feature; we'll have it fixed for coreutils 8.3.

How about the following patch (plus the omitted THANKS changes)?  This
appears to have been broken since the introduction of 'LINK target' in
commit 5c7059a, in Apr 2000.

I still need to figure out how to enhance the testsuite to catch this.
Any hints on the best approach to take?

Obviously, the copyright hunk in the patch below is better handled by a
mass update.  I'm assuming you'll take care of that shortly, Jim?

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAks+CzoACgkQ84KuGfSFAYC27wCfWDCNpbGMFzHw7qdDBLuRpAbr
veIAoMtWV/OBciIdXtIqh3N7Vb5fyzdz
=Yxgh
-----END PGP SIGNATURE-----
>From 70274cc56f30ff8b68bf8c48f1844e83073cea47 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Fri, 1 Jan 2010 07:39:29 -0700
Subject: [PATCH] ls: fix color of broken symlinks colored as target

* src/ls.c (print_color_indicator): When using 'LINK target' in
dircolors, treat broken symlink as C_ORPHAN.
* NEWS: Document it.
* THANKS: Update.
Reported by Chris Jones.
---
 NEWS     |    4 ++++
 src/ls.c |    6 ++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/NEWS b/NEWS
index 12d5b6c..e39e5e6 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,10 @@ GNU coreutils NEWS                                    -*- 
outline -*-

 ** Bug fixes

+  ls -l --color no longer prints "argetm" in front of dangling
+  symlinks when the 'LINK target' directive was given to dircolors.
+  [bug introduced in fileutils-4.0]
+
   rm -r --one-file-system works once again.
   The rewrite to make rm use fts introduced a regression whereby
   a commmand of the above form would fail for all subdirectories.
diff --git a/src/ls.c b/src/ls.c
index 6c1f275..246170c 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -1,5 +1,5 @@
 /* `dir', `vdir' and `ls' directory listing programs for GNU.
-   Copyright (C) 85, 88, 90, 91, 1995-2009 Free Software Foundation, Inc.
+   Copyright (C) 85, 88, 90, 91, 1995-2010 Free Software Foundation, Inc.

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -4163,7 +4163,9 @@ print_color_indicator (const struct fileinfo *f, bool 
symlink_target)
             type = C_STICKY;
         }
       else if (S_ISLNK (mode))
-        type = ((!linkok && color_indicator[C_ORPHAN].string)
+        type = ((!linkok
+                 && (!strncmp (color_indicator[C_LINK].string, "target", 6)
+                     || color_indicator[C_ORPHAN].string))
                 ? C_ORPHAN : C_LINK);
       else if (S_ISFIFO (mode))
         type = C_FIFO;
-- 
1.6.4.2


reply via email to

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