Program arguments

General questions regarding the usage of CodeLite
tankist02
CodeLite Veteran
Posts: 56
Joined: Thu Sep 22, 2011 11:29 pm
Genuine User: Yes
IDE Question: c++
Contact:

Program arguments

Post 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
tankist02
CodeLite Veteran
Posts: 56
Joined: Thu Sep 22, 2011 11:29 pm
Genuine User: Yes
IDE Question: c++
Contact:

Re: Program arguments

Post 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
tankist02
CodeLite Veteran
Posts: 56
Joined: Thu Sep 22, 2011 11:29 pm
Genuine User: Yes
IDE Question: c++
Contact:

Re: Program arguments

Post 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 $@)
User avatar
eranif
CodeLite Plugin
Posts: 6373
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Program arguments

Post by eranif »

Thanks, committed to the trunk
Eran
Make sure you have read the HOW TO POST thread
Post Reply