uutils / coreutils

Cross-platform Rust rewrite of the GNU coreutils
https://uutils.github.io/
MIT License
17.26k stars 1.24k forks source link

ls: gnu test case `color-ext` compatibility #6536

Open matrixhead opened 5 days ago

matrixhead commented 5 days ago

The GNU test case color-ext was failing because our ls command doesn't handle suffix letter cases.

example 1

touch img1.jpg IMG2.JPG img3.JpG file1.z file2.Z
LS_COLORS="*.jpg=01;35:*.JPG=01;35;46" ls -U1 --color=always   img1.jpg IMG2.JPG img3.JpG

our ls would produce output

^[0m^[01;35;46mimg1.jpg^[0m
^[01;35;46mIMG2.JPG^[0m
^[01;35;46mimg3.JpG^[0m

but it should be

^[0m^[01;35mimg1.jpg^[0m
^[01;35;46mIMG2.JPG^[0m
img3.JpG

like wise

example 2

LS_COLORS="*.jpg=01;35;46:*.jpg=01;35:*.JPG=01;35;46"   ls -U1 --color=always img1.jpg IMG2.JPG img3.JpG 

our ls would give

^[0m^[01;35;46mimg1.jpg^[0m
^[01;35;46mIMG2.JPG^[0m
^[01;35;46mimg3.JpG^[0m

but it should be

^[0m^[01;35mimg1.jpg^[0m
^[01;35;46mIMG2.JPG^[0m
img3.JpG

In both cases, this is happening because lscolors doesn't care about the case sensitivity of the entries in the env.

sylvestre commented 5 days ago

ls command doesn't handle suffix letter cases

what do you mean by this ? :)

matrixhead commented 5 days ago

sorry, I was typing it and accidentally pressed Ctrl+enter

matrixhead commented 5 days ago

I already made an issue in lscolors's repo and working on a fix