Adjust -i behavior for ln, cp & mv #4630
Merged
sylvestre merged 4 commits intouutils:mainfrom Mar 26, 2023
sylvestre:inter-error
Merged
Adjust -i behavior for ln, cp & mv #4630sylvestre merged 4 commits intouutils:mainfrom sylvestre:inter-error
sylvestre merged 4 commits intouutils:mainfrom
sylvestre:inter-error
Conversation
Matches the change upstream 7a69df88999bedd8e9fccf9f3dfa9ac6907fab66
Just like mv Note that cp -i -u won't show the overwrite question Matches the change upstream 7a69df88999bedd8e9fccf9f3dfa9ac6907fab66
Just like mv & cp Matches the change upstream 7a69df88999bedd8e9fccf9f3dfa9ac6907fab66
25 tasks
GNU ln uses "replace" instead of "overwrite"
cakebaker
approved these changes
Mar 26, 2023
Contributor
cakebaker
left a comment
There was a problem hiding this comment.
While reviewing I noticed that we use "overwrite" in the prompt of ln instead of "replace" and fixed it.
| OverwriteMode::Interactive => { | ||
| if !prompt_yes!("overwrite {}?", to.quote()) { | ||
| return Ok(()); | ||
| return Err(io::Error::new(io::ErrorKind::Other, "")); |
Collaborator
There was a problem hiding this comment.
Can we do something else than constructing an io::Error? This is going to give a weird error message isn't it? For a PR like this, I guess it's OK, though.
Contributor
Author
There was a problem hiding this comment.
well, there isn't any error message :)
$ touch a b && echo "n"|./target/debug/coreutils mv -i a b; echo $?
mv: overwrite 'b'?
1
|
GNU testsuite comparison: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Mentioned in issue #4627
touch a b && echo "n"|./target/debug/coreutils ln -i a b; echo $?
was 0, it is now 1
See:
coreutils/coreutils@7a69df8
(no problem reading the code here as there isn't much)