bugGNU Core Utilities - Bugs: bug #15043, ls assigns colors inconsistently

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #15043: ls assigns colors inconsistently

Submitted by:  None
Submitted on:  Thu 24 Nov 2005 03:14:56 AM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: Closed

Sat 26 Aug 2006 10:42:21 AM UTC, comment #4:

Thanks again.
I've just checked in a fix for coreutils-6.2: http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/7917

Jim Meyering <meyering>
Project Administrator
Tue 25 Jul 2006 12:35:36 AM UTC, comment #3:

Ok, I have tested a patch. In gobble_file, in the conditional starting 'if (command_line_arg' (the second 'if'), adding the condition '|| (type == directory && print_with_color)' fixes the problem, at least with the build I just did. Because this is only a problem on Linux, I think I would wrap it in a 'Linux-only' preprocessor directive (I'm not sure what to use, which is the only reason why I did not make an actual .patch).

...And I see I missed the OP's "Diagnosis" and "Possible solutions" the first time I read this; sorry about that.

Matthew Woehlke <woehlkmp>
Fri 21 Jul 2006 01:03:33 AM UTC, comment #2:

FWIW, I have now tested on HP-UX (both 9000/800 and Itanium), Solaris (SPARC and x86), Tru64, AIX, and of course Linux (x86). Of the above, it is ONLY broken on Linux.

Matthew Woehlke <woehlkmp>
Thu 06 Jul 2006 10:40:33 PM UTC, comment #1:

I can reproduce this with 5.97 on x86 Linux, but it works on x86 Solaris. Nothing in the source code seems to indicate why this would be broken; any guesses?

Matthew Woehlke <woehlkmp>
Thu 24 Nov 2005 03:14:56 AM UTC, original submission:

Package:
GNU core utilities

Version:
5.93

Utility:
ls

Bug summary:
ls assigns colors inconsistently.

Bug reproduction:
unset $LS_COLORS
mkdir -m 1777 tmp
ls --color -l
ls --color

Expected output:
tmp is colored black on green for both invocations of ls.

Actual output:
tmp is colored black on green on the first invocation of ls but
bright blue on the second invocation of ls.

Relevant package file:
coreutils-5.93/src/ls.c

Diagnosis:
With -l, gobble_file() does stat() tmp, f->stat.st_mode encodes
file type, UID/GID/sticky and permissions, and
print_color_indicator() assigns type = C_STICKY_OTHER_WRITABLE
(black on green by default) based on all three st_mode bitfields.
Without -l, gobble_file() doesn't stat() tmp,
f->stat.st_mode = DTTOIF (type) encodes file type, and
print_color_indicator() assigns type = C_DIR (bright blue by
default) based only on one st_mode bitfield.

Possible solutions:
* In print_color_indicator(), eliminate UID/GID/sticky and
permissions coloring for directories
* In gobble_file(), stat() if print_with_color
* In gobble_file(), stat() if (type == directory && print_with_color)

Anonymous

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

Do you think this task is very important?
If so, you can click here to add your encouragement to it.
This task has 0 encouragements so far.

Only logged-in users can vote.

 

Please enter the title of George Orwell's famous dystopian book (it's a date):

 

 

Follow 3 latest changes.

Date Changed By Updated Field Previous Value => Replaced By
Sat 26 Aug 2006 10:45:41 AM UTCmeyeringOpen/ClosedOpen=>Closed
Sat 26 Aug 2006 10:42:21 AM UTCmeyeringStatusNone=>Fixed
Fri 21 Jul 2006 01:03:33 AM UTCwoehlkmpCarbon-Copy-=>Added woehlkmp

Back to the top


Powered by Savane 3.1-cleanup1