Skip to content
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

Update Action.py #871

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Update Action.py #871

wants to merge 1 commit into from

Conversation

adam083b
Copy link

Splitting cmd arguments didn't work as expected, I suggest using the shlex module as more appropriate.

Splitting cmd arguments didn't work as expected, I suggest using the shlex module as more appropriate.
@az0
Copy link
Member

az0 commented Apr 19, 2020

Would you please add a unit test to demonstrate the condition in which this is needed?

@adam083b
Copy link
Author

Hello,

It's just to parse correctly spaces and other special character.
Let me describe my case which led me to make the proposal.

See below my custom_home cleaner:
custom.xml.zip

If you use args = self.cmd.split(' ') the cmd="rm $HOME/.config/ReText\ project/ReText.conf" will not be parsed correctly and will ignore the space character of the folder.

If you run bleachbit -c custom.clear_retext_configuration you will get the following output
Command: rm /home/echo/.config/ReText\ project/ReText.conf
Return code: 1
Stdout:
Stderr: rm: cannot remove '/home/echo/.config/ReText': No such file or directory
rm: cannot remove 'project/ReText.conf': No such file or directory

But with shlex the space character is correctly interpreted:
Run external command: rm /home/echo/.config/ReText\ project/ReText.conf 0
Disk space recovered: 0
Files deleted: 0
Special operations: 1

Thanks

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

Successfully merging this pull request may close these issues.

None yet

2 participants