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 06:48:04 -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 Chris Jones on 1/1/2010 6:20 AM:
> So recreating the problem was really as simple as ln'ing a broken soft
> link:
> 
> ------------------------------------------------------------------------
> $ ln -s xxx lxxx            # where there is no such file as 'xxx'
> ------------------------------------------------------------------------
> 

Ahh.  You have indeed discovered a real bug, still broken in the latest
git sources.

$ rm -Rf a b
$ ln -s a b
$ LS_COLORS=ln=target src/ls -ld --color=auto b
lrwxrwxrwx 1 eblake None 1 2010-01-01 06:41 argetmb -> a

> There must be some good reason why 'ln' accepts to create such links in
> the first place.

And that reason is that POSIX requires it.

> OTOH, maybe the spurious display of 'argetm' - not sure where the 'm'
> comes from - could be considered a bug. Or maybe a feature, since is
> does make broken links very visible? 

The m is leftovers from the fact that \033[t is a valid terminal sequence,
when normally you would use \033[34m as the terminal sequence to select
blue.  Observe:

$ LS_COLORS=ln=34 src/ls -ld --color=always b | od -tx1z -w12
0000000 6c 72 77 78 72 77 78 72 77 78 20 31  >lrwxrwxrwx 1<
0000014 20 65 62 6c 61 6b 65 20 4e 6f 6e 65  > eblake None<
0000030 20 31 20 32 30 31 30 2d 30 31 2d 30  > 1 2010-01-0<
0000044 31 20 30 36 3a 34 31 20 1b 5b 30 6d  >1 06:41 .[0m<
0000060 1b 5b 33 34 6d 62 1b 5b 30 6d 20 2d  >.[34mb.[0m -<
0000074 3e 20 61 0a 1b 5b 6d                 >> a..[m<
0000103
$ LS_COLORS=ln=target src/ls -ld --color=always b | od -tx1z -w12
0000000 6c 72 77 78 72 77 78 72 77 78 20 31  >lrwxrwxrwx 1<
0000014 20 65 62 6c 61 6b 65 20 4e 6f 6e 65  > eblake None<
0000030 20 31 20 32 30 31 30 2d 30 31 2d 30  > 1 2010-01-0<
0000044 31 20 30 36 3a 34 31 20 1b 5b 30 6d  >1 06:41 .[0m<
0000060 1b 5b 74 61 72 67 65 74 6d 62 1b 5b  >.[targetmb.[<
0000074 30 6d 20 2d 3e 20 61 0a 1b 5b 6d     >0m -> a..[m<
0000107

It is not a feature; we'll have it fixed for coreutils 8.3.

- --
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/

iEYEARECAAYFAks9/RQACgkQ84KuGfSFAYA4KwCfXC8mIm/mOfTOqN80EyX0a38Y
V5YAnjnCJn9xzu1fwcxl+KFpvKBzOwqr
=HGf9
-----END PGP SIGNATURE-----




reply via email to

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