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

Made cksum return an error if used on a directory. #5822

Merged
merged 4 commits into from
Jan 13, 2024

Conversation

Ato2207
Copy link
Contributor

@Ato2207 Ato2207 commented Jan 9, 2024

This PR should fix #5805. Now an error is generated if cksum is used on a directory and it returns an exit code of 1.

@Ato2207
Copy link
Contributor Author

Ato2207 commented Jan 9, 2024

Couldn't make the last test work by creating a temporary path + directory, so I used one already existing.

@cakebaker
Copy link
Contributor

Sorry, a rebase is needed :|

For creating a temporary directory in test_all_algorithms_fail_on_folder you can use a TestScenario, something like:

let scene = TestScenario::new(util_name!());
let at = &scene.fixtures;
at.mkdir("some_name");

for algo in ALGOS {
    scene
        .ucmd()
        ...
}

@Ato2207
Copy link
Contributor Author

Ato2207 commented Jan 11, 2024

Should be ok now I think, let me know if I need to do anything else.

@cakebaker
Copy link
Contributor

Thanks!

It's almost complete, though there is still an issue with the example from #5805 if more than one item is specified. The show! macro might be helpful for this.

@Ato2207
Copy link
Contributor Author

Ato2207 commented Jan 12, 2024

Wouldn't that be automatically solved when #5809 is merged?

@cakebaker
Copy link
Contributor

No, #5809 is about showing an error when a specified file doesn't exist, whereas this PR is about showing an error when a directory is specified.

@Ato2207
Copy link
Contributor Author

Ato2207 commented Jan 12, 2024

My bad, I understand.Should be ready now.

Copy link

GNU testsuite comparison:

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

@cakebaker cakebaker merged commit 563df4b into uutils:main Jan 13, 2024
61 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.

cksum: show error if a directory is specified
2 participants