Bug 245270 - ls(1) man page describes LSCOLORS wrong
Summary: ls(1) man page describes LSCOLORS wrong
Status: Open
Alias: None
Product: Documentation
Classification: Unclassified
Component: Manual Pages (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2020-04-02 04:16 UTC by Andras Farkas
Modified: 2023-11-16 12:53 UTC (History)
3 users (show)

See Also:


Attachments
diff to ls.1 (777 bytes, patch)
2020-04-02 04:16 UTC, Andras Farkas
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andras Farkas 2020-04-02 04:16:33 UTC
Created attachment 212969 [details]
diff to ls.1

The ls man page
https://www.freebsd.org/cgi/man.cgi?query=ls&apropos=0&sektion=0&manpath=FreeBSD+12.1-RELEASE+and+Ports&arch=default&format=html
https://github.com/freebsd/freebsd/blob/master/bin/ls/ls.1
describes the colors wrong.  I checked ls's code, and indeed it can and does use ANSI color, so the actual ANSI standard can be referenced for color names and behavior:
http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf
Especially since the man page also references ANSI in the LSCOLORS section.
Discovered this on 12.1-RELEASE-p3 but wrote and attached a patch for the ls.1 currently seen in the GitHub repository (presumably -current)

Important to note is that some terminals do not have separate colors for bold and non-bold text.  Some terminals do have separate colors, of course, but not all.

Semi-relatedly, and not dealt with in this patch or bug report:
LSCOLORS's format is deficient, anyway.  Setting it to bC, Bc, or BC provides the same output.  The colors struct in ls's print.c has bold-status, foreground color, and background color as three different items.  The LSCOLORS string should have them as three different characters too, rather than conflating boldness with one of the colors.  Hence I think bc should be 0bc and Bc, bC, and BC should be 1bc
Comment 1 Vladimir Druzenko freebsd_committer freebsd_triage 2020-08-03 16:44:38 UTC
My experience.

* 12.1 amd64
* x11/konsole
* default TERM=xterm-256color

Without bold color:
$ export LSCOLORS=exfxcxdxbxegedabagacad
$ ls -G /
look same as with bold color for dirs:
$ export LSCOLORS=Exfxcxdxbxegedabagacad
$ ls -G /
but this output is correct with different color for dirs:
$ export TERM=xterm-16color
$ export LSCOLORS=Exfxcxdxbxegedabagacad
$ ls -G /

I tested different combinations of the colors for the dirs: ex, Ex, eX, EX, ea, Ea, eA, EA - look same with TERM=xterm-256color (my default background is black).
Background always isn't bold even with TERM=xterm-16color.

P.S. x11/konsole have option to draw bold colors as custom colors - Intence colors.
Comment 2 Gordon Bergling freebsd_committer freebsd_triage 2021-01-30 21:13:13 UTC
Talking about colors in manual page isn't that productive since there are tons of things involved like gamma settings and so on.
Comment 3 Andras Farkas 2021-01-31 07:05:38 UTC
We're not talking about colors here, we're talking about the actual terminal standards written by ANSI and ECMA.
ls.1 is in the wrong here
Comment 4 Gordon Bergling freebsd_committer freebsd_triage 2023-11-16 12:53:03 UTC
Release to the pool