[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [E-devel] Ecore_exe and shell metacharachters

On Wed, 05 Apr 2006 12:24:37 -0400 Mike Russo <miker@readq.com> babbled:

> Ecore_exe will try to avoid using "sh -c" to execute a program if it 
> can.  If the command line contains shell meta characters (defined as any 
> combination of |&;<>$'\"'*?#) it will use the user's shell to execute 
> the command, otherwise it will execute it directly.

well that depends on flags. you can add to the exec flags ECORE_EXE_USE_SH (its
a bitmask - so just or it in) and then it will use /bin/sh regardless

> Unfortunately this causes a problem if the user's shell is csh/tcsh and 
> the command line contains a ? character. I noticed this problem because 
> dEvian's RSS face uses ecore_exe in order to launch a web browser with 
> the URL as the command line argument, and if the URL contains a ? 
> ecore_exe will try to use tcsh to execute it, and this will only work if 
> the ? is escaped with a \.  Not even including the command line between 
> single quotes

hmm - actually this IMHO is a devian bug. since you pass the command as a whole
string - it *IS* of the same format you would type in at a shell command
prompt. how do you know if the command contains a space or not, or is that
space the delimiter between command and parameters? spaced in
filenames/parameters passed to the command? you need to escape it - just like
any special meta chars. really it might be best that ecore provides an escaper
for you to BUILD the command, but it needs escaping before it goes to be exec'd

> Not really sure what the best way to fix this would be though. The 
> simple solution of enclosing the command line in single quotes does not 
> work.  I think if the command line is parsed and all meta characters are 
> escaped it will work with any shell, but I'm too lazy to implement that. 
> :(  Just wanted to report it, I'll probably change my shell or edit 
> ecore_exe.c to use /bin/sh instead of my shell to work around it until 
> someone less lazy then myself can fix it. :)

see above - there *IS* a flag u can pass - and devian should be escaping - just
like you have to escape when u type it...

> -- 
> Mike Russo
> ReadQ Systems, Inc.
> (212) 425 3680 x105
> Random quote of the last-time-I-ran-bash:
> <rac> jstubbs: perl is garbage collected. however, circular references 
>  will confuse it
> <rac> jstubbs: so if you have circular references, you have to break the 
>  circularity manually
> <jstubbs> rac: so if references aren't being used and everything is 
>  defined using "my" within a function that gets called from a loop, is it 
>  normal for it to continuously eat memory?
> <rac> jstubbs: why do i feel like if i say "no", i'm going to get a bug 
>  filed on my head? :)
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking scripting language
> that extends applications into web and mobile media. Attend the live webcast
> and join the prime developer group breaking into this new coding territory!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
> _______________________________________________
> enlightenment-devel mailing list
> enlightenment-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

------------- Codito, ergo sum - "I code, therefore I am" --------------
The Rasterman (Carsten Haitzler)    raster@rasterman.com
Tokyo, Japan (東京 日本)