Skip to content

cksum: even more fixes #6929

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

Merged
merged 8 commits into from
Dec 12, 2024
Merged

cksum: even more fixes #6929

merged 8 commits into from
Dec 12, 2024

Conversation

RenjiSann
Copy link
Collaborator

@RenjiSann RenjiSann commented Dec 6, 2024

Fixes #6653

This PR changes the way the regex to parse a checksum line is chosen. Now, every line gets to choose the regex it matches with, instead of trying to match with the regex that matched the first line (except for non-algo based line which should follow the flavor of the first one).

While doing this, I've decided to get rid of the regex::Capture which was being carried around everywhere, and create a LineInfo struct that holds all the parsed data.

It adds lazy_static as a direct dependency to uu_core (it was an indirect dependency until now). I allows to not recompile the regexes again and again.


EDIT: I have added some code to rework the way the expected checksum is decoded, this PR now fixes #6576 and #6614 as well.

Copy link

github-actions bot commented Dec 6, 2024

GNU testsuite comparison:

Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)

@sylvestre
Copy link
Contributor

a few jobs are failing

@RenjiSann RenjiSann force-pushed the cksum-fixes branch 2 times, most recently from 42997a2 to f36fe46 Compare December 6, 2024 21:57
Copy link

github-actions bot commented Dec 6, 2024

GNU testsuite comparison:

Skip an intermittent issue tests/tail/inotify-dir-recreate (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)

Copy link

github-actions bot commented Dec 6, 2024

GNU testsuite comparison:

Skip an intermittent issue tests/tail/inotify-dir-recreate (fails in this run but passes in the 'main' branch)

Copy link

github-actions bot commented Dec 7, 2024

GNU testsuite comparison:

Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)

@RenjiSann RenjiSann force-pushed the cksum-fixes branch 2 times, most recently from eda6659 to f836b08 Compare December 7, 2024 01:43
@RenjiSann
Copy link
Collaborator Author

a few jobs are failing

I've fixed what I could.
There's still the anstream issue which is not fixed yet, and some "license_not_encountered" stuff which I don't think are my fault

Copy link

github-actions bot commented Dec 7, 2024

GNU testsuite comparison:

Skip an intermittent issue tests/tail/inotify-dir-recreate (fails in this run but passes in the 'main' branch)

@RenjiSann RenjiSann force-pushed the cksum-fixes branch 2 times, most recently from 5f22dad to 5e92491 Compare December 10, 2024 08:58
Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/timeout/timeout (passes in this run but fails in the 'main' branch)

Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/timeout/timeout (passes in this run but fails in the 'main' branch)

Comment on lines +676 to +688
let (filename_to_check_unescaped, prefix) = unescape_filename(filename);
let real_filename_to_check = os_str_from_bytes(&filename_to_check_unescaped)?;
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest to rename filename_to_check_unescaped to unescaped_filename_to_check to match the naming of real_filename_to_check. And I think the _to_check suffices can be dropped in both cases.

Copy link
Contributor

@cakebaker cakebaker left a comment

Choose a reason for hiding this comment

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

Overall good job with this refactoring!

@RenjiSann RenjiSann force-pushed the cksum-fixes branch 4 times, most recently from c410c28 to e7fa8dd Compare December 11, 2024 23:28
@cakebaker cakebaker merged commit 209ec0b into uutils:main Dec 12, 2024
61 of 62 checks passed
@cakebaker
Copy link
Contributor

Thanks :)

@sylvestre
Copy link
Contributor

@RenjiSann btw, you will see that the fuzzer finds some issues:
https://github.com/uutils/coreutils/actions/runs/12560388614/job/35017702985

to run it locally:
cargo +nightly fuzz run fuzz_cksum -- -max_total_time=60 -detect_leaks=0

@RenjiSann
Copy link
Collaborator Author

@RenjiSann btw, you will see that the fuzzer finds some issues: https://github.com/uutils/coreutils/actions/runs/12560388614/job/35017702985

to run it locally: cargo +nightly fuzz run fuzz_cksum -- -max_total_time=60 -detect_leaks=0

Indeed. Many tests fail because the cksum installed in the CI is older than ours (probably GNU coreutils 9.1 which is Ubuntu's default), which does not support --base64 and --raw.

Another issue is that --length validity should be checked before the --check argument.
I will try to identify other problems and open issues for them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants