-
Notifications
You must be signed in to change notification settings - Fork 22
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
Don't move a file under a directory when renaming #404
Conversation
src/fileActions.jsx
Outdated
@@ -206,8 +206,8 @@ const RenameItemModal = ({ path, selected }) => { | |||
: path.join("/") + "/" + name; | |||
|
|||
cockpit.spawn(is_current_dir | |||
? ["mv", path.join("/"), newPath] | |||
: ["mv", path.join("/") + "/" + selected.name, newPath], | |||
? ["mv", "-T", path.join("/"), newPath] |
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.
Hmm this should be covered. Let's try to cover that in a follow up but let's think about it:
This is about renaming the current dir, which we no longer support, so this is dead code.
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.
Looks good, thanks!
I guess we get something like "targetname: Is a directory"?
Tests would be nice ;)
I've added a test, see the |
Added a test for this scenario which shows the wrong behavior...
This just moves newfile into an existing file without warning. Let's fix it in this PR as I already have a test. |
Turns, out we likely want just |
We rename in Files by moving the file to the new filename but when this is a directory `mv` moves the file to that directory instead. This is quite logical in a shell but not in a GUI, there it is unexpected behaviour. Furthermore when renaming an existing file we replace it, that is unexpected as well and should be possible but in the first place should warn. Closes: cockpit-project#399
In db968b2 we unified the sidepanel menu and the contextmenu so they would be identical. This removed the ability to rename the current directory, this is not something GNOME Files supports or something we want to support.
This is flaky or coreutils changed behaviour. Re-trying once. |
Yup, this is broken. Needs work. |
Yeah this is great :) It is likely a bug in coreutils as it happens in rawhide as well. Fedora 40 has 9.4 while Arch has 9.5 This is indeed the case see: https://github.com/coreutils/coreutils/blob/master/NEWS#L123 As alternative @allisonkarlitskaya suggested passing |
If you don't want to do the async work, there's a somewhat easier version:
with the successful case looking like
The key here is If you do want to do the async work, that's |
Le JS code:
|
This needs to be expedited as renaming a folder into a new folder still works which is wrong. |
Superseeded by #459 |
We rename in Files by moving the file to the new filename but when this is a directory
mv
moves the file to that directory instead. This is quite logical in a shell but not in a GUI, there it is unexpected behaviour.Closes: #399