[Tcsh] various color ls-F fixes

Luke Mewburn luke at mewburn.net
Wed Apr 12 12:41:26 UTC 2023


On 23-04-10 12:39, Kimmo Suominen wrote:
  | On Thu, 23 Mar 2023 at 15:38, Luke Mewburn <luke at mewburn.net> wrote:
  | > Regarding the unsetenv issue below. I experimented with this,
  | > but decided the behaviour was a bit weird if you did something like:
  | >         $ setenv LSCOLORS bad
  | >         Unknown colorls variable '?o'.
  | >         $ setenv LS_COLORS ln=target
  | >         $ unsetenv LS_COLORS
  | >         Unknown colorls variable '?o'.
  | > This last error is from re-parsing the previously errorneous LSCOLORS.
  | >
  | > So I decided not to proceed with that (I have the diff around if
  | > people want it).
  | 
  | I think I would like this behaviour but suppress errors in the
  | unsetenv case. Would that be possible? Would it make sense to others?
  | 
  | My thinking is that the error was already issued when LSCOLORS was
  | set. If we are "reusing" a bad value, we don't need the error message.


That's a good idea, and I implemented it. See pull request:
	https://github.com/tcsh-org/tcsh/pull/74
as at commit a759e51.


I also extended the ls-F testsuite to exercise more of the parsing
of LSCOLORS and LS_COLORS, and identified & fixed a crash 
when LSCOLORS was >22 chars (11 color pairs).


An example:

	env -i HOME=$HOME TERM=$TERM ./tcsh -f
	> set color printexitvalue
	> setenv LSCOLORS CBZZ
	Unknown LSCOLORS color variable 'Z?'.
	Exit 1

CB was applied, so ls-F shows directories as bold red on bold green.

	> setenv LS_COLORS ln=target:ZZ=0
	Unknown LS_COLORS color variable 'ZZ'.
	Exit 1

Default colors with ln=target worked, so ls-F shows directories in
default blue foreground.

	> unsetenv LS_COLORS

Colors set back to LSCOLORS CBZZ, without a warning for invalid 'ZZ' this time.


cheers,
Luke
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/tcsh/attachments/20230412/863bda37/attachment.asc>


More information about the Tcsh mailing list