View Issue Details

IDProjectCategoryView StatusLast Update
0002527Double CommanderFile operationspublic2021-05-24 15:09
Reporternoname00 Assigned ToAlexx2000  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
ProjectionnoneETAnone 
OSLinux 
Product Version0.9.9 
Target Version1.0.0Fixed in Version1.0.0 
Summary0002527: Individual files deleted to trash remain in original folder
DescriptionFolders are moved to $XDG_DATA_HOME/Trash correctly, but individual files remain in their original location.

$ ls -R
.:
$ touch file
$ mkdir folder

### after deleting file and folder to trash:

$ ls -R
.:
file.Trash-1000

./file.Trash-1000:
files info

./file.Trash-1000/files:
file_3809606769132

./file.Trash-1000/info:
file_3809606769132.trashinfo

$ ls -R $XDG_DATA_HOME/Trash
/home/demo/.local/share/Trash:
files info

/home/demo/.local/share/Trash/files:
folder_3809606769132

/home/demo/.local/share/Trash/files/folder_3809606769132:

/home/demo/.local/share/Trash/info:
folder_3809606769132.trashinfo
TagsNo tags attached.
Attached Files
trash.patch (780 bytes)   
Index: src/platform/utrash.pas
===================================================================
--- src/platform/utrash.pas	(revision 9558)
+++ src/platform/utrash.pas	(working copy)
@@ -207,8 +207,11 @@
   // Get user home directory
   sHomeDir:= GetHomeDir;
   // Check if file in home directory
-  if (fpLStat(UTF8ToSys(sHomeDir), st1) >= 0)
+  // If it's a file, stat the parent directory instead for correct behavior on OverlayFS,
+  // it shouldn't make any difference in other cases
+  if (fpStat(UTF8ToSys(sHomeDir), st1) >= 0)
      and (fpLStat(UTF8ToSys(FileName), st2) >= 0)
+     and (fpS_ISDIR(st2.st_mode) or (fpStat(UTF8ToSys(ExtractFileDir(FileName)), st2) >= 0))
      and (st1.st_dev = st2.st_dev) then
   begin
     // Get trash directory in $XDG_DATA_HOME
trash.patch (780 bytes)   
Fixed in Revision9794
Operating systemLinux
WidgetsetGTK2
Architecture64-bit

Activities

Alexx2000

2020-09-23 08:32

administrator   ~0003498

I cannot reproduce. Where you are create and delete files? Which directory?

noname00

2020-09-24 13:30

reporter   ~0003500

In the home directory or its subdirectory.

noname00

2020-10-12 12:46

reporter   ~0003509

The problem was that I was doing it on OverlayFS. Many live Linux images use it these days, so it's a pretty common use case.
I found that Gnome had the same issue before:
https://bugzilla.gnome.org/show_bug.cgi?id=748248
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/182/diffs
With the attached patch it works correctly. Changing fpLStat to fpStat for sHomeDir isn't directly related to this issue, but it looks like it should be fpStat.
The issue with trashing is the only one I've noticed so far, but I suspect that FindMountPointPath may need a similar fix if it's called with file names instead of directory names from somewhere.

noname02

2020-12-12 17:56

reporter   ~0003649

What now, any feedback on the patch? I guess I should add the steps to reproduce it in an installed system.

# Mount OverlayFS
mkdir lower upper work overlay
sudo mount -t overlay -o rw,lowerdir=./lower,upperdir=./upper,workdir=./work dc-test-overlay ./overlay
# Create a user with the home directory on OverlayFS
sudo adduser --home `pwd`/overlay/dc-test-home dc-test
# Create a file there
sudo -i -u dc-test touch test-file

Log in as the new user (dc-test), launch doublecmd, delete the file to trash.

Issue History

Date Modified Username Field Change
2020-09-18 16:11 noname00 New Issue
2020-09-23 08:32 Alexx2000 Note Added: 0003498
2020-09-23 08:32 Alexx2000 Assigned To => Alexx2000
2020-09-23 08:32 Alexx2000 Status new => feedback
2020-09-24 13:30 noname00 Note Added: 0003500
2020-09-24 13:30 noname00 Status feedback => assigned
2020-10-08 08:20 Alexx2000 Status assigned => acknowledged
2020-10-08 08:20 Alexx2000 Resolution open => unable to reproduce
2020-10-12 12:46 noname00 File Added: trash.patch
2020-10-12 12:46 noname00 Note Added: 0003509
2020-12-12 17:56 noname02 Note Added: 0003649
2021-01-11 10:52 Alexx2000 Target Version => 1.0.0
2021-05-24 15:09 Alexx2000 Fixed in Revision => 9794
2021-05-24 15:09 Alexx2000 Status acknowledged => resolved
2021-05-24 15:09 Alexx2000 Fixed in Version => 1.0.0
2021-05-24 15:09 Alexx2000 Resolution unable to reproduce => fixed