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

cp: treat an empty file name as a non-existing file #6683

Merged
merged 2 commits into from
Sep 8, 2024

Conversation

samueltardieu
Copy link
Contributor

The PathBuf value parser from clap cannot be used directly as it does not (rightly) accept empty file names.

Fix #6177

@samueltardieu samueltardieu marked this pull request as draft September 7, 2024 19:30
@samueltardieu samueltardieu marked this pull request as ready for review September 7, 2024 19:40
@samueltardieu samueltardieu force-pushed the issue-6177 branch 6 times, most recently from 7d27f1f to 55e0521 Compare September 7, 2024 21:23
Copy link
Collaborator

@BenWiederhake BenWiederhake left a comment

Choose a reason for hiding this comment

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

Straight-forward implementation, tests, lovely.

Can you make the tests a bit more specific, just in case cp encounters an unrelated issue?

tests/by-util/test_cp.rs Outdated Show resolved Hide resolved
tests/by-util/test_cp.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@BenWiederhake BenWiederhake left a comment

Choose a reason for hiding this comment

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

LGTM!

The unhelpful error message on windows is a pity, but out of scope for this PR.

Let's see if known issue #6534 remains the only CI failure.

EDIT: Oops, I celebrated too early.

thread 'test_cp::test_cp_multiple_files_with_empty_file_name' panicked at tests\by-util\test_cp.rs:182:10:
'cp: The system cannot find the path specified. (os error 3)
' does not contain 'The system cannot find the file specified'

@samueltardieu
Copy link
Contributor Author

LGTM!

The unhelpful error message on windows is a pity, but out of scope for this PR.

Let's see if known issue #6534 remains the only CI failure.

EDIT: Oops, I celebrated too early.

thread 'test_cp::test_cp_multiple_files_with_empty_file_name' panicked at tests\by-util\test_cp.rs:182:10:
'cp: The system cannot find the path specified. (os error 3)
' does not contain 'The system cannot find the file specified'

The message on Windows is different for the empty file name and other non-existent file names. I've entered a new version.

Copy link

github-actions bot commented Sep 7, 2024

GNU testsuite comparison:

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

@samueltardieu
Copy link
Contributor Author

@BenWiederhake The only failing test is the Windows test coverage which has since be disabled in the CI.

@BenWiederhake BenWiederhake merged commit af86aee into uutils:main Sep 8, 2024
68 checks passed
@BenWiederhake
Copy link
Collaborator

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.

cp: treat emptystring-file as a regular missing file, not as invocation error
2 participants