[Tcsh] various color ls-F fixes
luke at mewburn.net
Mon Mar 13 12:32:26 UTC 2023
I've pushed more LS_COLORS improvements to the pull request - see below.
The only outstanding color-related issue I'm aware of is
what to do when:
# start with default LS_COLORS
setenv LSCOLORS something # overrides default LS_COLORS
setenv LS_COLORS something # overrides LSCOLORS
unsetenv LS_COLORS # resets to default LS_COLORS
In this scenario of unsetenv LS_COLORS or LSCOLORS, should we:
1) Leave the behaviour of "reset to default colors"?
2) Check if the "other" variable is still set and apply that?
I'm leaning towards 2).
Latest color-related improvements as at commit a71ee24
in pull request https://github.com/tcsh-org/tcsh/pull/71 :
I refactored the filetype handling, so that both the suffix
and the LS_COLORS color variale are determined in one pass.
I've implemented more color variables :
su Setuid file (u+s)
sg Setgid file (g+s)
tw Sticky and other writable dir (+t,o+w)
ow Other writable dir (o+w) but not sticky
st Sticky dir (+t) but not other writable
mh Reg file extra hard links
On 23-03-13 11:14, Luke Mewburn wrote:
| I found another intermittent ln=target bug, which I thought I'd
| already caught and fixed.
| Fixed in commit e113c39 in the same pull request.
| On 23-03-12 20:25, Luke Mewburn wrote:
| | I noticed that the color ls-F support had various niggles and bugs,
| | especially with the GNU ls LS_COLORS or FreeBSD/macOS ls LSCOLORS,
| | so I fixed the problems.
| | I've created a pull request with a bunch of changes related to color ls-F:
| | https://github.com/tcsh-org/tcsh/pull/71
| | Details:
| | - Improve color ls-F documentation
| | - clarify missing is for orphaned (broken) symlinks
| | - document LSCOLORS (it previous wasn't)
| | - Extended the testsuite:
| | - added more comments and keywords (-k ...)
| | - move ls-F tests to own ls-F.at
| | - add color ls-F tests (see CLICOLOR_FORCE)
| | - On startup, use LS_COLORS in preference to LSCOLORS. This is a
| | behaviour change, but given that LS_COLORS provides more features
| | than LSCOLORS, platforms generally only set one or the other,
| | tcsh had LS_COLORS first, and LSCOLORS wasn't documented,
| | I thought it was a reasonble change.
| | - Implement CLICOLOR_FORCE, to force color ls even if output isn't
| | to a terminal. This was needed for the color ls-F testsuite.
| | I followed the FreeBSD / macOS behaviour (which uses the presence
| | to enable force), because that appears to be the original canonical
| | implementation. Some random websites claim it should be
| | CLICOLOR_FORCE=1 and CLICOLOR_FORCE=0 disables, but there wasn't
| | an obvious example of prior art.
| | - Fix LSCOLORS bold mode support. The bug appears to be in original
| | LSCOLORS implementation in commit dcedb93 on 2012-06-21 (which
| | determined the bold status but didn't use it), and my fix partially
| | reverted commit abdf5f1 on 2015-05-28 which removed that unused variable.
| | - Fix 'ls-F directory' when using LS_COLORS ln=target. The new code
| | is simpler than the bespoke readlink() chasing - it just uses
| | filetype() with stat() instead of lstat().
| | - Fix resetting of ln=target on unsetenv LS_COLORS or setenv LSCOLORS.
| | - I updated "Fixes" with sample entries.
| | In the future I may enhance color ls-F to to support
| | more features from LSCOLORS / LS_COLORS:
| | LSCOLORS LS_COLORS Description
| | entry 8 su= setuid executable
| | entry 9 sg= setgid executable
| | entry 10 tw= directory o+w,+t
| | entry 11 ow= directory o+w
| | (n/a) st= directory +t
| | mh= regular file extra links
| | ca= file with capability (linux only?)
| | cheers,
| | Luke.
| | --
| | Tcsh mailing list
| | Tcsh at astron.com
| | https://mailman.astron.com/mailman/listinfo/tcsh
| Tcsh mailing list
| Tcsh at astron.com
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 195 bytes
Desc: not available
More information about the Tcsh