arsenetar / send2trash

Python library to natively send files to Trash (or Recycle bin) on all platforms.
BSD 3-Clause "New" or "Revised" License
275 stars 44 forks source link

Failed to move files to trash in overlayfs #74

Open pjknkda opened 1 year ago

pjknkda commented 1 year ago

In overlayfs, directories always have st_dev from lower filesystem whereas files can have st_dev either from lower filesystem or upper filesystem. Due to this behavior, https://github.com/arsenetar/send2trash/blob/1.8.1b0/send2trash/plat_other.py#L178 always fails when the file's st_dev is from the upper filesystem. gio already tackled this issue, by avoiding comparison b/w file_dev and trash_dev, instead, it compares parent_dir(file).dev to trash_dev (ref: https://gitlab.gnome.org/GNOME/glib/-/blob/main/gio/glocalfile.c#L2019). I think send2trash also can adapt the same approach.

arsenetar commented 1 year ago

Thanks for the information on the gio approach likely that can be leveraged here as well, will look into that. The st_dev has been somewhat problematic in I believe more than one case.