Skip to content

Conversation

@RenjiSann
Copy link
Collaborator

@RenjiSann RenjiSann commented Feb 3, 2025

Fixes #6375, and 2 other ignored tests

@github-actions
Copy link

github-actions bot commented Feb 3, 2025

GNU testsuite comparison:

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

@RenjiSann RenjiSann changed the title cksum: Fix #6375 and un-ignore another now passing test cksum: Fix #6375 and un-ignore another now passing tests Feb 3, 2025
@RenjiSann RenjiSann changed the title cksum: Fix #6375 and un-ignore another now passing tests cksum: Fix #6375 and un-ignore now passing tests Feb 3, 2025
@github-actions
Copy link

github-actions bot commented Feb 3, 2025

GNU testsuite comparison:

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

}

#[ignore = "issue #6375"]
#[test]
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess the comment at the end of the function (line 621) is no longer needed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is not indeed, thanks for catching this !

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done 👍

Comment on lines 713 to 719
if algorithm != ALGORITHM_OPTIONS_BLAKE2B {
// An invalid "bits" part was given to the regex
// eg: MD5-128 (foo.txt) = fffffffff
return None;
}
if bitlen % 8 != 0 {
// The given length is wrong
Copy link
Contributor

@cakebaker cakebaker Feb 3, 2025

Choose a reason for hiding this comment

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

Wouldn't it be easier to read if you check for the positive case? Something like

if algorithm == ALGORITHM_OPTIONS_BLAKE2B && bitlen % 8 == 0 {
    Some(bitlen / 8)
} else {
    return None;
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I merged both conditions in a single if statement, but I find it is more understandable to check for the negative case. I've also slightly refactored the identify_algo_name_and_length function to make it return an error instead of an option. It helps making the difference between the error case and the case where no bit size was given.

WDYT ?


let bytes = if let Some(bitlen) = line_info.algo_bit_len {
if algorithm != ALGORITHM_OPTIONS_BLAKE2B {
// An invalid "bits" part was given to the regex
Copy link
Contributor

Choose a reason for hiding this comment

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

To me as a reader it's unclear what regex you refer to because this function doesn't use a regex.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fair enough, I'll rephrase this

@github-actions
Copy link

github-actions bot commented Feb 3, 2025

GNU testsuite comparison:

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Much cleaner than the previous approach :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yup, it's smaller, only iterates once, and is actually the expected behavior :)

@github-actions
Copy link

github-actions bot commented Feb 3, 2025

GNU testsuite comparison:

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

@cakebaker cakebaker merged commit 93d58b1 into uutils:main Feb 3, 2025
65 checks passed
@cakebaker
Copy link
Contributor

Thanks!

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.

" --binary --tag --untagged --binary" should display the asterisk

2 participants