Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dircolors: trigger an error when used on / #4672

Merged
merged 2 commits into from
Apr 4, 2023

Conversation

sylvestre
Copy link
Sponsor Contributor

No description provided.

@uutils uutils deleted a comment from github-actions bot Mar 29, 2023
Ok(f) => {
let fin = BufReader::new(f);
result = parse(fin.lines().filter_map(Result::ok), &out_format, files[0]);
result = parse(
fin.lines().filter_map(Result::ok),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an instance of the clippy lint we proposed :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To clarify a bit, this should be map_while, even though we don't get the infinite loop anymore on a directory, it would still be safer to stop on an error.

result = parse(
fin.lines().filter_map(Result::ok),
&out_format,
&path.to_string_lossy(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could open an issue for date to handle non utf8 paths.

@cakebaker
Copy link
Contributor

cakebaker commented Mar 29, 2023

Hm, why do you want to trigger an error in this case? GNU dircolors 9.2 doesn't fail on my machine:

$ dircolors -c /
setenv LS_COLORS ''
$ echo $?
0

@tertsdiepraam
Copy link
Member

Probably the same reason as here: #4572 (comment)

@cakebaker
Copy link
Contributor

Thanks, you are right. There is already a new GNU test for it.

@sylvestre
Copy link
Sponsor Contributor Author

yeah, it is giving an infinite loop.
Also, i reported the issue about date -f / GNU upstream :
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=62497
and @pixelb fixed it in dircolors too
collaboration for the best :)

@tertsdiepraam
Copy link
Member

Awesome that GNU is fixing this too!

@uutils uutils deleted a comment from github-actions bot Mar 30, 2023
@tertsdiepraam tertsdiepraam merged commit f82f92e into uutils:main Apr 4, 2023
@sylvestre sylvestre deleted the dircolors branch April 5, 2023 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants