Re: inconsistent treatment of backslash-bang

2008-07-20 Thread Paul Jarc
Lawrence D'Oliveiro <[EMAIL PROTECTED]> wrote:
> Chet Ramey wrote:
>> I already explained that bash follows csh as closely as possible
>> in its history expansion implementation.
>
> Well, it doesn't:

Sure it does: in your examples, bash tries history expansion in
exactly the same cases as tcsh.  Where they differ is in escape/quote
handling, since bash comes from the Bourne shell tradition, and tcsh
comes from the completely incompatible C shell tradition.  It's not at
all surprising that merging behaviors from these two disparate shells
would result in some rought edges.

> Either \ acts as an escape or it doesn't

You would like that to be true, as would lots of other people.  But
the current behavior is too well-entrenched to change now without
breaking lots of people's expectations, based on bash's past behavior.
It's not going to change.  You are free to patch your own copy of
bash, or use a different shell that aims for self-consistency over
historical consistency.


paul




Re: inconsistent treatment of backslash-bang

2008-07-20 Thread Lawrence D'Oliveiro
Paul Jarc wrote:

> Lawrence D'Oliveiro <[EMAIL PROTECTED]> wrote:
>>
>> Chet Ramey wrote:
>>
>>> I already explained that bash follows csh as closely as possible
>>> in its history expansion implementation.
>> 
>> Well, it doesn't:
> 
> Sure it does ...

I have shown that it doesn't.

> Where they differ is in escape/quote handling ...

Like I said, it doesn't.

>> Either \ acts as an escape or it doesn't
> 
> You would like that to be true, as would lots of other people.  But
> the current behavior is too well-entrenched to change now without
> breaking lots of people's expectations, based on bash's past behavior.

I would like to know of examples of such expectations. It's not going to
break any executable scripts, since it has already been pointed out to me
that history expansion doesn't happen in scripts.





Re: inconsistent treatment of backslash-bang

2008-07-20 Thread Paul Jarc
Lawrence D'Oliveiro <[EMAIL PROTECTED]> wrote:
> It's not going to break any executable scripts, since it has already
> been pointed out to me that history expansion doesn't happen in
> scripts.

History expansion doesn't happen in scripts *by default*, but it can
be enabled explicitly.


paul




Re: inconsistent treatment of backslash-bang

2008-07-20 Thread Lawrence D'Oliveiro
Chet Ramey wrote:

> csh allows backslash to act as an escape character
> (that is, it is removed) when it precedes ! in a double-quoted string.
> Bash doesn't ...

But if it doesn't, then why does bang not have its history-expansion
behaviour? Either it's acting as an escape or it isn't. Which is it supposed
to be?

> -- and Posix and historical sh behavior agree.  Plain and simple.

But you also said:

> I already explained that bash follows csh as closely as possible
> in its history expansion implementation.

So which is it? Is bash trying to follow csh behaviour "as closely as
possible", or not?





Re: setuid from shellscript isn't permanent

2008-07-20 Thread Aras Vaichas
Bob Proulx wrote:
> Mr Aras wrote:
>   
>> $ ./setuid_test_script.sh
>> mode of `/nfsroot/bin/busybox' changed to 4755 (rwsr-xr-x)
>> -rwsr-xr-x 1 root root 515956 2008-07-18 11:46 /nfsroot/bin/busybox
>>
>> $ ls /nfsroot/bin/busybox
>> -rwxr-xr-x 1 root root 515956 2008-07-18 11:45 /nfsroot/bin/busybox
>> 
>
> With only this information I would have to guess that even though you
> have a command that it doing the chmod one way that there must be
> another command that is changing it back.
>
> Try running with 'bash -x ./setuid_test_script.sh' in order to trace
> your script commands.  I expect to see that there is another one that
> you are not expecting that is running.
>   
Arg! You were right, there was a Busybox install script which I thought
was only creating symlinks, but it also re-installed Busybox and changed
the mode back to 0755. Silly me ...



__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__