Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #16621

Re: No word splitting for assignment-like expressions in compound assignment

Path csiph.com!goblin2!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail
From Alexey Izbyshev <izbyshev@ispras.ru>
Newsgroups gnu.bash.bug
Subject Re: No word splitting for assignment-like expressions in compound assignment
Date Mon, 27 Jul 2020 10:25:07 +0300
Lines 43
Approved bug-bash@gnu.org
Message-ID <mailman.130.1595834719.2739.bug-bash@gnu.org> (permalink)
References <87o8o1zfpn.fsf@hobgoblin.ariadne.com> <F420E583-E5D4-48BB-98E3-044C700BA07A@larryv.me> <e64878396a22641351ff3b910fdc99d8@ispras.ru>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 8bit
X-Trace usenet.stanford.edu 1595834719 4976 209.51.188.17 (27 Jul 2020 07:25:19 GMT)
X-Complaints-To action@cs.stanford.edu
Cc "Dale R. Worley" <worley@alum.mit.edu>, bug-bash@gnu.org
To Lawrence Velázquez <vq@larryv.me>
Envelope-to bug-bash@gnu.org
In-Reply-To <F420E583-E5D4-48BB-98E3-044C700BA07A@larryv.me>
User-Agent Roundcube Webmail/1.4.4
X-Sender izbyshev@ispras.ru
Received-SPF pass client-ip=83.149.199.84; envelope-from=izbyshev@ispras.ru; helo=mail.ispras.ru
X-detected-operating-system by eggs.gnu.org: First seen = 2020/07/27 03:25:08
X-ACL-Warn Detected OS = Linux 3.11 and newer
X-Spam_score_int -18
X-Spam_score -1.9
X-Spam_bar -
X-Spam_report (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action no action
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.23
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <https://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
X-Mailman-Original-Message-ID <e64878396a22641351ff3b910fdc99d8@ispras.ru>
X-Mailman-Original-References <87o8o1zfpn.fsf@hobgoblin.ariadne.com> <F420E583-E5D4-48BB-98E3-044C700BA07A@larryv.me>
Xref csiph.com gnu.bash.bug:16621

Show key headers only | View raw


On 2020-07-27 10:06, Lawrence Velázquez wrote:
>> On Jul 27, 2020, at 1:31 AM, Dale R. Worley <worley@alum.mit.edu> 
>> wrote:
>> Interesting.  The documentation for 4.2.53(1) says this about 
>> parameter
>> assignments generally, with no special rules for compound assignments:
>> 
>>       All
>>       values undergo tilde expansion, parameter and variable 
>> expansion,  com-
>>       mand  substitution, arithmetic expansion, and quote removal (see 
>> EXPAN-
>>       SION below).  ...  Word  splitting  is  not
>>       performed,  with the exception of "$@" as explained below under 
>> Special
>>       Parameters.  Pathname expansion is not  performed.
>> 
>> So it seems like the word splitting in "A=(X$Z)" is incorrect.  So is
>> pathname expansion in that context.
> 
> 
> If word splitting were not performed in compound assignments, this...
> 
>     foo=(a b c)
> 
> ...would not work. If pathname expansion were not performed in compound
> assignments, this...
> 
>     foo=(*)
> 
> ...would not work. Arrays would become significantly less usable if
> word splitting and pathname expansion were not allowed in compound
> assignments.
> 
To be clear, I don't consider word splitting and expansions in compound 
assignments to be a problem: this is well-known and long-standing 
behavior, even though it doesn't seem to be explicitly documented. In 
particular, I expect word splitting to happen in "A=(X$Z)" case. But I 
expect it to happen in "A=(X=$Z)" too, and the lack of it seems 
unintentional to me.

Alexey

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: No word splitting for assignment-like expressions in compound assignment Alexey Izbyshev <izbyshev@ispras.ru> - 2020-07-27 10:25 +0300

csiph-web