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

Bug#473019: debian-policy: clarification needed for "local" builtin exception for /bin/sh



On Thu, Mar 27, 2008 at 01:16:31PM -0700, Russ Allbery wrote:
> The intention when I originally wrote the text was to not allow declaring
> multiple variables with one local line, since at the time I was told that
> some shells didn't support this.
> 
> I think your first patch is therefore correct and intend to apply it
> unless someone tells me that my understanding of shellology is incorrect.

I observe that

a) POSIX specifies the behavior of 'export' and 'readonly'
b) Implementation of 'local' is often very similar to 'export' and 'readonly'
   and in the absence of a standardized 'local', it makes sense to
   specify a similar form.
c) 'export' and 'readonly' both take multiple variables as arguments,
   assignments, and the -p switch for printing
d) the Bourne-type shells in Debian support multiple arguments to 'local'
e) the Bourne-type shells in Debian (except for posh) support variable
   assignments with 'local'
f) some of the Bourne-type shells in Debian produce output (which is not
   necessarily useful) in response to 'local -p', and some produce an
   error
g) bash disallows use of 'local' outside of a shell function

I suggest that Policy be amended to require that

local a b c=delta e

scope variables a, b, c, and e as local, and assign the
string "delta" to the local c.



Reply to: