Path: csiph.com!fu-berlin.de!usenet.stanford.edu!not-for-mail From: Eli Schwartz Newsgroups: gnu.bash.bug Subject: Re: Bug Report concerning backslash in bash5 Date: Tue, 28 Jul 2020 22:41:52 -0400 Lines: 96 Approved: bug-bash@gnu.org Message-ID: References: <87ft9azxwb.fsf@hobgoblin.ariadne.com> <4099319f-bc5e-a2ef-cfe8-6189df5a44b6@archlinux.org> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="of5rw64RZnc7V9q73tnvrB1XH4Sd3tnQy" X-Trace: usenet.stanford.edu 1595990546 17175 209.51.188.17 (29 Jul 2020 02:42:26 GMT) X-Complaints-To: action@cs.stanford.edu To: bug-bash@gnu.org Envelope-to: bug-bash@gnu.org X-Spam-BL-Results: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=archlinux.org; s=orion; t=1595990527; bh=BwPX0hY5Krs4lx+5DXKdIawgjrgL1rOMxpmCE6m1IBs=; h=Subject:To:References:From:Date:In-Reply-To; b=IpT/mP3KSBKT6ECLdQ4dd6dm8emjkbhp83lHs8vfLvKdePcqogbIljAMnTscldnUk +pczfvMxtrXCSxW8lub2nbnMohG4YLe2Wwsml2hQZAM5F9auX97YZS64QEjgN50ACg ukhEx4vZcD5DAPQCjgnqZyvfaBCWWpKbhuQ9hnOJD8/WQW/bw+07grJHslTypC0W/O 4yaZLB7dDh3kNaBM8DrKtQgrHi8k+3l9IVElBdDwqRUwALh1a78fM/b8yqPgJiTtOp WVraRcX6Cui9Kv6MPeY6G3gjqGvldSyfVg3voC/IxPMf6thHsYPc4SoyllS3TzQVFK P2x+c6hOrEuxEwH3RI1UcqIhnaVjN/H4vZ6F14GUP4HKbr7OGr1Vd3XJhxqZaZ01GX 84lQVwPZZ5xc1CqDJCcG0fbl8e199luJVCsfq42osfn94oOyTyxQrRrgvi7by4ZixP Q7dIYQnttsFWbG02GDgUGx2M+a5fgeZYnMBLRSrTn52PEajjKULGdclJlvwRTyHHn/ dx/fQCIOqTEeVFgFay3VqTi4AHMWDLquVQti7qxoTZ4tO1dJ7VPoDzqOr0Gf/SIPPM fvNCLqqaqCcmd9yowk5vszi7sUNHYZ6XVjIb9q0qctn05NxW2WKvEmgh5UzCtawl1W epMu5lvHPNsgks5l97F/vBj4= X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 In-Reply-To: <87ft9azxwb.fsf@hobgoblin.ariadne.com> Received-SPF: pass client-ip=2a01:4f8:160:6087::1; envelope-from=eschwartz@archlinux.org; helo=orion.archlinux.org X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -53 X-Spam_score: -5.4 X-Spam_bar: ----- X-Spam_report: (-5.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=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: <4099319f-bc5e-a2ef-cfe8-6189df5a44b6@archlinux.org> X-Mailman-Original-References: <87ft9azxwb.fsf@hobgoblin.ariadne.com> Xref: csiph.com gnu.bash.bug:16644 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --of5rw64RZnc7V9q73tnvrB1XH4Sd3tnQy Content-Type: multipart/mixed; boundary="pVMiwRlXdkpWUhf85zjEjc8TydGcYbmPd" --pVMiwRlXdkpWUhf85zjEjc8TydGcYbmPd Content-Type: text/plain; charset=utf-8 Content-Language: en-US-large Content-Transfer-Encoding: quoted-printable On 7/29/20 1:35 AM, Dale R. Worley wrote: > Ralph Beckmann writes: >> I found this misbehaviour in Bash 5 (e.g. GNU bash, version=20 >> 5.0.16(1)-release (x86_64-pc-linux-gnu)): >> >> $ BLA=3D"1\.2"; echo 'x/'$BLA'/y/' >> \x/1\.2/\y/ >> >> I don't see any reasonable reason for the generated backslashes here. >=20 > My guess is that you're running into the fact that there are two types > of quoting character. One quotes *any* character that follows it, and > thus it never appears in "the output" unless it was doubled in the > input. The other type *only* quotes characters that are somewhow > special in that particular context. Reading the manual page: >=20 > Enclosing characters in double quotes preserves the literal v= alue of > all characters within the quotes, with the exception of $, `, \= , and, > when history expansion is enabled, !. The characters $ and `= retain > their special meaning within double quotes. The backslash retai= ns its > special meaning only when followed by one of the following char= acters: > $, `, ", \, or . >=20 > So backslash-inside-double-quotes-in-bash is of the second type, it onl= y > quotes things that would otherwise be special. So the value of $BLA is= > 1-\-.-2, whereas if the period was replaced by $, $BLA would only have = 3 > characters: >=20 > $ BLA=3D"1\$2"; echo 'x/'$BLA'/y/' > x/1$2/y/ >=20 I'm not sure what point you're trying to make here. Are you arguing that *printing* these backslash escapes is valid behavior here, and the reporter has merely misunderstood the shell rules? --=20 Eli Schwartz Arch Linux Bug Wrangler and Trusted User --pVMiwRlXdkpWUhf85zjEjc8TydGcYbmPd-- --of5rw64RZnc7V9q73tnvrB1XH4Sd3tnQy Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEvSewel70XCra9w4EhIGKaBmvSpsFAl8g4fEACgkQhIGKaBmv SpteOhAA0AKzx5Q0N3aDRL60NQ88XhqDz9OWzw9E5hUJPyr3veyA9HJxJZzNO1jq uZpe4qOTH+MW5BrFNpHSCREdONE6+QTu4rsv+Tz13P08v08eLBRnere9ePSw0eh3 vagj13XqfOwarn0pVvNGlm7afu0X3R28GlxliS3w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