darktable-org / lua-scripts

148 stars 108 forks source link

sanitization causes external_command calls to fail on linux/posix #481

Closed UweOhse closed 3 weeks ago

UweOhse commented 3 weeks ago

Hi,

i tried two of the scripts in this repo, RL_out_sharp (too unpredictable results for me) and gimp, with the following results on stderr:

`sh: 1: '/usr/bin/gmic' '/tmp/P1000588.jpg' -deblur_richardsonlucy 0.40,10,1 cut 0,255 round o 
  '/home/uwe/Bilder/P1000588.jpg',100: not found`
(on one line, line broken for readabilty)

or

 `sh: 1: '/usr/bin/gimp' '/tmp/P1000588.jpg'  &: not found`

In the gimp case this call to the shell was done:

execve("/bin/sh", ["sh", "-c", "''\\''/usr/bin/gimp'\\'' '\\''/tmp/P1011692.jpg'\\''  &'"], [junk left out]

where the shell then tried to execute this:

execve("'/usr/bin/gimp' '/tmp/P1000588.jpg'  &", [junk left out]

That's one layer of quoting/sanitization too much.

In the later case the only -d lua output was:

  `39.2084 LUA '/usr/bin/gimp' '/tmp/P1000588.jpg'  &`

That happened with a current darktable master, and current lua-scripts master version.

I seem to remember that i had seen some problem like that a year or two ago, too, so maybe it isn't new.

Regards, Uwe

wpferguson commented 3 weeks ago

Bisecting is much faster when you don't have to compile between steps :smiley:

Found it. I guess I should check that we are on windows before I sanitize for windows.