! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
File overwrites directory and vice versa
Status:
RESOLVED: MOVED

Comments

Description h4xx0rz 2011-02-11 17:09:08 CET
When you have a file called
abc
and you create a directory using thunar which is called abc as well, there is a confirmation dialog (why can a directory overwrite a file?!). When you press Enter by mistake, not only the file is overwritten, but also Thunar is confused and thinks that abc is a file (but it's a directory now). Therefore it's not possible to launch that "file".
Vice versa you can create a directory called def and overwrite it with a new file (def). This time the directory doesn't get overwritten and there's no new file called def, only the directory. That's good, because no data is lost, but why does Thunar allow such things?
Comment 1 Butesa 2011-02-13 23:17:35 CET
I tested with Thunar 1.2.1.
Overwriting a file is fine now, but still the other two problems do occur:

* confirmation dialog defaults to yes, which means possible data loss by accident
* overwriting a file with a directory results in thunar keep thinking its a file. Even Strg+R or View->Refresh (or what way it may be named in english) doesn't help
Comment 2 Jeff Shipley 2013-07-24 00:07:33 CEST
I tested with Thunar 1.6.2.

If a file exists and a directory with the same name is created, the file is replaced by a directory. The icon for the directory is updated, and Thunar can enter the directory and create items inside the directory.

If an empty directory exists and a file with the same name is created, the directory is replaced by a file. The icon for the file is updated, and activating the file opens it up in a text editor.

If a non-empty directory exists and a file with the same name is created, Thunar reports "Error removing file."

In all three cases, a "Do you want to overwrite it?" prompt comes up and defaults to "Cancel".

The behavior seems a little strange, it should probably fail rather than try to remove a file/directory to create a directory/file. If you try to rename a file or directory with the name of an existing file/directory, it always fails.
Comment 3 Dylan Howey 2014-11-05 04:12:06 CET
(In reply to Jeff Shipley from comment #2)
> I tested with Thunar 1.6.2.
> 
> If a file exists and a directory with the same name is created, the file is
> replaced by a directory. The icon for the directory is updated, and Thunar
> can enter the directory and create items inside the directory.
> 
> If an empty directory exists and a file with the same name is created, the
> directory is replaced by a file. The icon for the file is updated, and
> activating the file opens it up in a text editor.
> 
> If a non-empty directory exists and a file with the same name is created,
> Thunar reports "Error removing file."
> 
> In all three cases, a "Do you want to overwrite it?" prompt comes up and
> defaults to "Cancel".
> 
> The behavior seems a little strange, it should probably fail rather than try
> to remove a file/directory to create a directory/file. If you try to rename
> a file or directory with the name of an existing file/directory, it always
> fails.

Jeff,

On 1.6.3 I still see the behavior of the first case. Here's how I reproduce the error:

1. Right click, and click Create Document->Empty file
2. Name the file "foo" and click Create
3. Rick click, and click Create Folder
4. Also name the file "foo" and click Create
5. Click Yes to the override warning 

The file "foo" still has a text document icon, and when double clicking on "foo" it is not traversed like a directory but rather opened like a text file. Refreshing does not fix this. I'm able to workaround this issue by leaving the directory that contains "foo" and entering again. I'm always able to enter the directory with a shell.
Comment 4 Harald Judt editbugs 2015-02-20 20:57:10 CET
The refresh bug is now fixed (1.6.5), but of course thunar will still replace a file with a folder. Not sure if that should be changed or not. At least you get a warning, though the text does not indicate exactly what will happen.
Comment 5 Git Bot editbugs 2020-05-26 23:09:12 CEST
-- GitLab Migration Automatic Message --

This bug has been migrated to xfce.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.xfce.org/xfce/thunar/-/issues/24.

Please create an account or use an existing account on one of our supported OAuth providers. 

If you want to fork to submit patches and merge requests please continue reading here: https://docs.xfce.org/contribute/dev/git/start#gitlab_forks_and_merge_requests

Also feel free to reach out to us on the mailing list https://mail.xfce.org/mailman/listinfo/xfce4-dev

Bug #7269

Reported by:
h4xx0rz
Reported on: 2011-02-11
Last modified on: 2020-05-26

People

Assignee:
Jannis Pohlmann
CC List:
5 users

Version

Attachments

Additional information