Re: [RFC] shell: local x=$1 may need to quote the RHS

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

 



Konstantin Khomoutov <kostix@xxxxxxxx> writes:

> Sorry, I might have not followed the entire thread, but assignment in
> `local` is a bashism, and dash can only handle the declaration part with
> `local`, not assignment; hence the safe code should read
>
>   local x
>   x="$1"

Interesting.  As "local" is not in POSIX but we still use it for
convenience, we must limit our use to a reasonable subset of
features common to the shells we care about.  Knowing what each
shell can and cannot do safely is essential to us.

The patch posted seemed to run fine with a more recent dash than
what I had trouble with (0.5.10 would work fine with "$1" quoted,
0.5.11 would work fine without $1, just like the RHS of a regular
assignment).  In addition, there are many existing tests that
already use "local var=initial-value" (the message you are
responding to has an output from "grep") and we haven't got problem
reports from dash users about them.

The manual page for recent dash may need an update.
Can you perhaps file a bug on their documentation?

Thanks.



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux