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


Groups > gnu.bash.bug > #15725

Re: Not missing, but very hard to see (was Re: Backslash missing in brace expansion)

Path csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail
From Eli Schwartz <eschwartz@archlinux.org>
Newsgroups gnu.bash.bug
Subject Re: Not missing, but very hard to see (was Re: Backslash missing in brace expansion)
Date Thu, 12 Dec 2019 22:03:33 -0500
Lines 124
Approved bug-bash@gnu.org
Message-ID <mailman.767.1576206236.1979.bug-bash@gnu.org> (permalink)
References <20191205201157.cd481936f76d95bbdfabc73c@schrader-schulte.de> <662e2328-f331-c554-afcf-fd3819f6beab@case.edu> <20191206055304.076d6115afa3a4f2a6a21c34@schrader-schulte.de> <5b5064a8-7175-42e7-1eb5-6374dee6c11e@redhat.com> <21761e28-c496-ff67-d7b7-628c9325085f@iki.fi> <9dd3a388-39b1-c059-de99-813f1e411764@case.edu> <5DF2987E.5000309@tlinx.org> <568aeaaa-22b3-c7b9-0e18-a92bef6d2ffb@iki.fi> <5DF2FE31.9070406@tlinx.org> <0ff3a920-94c2-b0c9-5631-0964955657aa@archlinux.org>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="BU2brVJBXyQ4x42oyhlJEcEoLzLjCAKCK"
X-Trace usenet.stanford.edu 1576206236 13208 209.51.188.17 (13 Dec 2019 03:03:56 GMT)
X-Complaints-To action@cs.stanford.edu
To bug-bash@gnu.org
Envelope-to bug-bash@gnu.org
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/simple; d=archlinux.org; s=orion; t=1576206218; bh=WLXUmfEZcCG8m4/PRkE6OFBUAlf6O3OjHMULao4ZoXc=; h=Subject:To:References:From:Date:In-Reply-To; b=fOI2NUpDdoR/4Mr6NFheolwTIg7pepeuyjiIDs82m1vSCxmW8t4vg6uSW6hi6SAfy 32w80wi5O5Xe6Dup8PST+KU88h7qAJ3YKVVqFIrdyLVzTFTxlH0kGopHN7v507G7Se AaBCuw6yGmdZ0X5urhbl35or5PWNpeeem7JJuKcUU6VTpRfVdoT+L2mowlTuC+jiFi DJhiAkPLiqboGqL+KCb2S91Y88TKo86xI9kfPfBCmqYA2sEzMksNz5MMeektSHDHro lxwMo/qAPhPBn8IGEvZR26AZHJy5N+rMBfg8doGR88Hi+e/E1dMe0vjst7z22UupFS jjbQ4zAHu3JqF0jiqhrCGaM7U96//8jJACB8wP6r6OrR4O+kzz2aVsWTgq6U7QURkq UInvJY1ZaYNmvFf4yHb2KZyfbLxXGoNE4ZxIbIYGpo2FCUfM9nWlI2Ag6ENrNjjY9z FE07ytKPmso+EfSxA3Y7+5TLFQjGfQhHGnMkcAe4DB+tkfyeh4RFpRd8hW0B4S8l9J 85OCrgKrXyf09F1fc14kDzIsoTk7WY0N/+g6T7mL/QMmQIh0M7NIZX5nu0IXzTncRW mk3veZqwFOISog0P30DRmhJBi8IPFDTVPe5APesG1gF3/IHXrwarr7bwST3MYtIj/2 XK/8RGNju6CwiIukI421uyCI=
X-Clacks-Overhead GNU Terry Pratchett
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.0
In-Reply-To <5DF2FE31.9070406@tlinx.org>
X-detected-operating-system by eggs.gnu.org: Genre and OS details not recognized.
X-Received-From 2a01:4f8:160:6087::1
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 <0ff3a920-94c2-b0c9-5631-0964955657aa@archlinux.org>
X-Mailman-Original-References <20191205201157.cd481936f76d95bbdfabc73c@schrader-schulte.de> <662e2328-f331-c554-afcf-fd3819f6beab@case.edu> <20191206055304.076d6115afa3a4f2a6a21c34@schrader-schulte.de> <5b5064a8-7175-42e7-1eb5-6374dee6c11e@redhat.com> <21761e28-c496-ff67-d7b7-628c9325085f@iki.fi> <9dd3a388-39b1-c059-de99-813f1e411764@case.edu> <5DF2987E.5000309@tlinx.org> <568aeaaa-22b3-c7b9-0e18-a92bef6d2ffb@iki.fi> <5DF2FE31.9070406@tlinx.org>
Xref csiph.com gnu.bash.bug:15725

Show key headers only | View raw


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

On 12/12/19 9:57 PM, L A Walsh wrote:
> 
> 
> On 2019/12/12 13:01, Ilkka Virta wrote:
>> On 12.12. 21:43, L A Walsh wrote:
>>  
>>> On 2019/12/06 14:14, Chet Ramey wrote:
>>>
>>> Seems very hard to print out that backquote though.  Closest I got
>>> was bash converting it to "''":
>>>     
>>
>> The backquote is in [6], and the backslash disappears, you just get
>> the pair of quotes in [2] because that's how printf %q outputs an
>> empty string.
>>   
> -----
> 
>    I'm sorry, but you are mistaken.

How so?

>    The characters from 'Z' (0x5A) through 'z' (0x61) are:
> 
> 0x5A 0x5B 0x5C 0x5D 0x5E 0x5F 0x60 0x61
> Z    [    \    ]     ^   _     `    a
> 
> the backslash comes between the two square brackets.
> 
> Position [6] is the "Grave Accent" (or backquote).
> 
> It is quoted properly.

But... that's exactly what was said.

> As for %q printing an empty string for 0x5C
> 
>         "%q" causes  printf to output the corresponding argument in a
>         format that can be reused as shell input.
> 
>    For that string to be empty would mean there is no character at hex
> value 0x5C (unicode U+005C), which isn't so.

But there isn't. An empty string was passed as an argument to printf,
because the backslash was *converted* via escaping, into an empty
string, *before* it was passed on the command line as an argv element to
the printf builtin.

Do you think that because printf is a builtin, and you didn't use
/bin/printf, that somehow means it is exempt from the usual rule of how
shells work, and gets to see its own argv before the parser reinterprets it?

>>  
>>>>  read -r -a a< <(printf "%q " {Z..a})
>>>>  my -p a
>>>>       
>>> declare -a a=([0]="Z" [1]="\\[" [2]="''" [3]="\\]" [4]="\\^" [5]="_"
>>> [6]="\\\`" [7]="a")
>>>     
>>
>>
>>   


-- 
Eli Schwartz
Bug Wrangler and Trusted User

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


Thread

Re: Not missing, but very hard to see (was Re: Backslash missing in brace expansion) Eli Schwartz <eschwartz@archlinux.org> - 2019-12-12 22:03 -0500

csiph-web