Hi,
=== Patch begins here === By default, ls highlights setuid/setgid/etc. files with a color, but there is no way to restore the old (coreutils 5.x?) behavior, i.e. that the setuid file gets the same color as it would when not having suid. Assume an /etc/DIR_COLORS of: NORMAL 0 FILE 0 EXEC 1;31 # bright red Coreutils 5.x: -rw---S--- 1 jengelh users 0 Oct 13 16:45 colorless -rwx--S--- 1 jengelh users 0 Oct 13 16:45 brightred Coreutils 6.x: -rw---S--- 1 jengelh users 0 Oct 13 16:45 hardcoded-sgid-color -rwx--S--- 1 jengelh users 0 Oct 13 16:45 hardcoded-sgid-color Adding any of the following to /etc/DIR_COLORS: # Parse error SGID # -rw---S--- 1 jengelh users 0 Oct 13 16:45 colorless # -rwx--S--- 1 jengelh users 0 Oct 13 16:45 colorless SGID 0 In short, there is no way to get at the 5.x behavior with config files only. This patch fixes the source code by removing any hardcoded defaults and changing the logic. Those who want that 6.x behavior shall use a DIR_COLORS file, such as the shipped one. Those who prefer the 5.x behavior can change their DIR_COLORS file to not include any SUID/SGID/STICKY/OWR/OWT lines. (Which is sufficient for me.) Thanks, Jan --- src/ls.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) Index: coreutils-6.9/src/ls.c =================================================================== --- coreutils-6.9.orig/src/ls.c +++ coreutils-6.9/src/ls.c @@ -549,11 +549,11 @@ static struct bin_str color_indicator[] { 0, NULL }, /* or: Orphaned symlink: undefined */ { LEN_STR_PAIR ("01;32") }, /* ex: Executable: bright green */ { LEN_STR_PAIR ("01;35") }, /* do: Door: bright magenta */ - { LEN_STR_PAIR ("37;41") }, /* su: setuid: white on red */ - { LEN_STR_PAIR ("30;43") }, /* sg: setgid: black on yellow */ - { LEN_STR_PAIR ("37;44") }, /* st: sticky: black on blue */ - { LEN_STR_PAIR ("34;42") }, /* ow: other-writable: blue on green */ - { LEN_STR_PAIR ("30;42") }, /* tw: ow w/ sticky: black on green */ + {}, /* su: setuid: white on red */ + {}, /* sg: setgid: black on yellow */ + {}, /* st: sticky: black on blue */ + {}, /* ow: other-writable: blue on green */ + {}, /* tw: ow w/ sticky: black on green */ }; /* FIXME: comment */ @@ -3883,20 +3883,20 @@ print_color_indicator (const char *name, if (S_ISREG (mode)) { type = C_FILE; - if ((mode & S_ISUID) != 0) + if ((mode & S_ISUID) != 0 && color_indicator[C_SETUID].string != NULL) type = C_SETUID; - else if ((mode & S_ISGID) != 0) + else if ((mode & S_ISGID) != 0 && color_indicator[C_SETGID].string != NULL) type = C_SETGID; - else if ((mode & S_IXUGO) != 0) + else if ((mode & S_IXUGO) != 0 && color_indicator[C_EXEC].string != NULL) type = C_EXEC; } else if (S_ISDIR (mode)) { - if ((mode & S_ISVTX) && (mode & S_IWOTH)) + if ((mode & S_ISVTX) && (mode & S_IWOTH) && color_indicator[C_STICKY_OTHER_WRITABLE].string != NULL) type = C_STICKY_OTHER_WRITABLE; - else if ((mode & S_IWOTH) != 0) + else if ((mode & S_IWOTH) != 0 && color_indicator[C_OTHER_WRITABLE].string != NULL) type = C_OTHER_WRITABLE; - else if ((mode & S_ISVTX) != 0) + else if ((mode & S_ISVTX) != 0 && color_indicator[C_STICKY].string != NULL) type = C_STICKY; else type = C_DIR; _______________________________________________ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils