JeffHoogland / esudo

A graphical sudo tool written in python and elementary
Other
3 stars 2 forks source link

esudo --> folder-names with space #3

Open andybehre opened 8 years ago

andybehre commented 8 years ago

Hello Jeff,

I use on bodhi linux grive2 with grive tools. When I try to open the google-drive folder the following command is send to esudo: pcmanfm file:///home/marianne/Google Drive

This is getting trouble, because the esudo tries to open the folder "Google" which isn't found and afterwards esudo tries to open folder "Drive", with same effect...

please have a look on that issue :-)

Regards

Andreas

JeffHoogland commented 7 years ago

You should use a back slash for spaces in names like that. Google\ Drive

rbtylee commented 7 years ago

I believe closing this was premature:

The below commands work in a terminal

pcmanfm /home/bodhi/Google\ Drive
pcmanfm "/home/bodhi/Google Drive"

These fail in a terminal:

esudo pcmanfm /home/bodhi/Google\ Drive
esudo pcmanfm "/home/bodhi/Google Drive"

but

esudo

and pcmanfm /home/bodhi/Google\ Drive entered into the cmd entry fails.

and pcmanfm "/home/bodhi/Google Drive" entered into the cmd entry was failing but my last commit fixes it.

for reference:

sudo pcmanfm /home/bodhi/Google\ Drive
sudo pcmanfm "/home/bodhi/Google Drive"
gksudo pcmanfm /home/bodhi/Google\ Drive
gksudo pcmanfm "/home/bodhi/Google Drive"

All work.

You will note three things:

In light of the fact the third point is a rather serious flaw, I am proposing preprocessing the arguments before esudo even receives them. I created a new branch with said fix in it.

Now all cases:

esudo pcmanfm /home/bodhi/Google\ Drive
esudo pcmanfm "/home/bodhi/Google Drive"

are correctly handled.

So the question is would this break any existing or anticipated usage of esudo?

simotek commented 7 years ago

The definitive answer comes from here https://standards.freedesktop.org/desktop-entry-spec/latest/ar01s06.html

In short:

esudo pcmanfm /home/bodhi/Google\ Drive
esudo pcmanfm "/home/bodhi/Google Drive"

should both work and shouldn't cause issues because the " char should always be escaped as \"

rbtylee commented 7 years ago

For the record, in case of Bodhi linux and anyone else using them, the fix I propose above needs applied to all the launchers in esudo/esudo/usr/bin/. Also usr/bin/esudo-gksu is broken in Bodhi 4.x which lacks 'gksu-original' which I am presuming is the original gksu bin from the package gksu (in Debian distros) renamed. Probably an oversight in building the Distro. esudo-gksu is also broken in other ways. I have these fixed locally and will commit soon. Plan on rebuilding Bodhi's esudo deb file to somehow fix the missing 'gksu-original' file but it has turned out to not be as simple as I first thought. Details irrelevant here ...