Failed bash -r command returns 0 exit status

2010-05-24 Thread Pitt, David
From: david.p...@anz.com To: bug-bash@gnu.org Subject: Failed bash -r command returns 0 exit status Configuration Information [Automatically generated, do not change]: Machine: sparc OS: solaris2.10 Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='sparc' -DCONF_OSTYPE='solaris2

Re: Failed bash -r command returns 0 exit status

2010-05-24 Thread Dave Rutherford
On Mon, May 24, 2010 at 02:48, Pitt, David wrote: >        However executing "/bin/ls && /bin/ls" under a restricted shell > returns a zero exit >        status. This is not expected (at least not by me!). Zero exit > status is returned with >        any list of commands, e.g. "/bin/ls && :". Tha

Re: Failed bash -r command returns 0 exit status

2010-05-24 Thread Greg Wooledge
On Mon, May 24, 2010 at 04:25:48AM -0400, Dave Rutherford wrote: > On Mon, May 24, 2010 at 02:48, Pitt, David wrote: > >        status. This is not expected (at least not by me!). Zero exit > > status is returned with > >        any list of commands, e.g. "/bin/ls && :". > > That one would, since

Re: Failed bash -r command returns 0 exit status

2010-05-24 Thread Dave Rutherford
On Mon, May 24, 2010 at 08:32, Greg Wooledge wrote: > On Mon, May 24, 2010 at 04:25:48AM -0400, Dave Rutherford wrote: >> On Mon, May 24, 2010 at 02:48, Pitt, David wrote: >> >        status. This is not expected (at least not by me!). Zero exit >> > status is returned with >> >        any list o

Re: Failed bash -r command returns 0 exit status

2010-05-24 Thread Chet Ramey
On 5/24/10 2:48 AM, Pitt, David wrote: > Bash Version: 4.1 > Patch Level: 0 > Release Status: release > > Description: > Prohibited restricted shell command doesn't always return > non-zero exit > status. > > Executing "/bin/ls" under a restricted shell returns a non-zero

Re: How not to expand a environment variable when doing command completion?

2010-05-24 Thread Eric Blake
On 05/22/2010 02:48 PM, Peng Yu wrote: > When I type 'cd $HOME/.', bash will expand the command to 'cd > /home/my_user_name/.'. Would you please let me know how to let bash > expand the environment variable? I assume you meant "to let bash NOT expand the environment variable"? At any rate, you sho

Error Handling with bash script

2010-05-24 Thread Lenga, Yair
Hi, I would like to propose an improvement to the bash error handling: Add flag/option "err_return", that will cause a user defined shell functions to immediately return, when a simple command will return a non-zero status code. The behavior is similar to the existing '-e', but is different in

Re: How not to expand a environment variable when doing command completion?

2010-05-24 Thread Peng Yu
On Sat, May 22, 2010 at 3:48 PM, Peng Yu wrote: > When I type 'cd $HOME/.', bash will expand the command to 'cd > /home/my_user_name/.'. Would you please let me know how to let bash > expand the environment variable? I mean 'NOT to let bash ...'. Also, I forget to mention that /etc/bash-completio

Re: How not to expand a environment variable when doing command completion?

2010-05-24 Thread Peng Yu
> I also tried 'python $SOME_VARIABLE/', where $SOME_VARIABLE is > set to a directory. Wired enough, this time $SOME_VARIABLE is not > expanded at all, neither any completion to any files under the > directory $SOME_VARIABLE. I was confused. The above statement is not true. -- Regards, Peng

RE: Failed bash -r command returns 0 exit status

2010-05-24 Thread Pitt, David
Hi Dave, > As for "/bin/ls && /bin/ls", since neither command runs neither one fails, > either. 'Tis a bit of a head-scratcher, though. Failure to run can in no way be construed as success, as is shown by: $ bash --restricted -c "/bin/ls"; echo $? bash: /bin/ls: restricted: cannot specify `/'

RE: Failed bash -r command returns 0 exit status

2010-05-24 Thread Pitt, David
Thanks Chet! David Pitt | Developer/Designer TI SD Risk Systems | Technology Solution Delivery | OTSS >Level 3 Core A 833 Bourke Street Docklands VIC 3008 >Australia and New Zealand Banking Group Ltd | www.anz.com > -Original Message- From: Chet Ramey [mailto:chet.ra...@case.edu] Sent:

Error Handling with bash script

2010-05-24 Thread Lenga, Yair
Hi, I would like to propose an improvement to the bash error handling: Add flag/option "err_return", that will cause a user defined shell functions to immediately return, when a simple command will return a non-zero status code. The behavior is similar to the existing '-e', but is different in