bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fwd: Non-upstream patches for bash (2014)


From: tetsujin
Subject: Re: Fwd: Non-upstream patches for bash (2014)
Date: Mon, 26 Jun 2017 16:35:28 -0400

That's not a reason why this disparity is "desirable" IMO.

Generally, the rule is that the shell interprets the shell script it's
given according to the character set of the active locale. It may not
allow any given sequence of characters in any given context, but in
terms of how the parser translates the sequence of input bytes into
input characters, it's always in terms of that input locale. Why would
this be true for virtually every facet of the language except for one
particular quoting syntax? The character set of a script is its most
fundamental layer of abstraction, and the shell is generally expected
to respect that abstraction. The idea that 0x5C in this context is
still a "backslash" is a fiction created by mis-interpreting the
script.

I'd argue that having this kind of inconsistency in the parser is
undesirable, and retaining it only causes harm. If other shells also
implement it this way, then those other shells are also broken, and
I'll submit this as a bug to their projects, too. :)

----- Original Message -----
From: address@hidden
To:<address@hidden>, "Eduardo_A._Bustamante_López"
<address@hidden>, <address@hidden>
Cc:<address@hidden>
Sent:Mon, 26 Jun 2017 14:34:32 -0400
Subject:Re: Fwd: Non-upstream patches for bash (2014)

 On 6/26/17 12:46 PM, address@hidden wrote:
 > 
 > It seems a strange inconsistency, though: Double-quoted strings
(and,
 > really, pretty much all other Bash syntax as far as I have seen)
recognize
 > 0x81 0x5C as a two-byte character rather than treating 0x5C as a
backslash
 > within the quoting syntax, but $'..' strings unconditionally treat
0x5C as
 > a backslash... Is there any reason a disparity like that would be
desirable?

 Because that's how C works, and that's how all the shells that
currently
 implement it work (and have always worked).

 Posix has considered this feature on and off (2010, 2015, 2016)[1],
albeit
 with a lot of tangents. If it ever gets standardized, I expect this
 question to be resolved. When it does, and if it's required, I'll
change
 Posix mode to match and then we'll see.

 [1] http://austingroupbugs.net/view.php?id=249

 Chet

 -- 
 ``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
 Chet Ramey, UTech, CWRU address@hidden
http://cnswww.cns.cwru.edu/~chet/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]