Delete action doesn't delete file?

Older bugs which are supposed to be fixed in 0.84. *** Please try to reproduce your bug and confirm the bug fix. ***

Moderators: XnTriq, helmut, xnview, Dreamer

xerofun
Posts: 8
Joined: Sun Oct 17, 2010 9:05 am

Re: Delete action doesn't delete file?

Post by xerofun »

Same happend to me withXnViewMP 0.84 on Ubuntu 16.04.1, this problem bugged me for quite a while now.

I debugged the problem a little using strace. :bugconfirmed:

As describe in this post it's mostly about the Trash folder, with "Use recycle bin" enabled or working with files you don't have write permissions to. In the first case trouble arises, when using external media, like USB drives or other mounted partitions for example.

With "Use recycle bin" enabled: Deleting files in /tmp/ works fine, because the trash folder in my home directory is used. But deleting files from a drive mounted to i.e. /mnt/ fails.

That happens when XnView tries to create a trash folder in the root folder of the partiton or media you are working on and is not able to do so. There might be several reasons for that:
1. Trash folder doesn't exist and user running XnView has no permissions to create it in the root directory of your partition/external media.
2. Trash folder exists and user running XnView has no permissions to write or read.

Workarounds: (pick one)
1. Undesirable workaround (because recycle bin will obviously be inactive after that): F12 > General > File operations > disable "Use recycle bin"
2. Depending on your permissions, this might be unsafe: Change mount options to allow your current user to write in the root folder of the media (/etc/fstab: add uid=<your current user id>, remount)
3. Create a Trash folder in the root of your mounted media/partition (mkdir .Trash-1000) and change owner to your user (recursively)
3.1 Attention. Running XnView with a non-root user and the trash folder is owned by root.root with permissions 777 doesn't seem to work!
4. In case the trash folder is working fine and you just don't have permissions to delete the files: Adjust file permissions of your pictures (again remember security implications on a multi user system if you chmod 666)

@Pierre: For a permanent fix I'd suggest to include an error message, if XnView is not able to create or write to the Trash folder while "Use recycle bin" is enabled, offering an option to remove the file directly instead of just pretending to do so. This saves a lot of time for any user deleting lots of files.
User avatar
helmut
Posts: 8705
Joined: Sun Oct 12, 2003 6:47 pm
Location: Frankfurt, Germany

Re: Delete action doesn't delete file?

Post by helmut »

Thank you for your analysis and list of possible workarounds, xerofun. That really helps and is much appreciated! :)
User avatar
kewl
Posts: 6
Joined: Sun Oct 04, 2009 3:13 am

Re: Delete action doesn't delete file?

Post by kewl »

same issue here I lost 1 hour thinking i was cleaning up a folder :bugconfirmed:
I was in scenario 3.1 described above and the fix was to add uid=1000 to fstab
then this is not ideal I preferred previous default setup. it would be nice if this could be fixed :D
thanks
User avatar
xnview
Author of XnView
Posts: 44885
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: Delete action doesn't delete file?

Post by xnview »

kewl wrote:same issue here I lost 1 hour thinking i was cleaning up a folder :bugconfirmed:
I was in scenario 3.1 described above and the fix was to add uid=1000 to fstab
then this is not ideal I preferred previous default setup. it would be nice if this could be fixed :D
thanks
I can reproduce now. Do you have gvfs-trash?
Pierre.
User avatar
xnview
Author of XnView
Posts: 44885
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: Delete action doesn't delete file?

Post by xnview »

O.k., thank you, I can also reproduce the problem. Issue 1203 is fixed in next version.
Pierre.
Koneko
Posts: 2
Joined: Sat Oct 08, 2022 10:54 pm

Re: Delete action doesn't delete file?

Post by Koneko »

Sorry to resurrect this thread... however I just ran into this issue myself.

I was working on photos that are stored on a CIFS mount. Deleting the photos in XnView removed the hard links on the files but did not delete the file records causing all OS file operations to fail; I had to SSH into my NAS to delete the files. This was using the FlatPak distribution and use recycle bin was turned on.

I switched to the deb package and turned off use recycle bin which seems to have resolved the issue.
User avatar
xnview
Author of XnView
Posts: 44885
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: Delete action doesn't delete file?

Post by xnview »

Koneko wrote: Sat Oct 08, 2022 10:58 pm I switched to the deb package and turned off use recycle bin which seems to have resolved the issue.
If ON, files are not deleted?
Pierre.
Koneko
Posts: 2
Joined: Sat Oct 08, 2022 10:54 pm

Re: Delete action doesn't delete file?

Post by Koneko »

Correct I can see the deleted files in the directory still, however they are corrupt and I cant do anything with them, rm -rf fails as do all other file operations. When I do an ls -al the files show up with the original file size however they show 0 for hard links. If I had to guess, the file pointer is being removed but the inodes aren't being deleted.

Now that I am using the deb package & have use recycle bin off everything seems to be working. I haven't done any additional testing.