8000 trash-empty: Cannot remove file · Issue #364 · andreafrancia/trash-cli · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

trash-empty: Cannot remove file #364

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

Open
bramblebird-ux opened this issue Feb 17, 2025 · 3 comments
Open

trash-empty: Cannot remove file #364

bramblebird-ux opened this issue Feb 17, 2025 · 3 comments

Comments

@bramblebird-ux
Copy link

Describe the bug
When trash-put is used to trash a folder that contains other folders without write permissions, a subsequent trash-empty command will fail

trash-cli version
0.24.5.26

Are you using the latest version of trash-cli?
Yes

Have you tried if the bug is present in the latest version of trash-cli?
Yes

Operating system:

  • OS: Arch

To Reproduce
Copy and paste the commands (and their output) to execute in order to reproduce
the behavior:

$ mkdir -p myfolder/testfolder
$ chmod -w myfolder/testfolder
$ trash-put myfolder
$ trash-empty -f
trash-empty: cannot remove /home/$USER/.local/share/Trash/files/myfolder

Expected behavior
Files in the trash should be forcibley overwritten or trash-empty should ask for confirmation before overwritng them

Currently I have to go into the trash directory and run chmod -R +w myfolder before I can empty the trash. This should be automated

Note that this bug was discovered by deleting the "go" directory that contains the dependent modules that are downloaded during the build process of go applications. The contained module folders do not have write permissions by default.

@AndrewDDavis
Copy link
Contributor

I'm unable to reproduce the problem using your toy example, although we're using the same version of trash-cli. Could it be an issue with the permissions of the Trash folder? For me, ~/.local/share/Trash and its subfolders have drwx------ permissions, and the owner and group are me.

@bramblebird-ux
Copy link
Author

The Permissions for my Trash folder are as follows:

/usr/bin/ls -la ~/.local/share/Trash
total 32
drwx------  4 myuser myuser  4096 Oct 30 18:31 .
drwxrwx--- 14 myuser myuser  4096 Mar  5 21:13 ..
drwxrwx--- 12 myuser myuser  4096 Mar  5 22:58 files
drwx------  2 myuser myuser 20480 Mar  5 22:58 in
7D5F
fo

@bramblebird-ux
Copy link
Author

I wrote a script that reproduces the bug:

#!/bin/sh

mkdir /tmp/trash-cli-test
mkdir /tmp/trash-cli-test/myfolder
touch /tmp/trash-cli-test/myfolder/a
chmod ugo-w /tmp/trash-cli-test/myfolder
trash-put /tmp/trash-cli-test
trash-empty -f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0