bug-bash
[Top][All Lists]
Advanced

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

Re: 2.05 change - bug or feature?


From: Brian J. Fox
Subject: Re: 2.05 change - bug or feature?
Date: Tue, 30 Oct 2001 06:51:20 -0800

   Date: Tue, 30 Oct 2001 09:06:40 -0500
   From: Chet Ramey <address@hidden>

   > Create the following shell script:
   >     func() {
   >         echo $var
   >     }
   >     var=xxx func
   >             func
   >     var=yyy func
   > 
   > When run on bash 2.05, it produces
   > 
   >     xxx
   >     xxx
   >     yyy
   > 
   POSIX.2, section 3.9.5, says:

           When a function is executed, it shall have the syntax-error and
           variable-assignment properties described for special built-in
           utilities in the enumerated list at the beginning of 3.14.

   Section 3.14 says, in part:

           Variable assignments specified with special built-in utilities
           shall remain in effect after the built-in completes...


Oh boy.  It's my belief that this is one of those hacks that David
Korn snuck in there so that the Korn shell code wouldn't have to be
rewritten.  Can you imagine any script in the world depending on this
behaviour?

On the other hand, I can imagine people depending on the other
behaviour -- but Korn can now point at POSIX and say "It says we don't
have to do that!"

   Note that bash behaves this way only when in posix mode.

Damn, that's a tough call.  Is it time for a new mode, in which
reasonable (but different) POSIX behaviour is selected, but
unreasonable behaviour is not?

Maybe it's time for a POSIXCALLY_INCORRECT variable.

Brian
== The Difference Between Cultures: ==
    Einigkeit und Recht und Freiheit
    Liberte', E'galite', Fraternite'
    Sex, drugs and rock'n'roll



reply via email to

[Prev in Thread] Current Thread [Next in Thread]