-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
split: Added error when attempting to create file that already exists as directory #9945
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
split: Added error when attempting to create file that already exists as directory #9945
Conversation
|
I am confused why the windows test doesn't work, the code in unix.rs and windows.rs seems the same to me. Can anyone help? |
|
|
|
csplit does this differently, with let file = File::open(file_name)
.map_err_context(|| format!("cannot open {} for reading", file_name.quote()))?;
Ok(csplit(&options, &patterns, BufReader::new(file))?)in |
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
| _ => Error::other( | ||
| translate!("split-error-unable-to-open-file", "file" => filename), | ||
| ) | ||
| ), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rust linting in the pre-commit hook doesn't like it not being there, i.e. cargo fmt requires it to be there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK thanks
… as directory (uutils#9945) * split: Added error when attempting to create file that already exists as dir * split: Added integration test test_split::test_split_directory_already_exists * Fixed dependency error in windows.rs * Modified test to work on systems without /dev/zero * Attempt to fix windows error handling * Removed test for windows and made it more rigorous * Err made to look more like gnu * Updated test to reflect change in err message
Fixes #9937
Not sure if error message could be better named