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

hashsum: use file_stem() instead of file_name() #5020

Merged
merged 1 commit into from
Jun 29, 2023

Conversation

indygreg
Copy link
Contributor

This program matches the binary name to determine which algorithm to use. On Windows, file_name() was matching against a string with .exe, causing binaries like sha256sum.exe to not properly detect the algorithm.

By using file_stem(), we exclude the .exe from matching, achieving similar and correct behavior on Windows.

This program matches the binary name to determine which
algorithm to use. On Windows, `file_name()` was matching
against a string with `.exe`, causing binaries like
`sha256sum.exe` to not properly detect the algorithm.

By using `file_stem()`, we exclude the `.exe` from matching,
achieving similar and correct behavior on Windows.
@cakebaker cakebaker merged commit 610e046 into uutils:main Jun 29, 2023
39 of 45 checks passed
@cakebaker
Copy link
Contributor

Thanks for your PR :)

@sylvestre
Copy link
Sponsor Contributor

i was wondering if we could not add a test for this?
https://github.com/uutils/coreutils/blob/main/tests/by-util/test_hashsum.rs

@cakebaker
Copy link
Contributor

@sylvestre how would you write a test for this? I tried to add one to test_hashsum.rs, though the test framework seems to use coreutils.exe and not <util>.exe.

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