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


Groups > gnu.bash.bug > #16644

Re: Bug Report concerning backslash in bash5

Path csiph.com!fu-berlin.de!usenet.stanford.edu!not-for-mail
From Eli Schwartz <eschwartz@archlinux.org>
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 <mailman.230.1595990545.2739.bug-bash@gnu.org> (permalink)
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 <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 <4099319f-bc5e-a2ef-cfe8-6189df5a44b6@archlinux.org>
X-Mailman-Original-References <87ft9azxwb.fsf@hobgoblin.ariadne.com>
Xref csiph.com gnu.bash.bug:16644

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

On 7/29/20 1:35 AM, Dale R. Worley wrote:
> Ralph Beckmann <rb@rbx.de> writes:
>> I found this misbehaviour in Bash 5 (e.g. GNU bash, version 
>> 5.0.16(1)-release (x86_64-pc-linux-gnu)):
>>
>> $ BLA="1\.2"; echo 'x/'$BLA'/y/'
>> \x/1\.2/\y/
>>
>> I don't see any reasonable reason for the generated backslashes here.
> 
> 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:
> 
>        Enclosing  characters  in  double quotes preserves the literal value 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 retains  its
>        special  meaning only when followed by one of the following characters:
>        $, `, ", \, or <newline>.
> 
> So backslash-inside-double-quotes-in-bash is of the second type, it only
> 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:
> 
>     $ BLA="1\$2"; echo 'x/'$BLA'/y/'
>     x/1$2/y/
> 

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?

-- 
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User

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


Thread

Re: Bug Report concerning backslash in bash5 Eli Schwartz <eschwartz@archlinux.org> - 2020-07-28 22:41 -0400

csiph-web