Path: csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail From: =?utf-8?Q?Lawrence_Vel=C3=A1zquez?= Newsgroups: gnu.bash.bug Subject: Re: No word splitting for assignment-like expressions in compound assignment Date: Mon, 27 Jul 2020 03:06:22 -0400 Lines: 60 Approved: bug-bash@gnu.org Message-ID: References: <87o8o1zfpn.fsf@hobgoblin.ariadne.com> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.14\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: usenet.stanford.edu 1595833590 4483 209.51.188.17 (27 Jul 2020 07:06:30 GMT) X-Complaints-To: action@cs.stanford.edu Cc: Alexey Izbyshev , bug-bash@gnu.org To: "Dale R. Worley" Envelope-to: bug-bash@gnu.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=larryv.me; h= content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; s=fm1; bh=Z j9dxnzAV9+Re/CxCr2VTrqk4wt5qhgsvq+hOwxnXaU=; b=RKf2Adwj1lZW9ulKL uhJlXHsR65W69erXlix1/vWWhUL1GttifwX5RT1O19BN0qmt4chJCxnHCF6bAxBM MNuGEa3cCPXH+Hwo0UvdU/qUD8cdJXZ7BhTQCMJWvPmRtRq28ZiE1Q/ntAGjPlRR McPpfwEYMuWcH03iXV0yhMGA3+1HqVFTAVUMxtHIitNtlxrhavxAVVBetnO+RKgo Nh1LPZPoHw0NMpvRZvFI6cAlcGZ8R9OaAAKCiwmepWe5XSiNu5lH3U03Cl82C4I2 PNkGDS09l4HOtbtZ9YP/tyqB3l9GWZoOtd3CAmVo2cLwbudZROAjt5TyxJUlVCus 8U8BQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=Zj9dxnzAV9+Re/CxCr2VTrqk4wt5qhgsvq+hOwxnX aU=; b=ki6VLOBmqKbgew3OdZyE9e8WrO9VDsb6yDZvXIscsCaoY4kMZK2Hgl74W iAKBw3m//GCPg7oNiGw7Z51WEAlE5L/NH2IfCOsR3h/cItSuv2uvhI2tbKUky229 iy/AVV95y4MF0LcKs/bLkCtCV+6QVyMVtowhw1vec3aUy6jviR4Sm947kPi45r7r z0p5Oo0bdR/IP+Ut81XSx3louxNdfZn0dKqUQUiaGgpcqleTbd3CFAx+rrkITpE2 DE9BDfQWQZPR+crHEtKxeeqyEOxv891+9ayP8kpqVf/q1f5faUWEMv1VlAnmemMU chhQ2TVyBRLgK/C2MMdXpJtqnjXKA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrheelgdeivdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpegtggfuhfgjfffgkfhfvffosehtqhhmtdhhtddvnecuhfhrohhmpefnrgifrhgv nhgtvggpgggvlhojiihquhgviicuoehvqheslhgrrhhrhihvrdhmvgeqnecuggftrfgrth htvghrnhepgeetheejueekgeffhefhjeevjeeiheegvdeugeektdegffejhfehgeetgfej ledvnecukfhppedutddtrdduvddrudejkedrvdefnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepvhhqsehlrghrrhihvhdrmhgv X-ME-Proxy: In-Reply-To: <87o8o1zfpn.fsf@hobgoblin.ariadne.com> X-Mailer: Apple Mail (2.3445.104.14) Received-SPF: pass client-ip=66.111.4.25; envelope-from=vq@larryv.me; helo=out1-smtp.messagingengine.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/27 03:06:24 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: <87o8o1zfpn.fsf@hobgoblin.ariadne.com> Xref: csiph.com gnu.bash.bug:16620 > On Jul 27, 2020, at 1:31 AM, Dale R. Worley = wrote: >=20 > Alexey Izbyshev writes: >> I have a question about the following behavior: >>=20 >> $ Z=3D'a b' >> $ A=3D(X=3D$Z) >> $ declare -p A >> declare -a A=3D([0]=3D"X=3Da b") >> $ A=3D(X$Z) >> $ declare -p A >> declare -a A=3D([0]=3D"Xa" [1]=3D"b") >>=20 >> I find it surprising that no word splitting is performed in the first=20= >> compound assignment. >=20 >> * Brace expansion is performed for "A=3D(X=3Da{x,y}b)" by all bash = versions=20 >> mentioned above (which is inconsistent with normal variable = assignment). >> * Globbing for "A=3D(X=3Da?b)" is performed by bash 3.1.17, but not = by other=20 >> versions. >=20 > Interesting. The documentation for 4.2.53(1) says this about = parameter > assignments generally, with no special rules for compound assignments: >=20 > 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. >=20 > So it seems like the word splitting in "A=3D(X$Z)" is incorrect. So = is > pathname expansion in that context. If word splitting were not performed in compound assignments, this... foo=3D(a b c) ...would not work. If pathname expansion were not performed in compound assignments, this... foo=3D(*) ...would not work. Arrays would become significantly less usable if word splitting and pathname expansion were not allowed in compound assignments. vq=