Page 1 of 1

Program arguments

Posted: Sat Sep 24, 2011 2:30 am
by tankist02
As soon as I add an argument to a console program, codelite_xterm fails to run it.

Here is a simple test:

This works:
/usr/bin/codelite_xterm 'ls' '/bin/sh -f /usr/bin/codelite_exec ls'

but this doesn't
/usr/bin/codelite_xterm 'ls -al' '/bin/sh -f /usr/bin/codelite_exec ls -al'

It seems if there is a space in the codelite_xterm Title arg, it fails to run.

My CL is built from SVN sources as of today, version: 3.0.5074 on RedHat Linux 6.1 x86_64

Re: Program arguments

Posted: Sat Sep 24, 2011 3:23 am
by tankist02
More details:

if LD_LIBRARY_PATH is empty, then program arguments work (I added 'set -x' to codelite_xterm):

$ /usr/bin/codelite_xterm 'ls -al' '/bin/sh -f /usr/bin/codelite_exec ls -al'
+ '[' 2 -ne 2 ']'
+ program_title='ls -al'
+ '[' '' = '' ']'
+ xterm -T 'ls -al' -e /bin/sh -f /usr/bin/codelite_exec ls -al

But if LD_LIBRARY_PATH is not empty the script fails:

$ export LD_LIBRARY_PATH="ld_lib_path"
$ /usr/bin/codelite_xterm 'ls -al' '/bin/sh -f /usr/bin/codelite_exec ls -al'
+ '[' 2 -ne 2 ']'
+ program_title='ls -al'
+ '[' ld_lib_path = '' ']'
+ xterm -T 'ls -al' -e /bin/bash -c 'export LD_LIBRARY_PATH=$0;shift;$@' ld_lib_path ls -al /bin/sh -f /usr/bin/codelite_exec ls -al

Re: Program arguments

Posted: Sat Sep 24, 2011 3:59 am
by tankist02
It looks the issue is gone if the following line from codelite_xterm

xterm -T "$program_title" -e /bin/bash -c 'export LD_LIBRARY_PATH=$0;shift;$@' $LD_LIBRARY_PATH $@ 2> /dev/null

is changed to

xterm -T "$program_title" -e /bin/bash -c 'export LD_LIBRARY_PATH=$0;shift;$@' $LD_LIBRARY_PATH "$@" 2> /dev/null

(note double-quotes around arguments list $@)

Re: Program arguments

Posted: Sat Sep 24, 2011 8:11 am
by eranif
Thanks, committed to the trunk
Eran