Re: Should shell quoting within glob bracket patterns be effective?

2018-04-17 Thread Geoff Clare
Geoff Clare wrote, on 16 Apr 2018: > > Robert Elz wrote, on 13 Apr 2018: > > > > Date:Fri, 13 Apr 2018 15:07:07 +0100 > > From:Geoff Clare > > > > | For those the only difference from REs is the '^' -> '!' one, > > > > Not for fnmatch() which can have \ to escape cha

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-16 Thread Joerg Schilling
Geoff Clare wrote: > Clearly the statement in XBD 9.3.5: > > The special characters '.', '*', '[', and '\\' ( , > , , and , respectively) > shall lose their special meaning within a bracket expression. > > is intended to apply to backslashes in fnmatch(), just as it does to > the spec

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-16 Thread Geoff Clare
Robert Elz wrote, on 13 Apr 2018: > > Date:Fri, 13 Apr 2018 15:07:07 +0100 > From:Geoff Clare > > | For those the only difference from REs is the '^' -> '!' one, > > Not for fnmatch() which can have \ to escape characters (anywhere > according to its description, whic

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-13 Thread Robert Elz
Date:Fri, 13 Apr 2018 15:07:07 +0100 From:Geoff Clare Message-ID: <20180413140707.GB19570@lt2.masqnet> | Bracket expressions are not only used in REs and the shell. There are | also fnmatch(), glob(), find and pax to consider, where shell quoting | does not app

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-13 Thread Geoff Clare
Robert Elz wrote, on 13 Apr 2018: > > Date:Fri, 13 Apr 2018 12:04:51 +0100 > From:Geoff Clare > > | In the case of , this does not make clear that it is only > | referring to the RE-and-shell-pattern-matching special meaning of > | and does not affect its shell-quo

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-13 Thread Geoff Clare
Robert Elz wrote, on 13 Apr 2018: > > I think we have had enough of this topic, so I will not continue it > after this message, but... > > | I maintain that the requirements of 2.2.3 are indeed universal. > > If that's true, then surely those words must be read in conjunction with > what the i

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-13 Thread Robert Elz
Date:Fri, 13 Apr 2018 11:51:12 +0100 From:Geoff Clare Message-ID: <20180413105112.GA16858@lt2.masqnet> I think we have had enough of this topic, so I will not continue it after this message, but... | I maintain that the requirements of 2.2.3 are indeed universal.

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-13 Thread Joerg Schilling
Robert Elz wrote: > I know it is irritating to duplicate text, and if they were truly the same, > I would not advocate it, but glob patterns and RE patterns are just > different - only the char classes look kind of similar (and even there we > need to do the '^' -> '!' substitution) but aren't re

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-13 Thread Robert Elz
Date:Fri, 13 Apr 2018 12:04:51 +0100 From:Geoff Clare Message-ID: <20180413110451.GA17286@lt2.masqnet> | In the case of , this does not make clear that it is only | referring to the RE-and-shell-pattern-matching special meaning of | and does not affect its shel

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-13 Thread Geoff Clare
I wrote, on 13 Apr 2018: > > Note that whilst extra text is not *needed* regarding quoting inside > bracket expressions, I would have no objection to some sort of explanatory > note being added to lessen the chances that readers fail to realise that > the quoting rules still apply inside bracket ex

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-13 Thread Geoff Clare
Robert Elz wrote, on 13 Apr 2018: > > That is, your comment that the text in 2.2.3 which says "shall preserve > the literal value..." is not universal throughout the spec as you implied. I maintain that the requirements of 2.2.3 are indeed universal. > If it doesn't always apply, then we need ex

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-13 Thread Robert Elz
Date:Fri, 13 Apr 2018 09:32:40 +0100 From:Geoff Clare Message-ID: <20180413083240.GA14937@lt2.masqnet> | Neither of your examples is valid because the standard already explicitly | describes the behaviour in those cases. Sorry, but those sections have nothing wha

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-13 Thread Joerg Schilling
"Schwarz, Konrad" wrote: > As the Bourne Shell source code posted earlier showed, that implementation > did not clearly separate the phases: a character with its high-bit set was > quoted for all further purposes. This worked with 7-bit ASCII. As we have an 8-bit clean Bourne Shell since 1986

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-13 Thread Joerg Schilling
Robert Elz wrote: > Date:Thu, 12 Apr 2018 12:10:04 -0700 > From:Don Cragun > Message-ID: > > | The fact that the $ is special is what is the key. > > The problem is in the interpretation of just what "treated literally" means. > > If it just means that "the charac

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-13 Thread Geoff Clare
Robert Elz wrote, on 13 Apr 2018: > > I have also just realised that a better example than ${ in "" would have been > $( inside "". > > There, because of the double quotes, the '(' is treated literally, as a '(' > character, and not as the '(' operator. But still when the command > substitition

RE: Should shell quoting within glob bracket patterns be effective?

2018-04-13 Thread Schwarz, Konrad
> -Original Message- > From: Robert Elz [mailto:k...@munnari.oz.au] > Put that reasoning into the argument in the previous message, instead > of the ${ version and I think it becomes clearer how the current text > allows the '-' inside "a-c" to be treated literally, as the string is > pa

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-12 Thread Robert Elz
I have also just realised that a better example than ${ in "" would have been $( inside "". There, because of the double quotes, the '(' is treated literally, as a '(' character, and not as the '(' operator. But still when the command substitition (inside the "") is performed, the '(' is availab

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-12 Thread Robert Elz
Date:Thu, 12 Apr 2018 12:10:04 -0700 From:Don Cragun Message-ID: | The fact that the $ is special is what is the key. The problem is in the interpretation of just what "treated literally" means. If it just means that "the character is itself and is not transforme

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-12 Thread Don Cragun
> On Apr 12, 2018, at 8:07 AM, Robert Elz wrote: > >Date:Thu, 12 Apr 2018 14:25:32 +0100 >From:Geoff Clare >Message-ID: <20180412132532.GA9483@lt2.masqnet> > > | It treats them as literal characters, just as 2.2.3 says. > > I thought that might have been the res

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-12 Thread Robert Elz
Date:Thu, 12 Apr 2018 14:25:32 +0100 From:Geoff Clare Message-ID: <20180412132532.GA9483@lt2.masqnet> | It treats them as literal characters, just as 2.2.3 says. I thought that might have been the response, in that case in "${xxx}" The '{' has to be treat

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-12 Thread Geoff Clare
Robert Elz wrote, on 12 Apr 2018: > > Date:Thu, 12 Apr 2018 13:25:01 +0100 > From:Geoff Clare > > | Yes there is. I quoted it earlier in this thread. > > I know that, but that's useless for this purpose. We know the quoted > (part of) the string is treated literally

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-12 Thread Robert Elz
Date:Thu, 12 Apr 2018 13:25:01 +0100 From:Geoff Clare Message-ID: <20180412122501.GA8783@lt2.masqnet> | Yes there is. I quoted it earlier in this thread. I know that, but that's useless for this purpose. We know the quoted (part of) the string is treated literal

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-12 Thread Geoff Clare
Robert Elz wrote, on 12 Apr 2018: > > Date:Thu, 12 Apr 2018 11:39:11 +0100 > From:Geoff Clare > > | Huh? The '-' is quoted by the double quotes and should therefore be > | treated literally. > > The problem is that there is nothing in either TC2 or TC2 + 985-fix th

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-12 Thread Robert Elz
Date:Thu, 12 Apr 2018 11:39:11 +0100 From:Geoff Clare Message-ID: <20180412103911.GA6656@lt2.masqnet> | Huh? The '-' is quoted by the double quotes and should therefore be | treated literally. The problem is that there is nothing in either TC2 or TC2 + 985-fix

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-12 Thread Robert Elz
Date:Thu, 12 Apr 2018 12:10:20 +0200 From:Joerg Schilling Message-ID: <5acf308c.yoyva4vzwwu8t7jp%joerg.schill...@fokus.fraunhofer.de> Jörg: | Since '' and "" quoting in the shell is highly complex and no longer present at | the time the shell pattern matching i

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-12 Thread Joerg Schilling
Geoff Clare wrote: > > > > > ["a\-c"] the backslash is not special and should be treated literally > > > > This string is converted into [\a\\-\c] by the shell macro expansion code. > > > > With the shell gmatch() code, this results in a match for 'a' and '\\' .. > > 'c'. > > Huh? The '-' is

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-12 Thread Geoff Clare
Joerg Schilling wrote, on 12 Apr 2018: > > Geoff Clare wrote: > > > > Maybe, I should again mention history: > > > > > > - fmnatch() has been introduced with issue 4 (1995). It does not > > > seem to be related to a historic UNIX. Since the oldest known > > > impleme

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-12 Thread Joerg Schilling
Geoff Clare wrote: > > Maybe, I should again mention history: > > > > - fmnatch() has been introduced with issue 4 (1995). It does not > > seem to be related to a historic UNIX. Since the oldest known > > implementation is from IBM, fnmatch() may have been intro

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-12 Thread Joerg Schilling
Robert Elz wrote: > And yes, in particular if a [a\-c] means a class with the three chars 'a' '-' > and 'c' in it in sh it should mean that in fnmatch() as well, or if that > pattern means a class with 8 chars (0x5c .. 0x63) with 'a' there 2 ways, > in fnmatch() then it should mean that in sh as

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-12 Thread Geoff Clare
Joerg Schilling wrote, on 12 Apr 2018: > > It seems that we need to define how quoting works in a real shell > implementation. > > If we require the strings to be in the form \c\h\a\r in case of a quoted > string > at that specific part of the shell, we may explain how quoting works for > "c

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-12 Thread Robert Elz
Date:Thu, 12 Apr 2018 09:24:51 +0100 From:Geoff Clare Message-ID: <20180412082451.GA3949@lt2.masqnet> | Bug 985 moves the detail from the current 2.13 into the fnmatch() | description and makes 2.13 refer to fnmatch(). Oh - I did not read all of it all that caref

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-12 Thread Joerg Schilling
Robert Elz wrote: > Date:Wed, 11 Apr 2018 15:14:00 +0100 > From:Geoff Clare > Message-ID: <20180411141400.GA32463@lt2.masqnet> > > | I also have a feeling we will have to abandon the neat idea of defining > | shell pattern matching in terms of fnmatch(). > > Yes

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-12 Thread Geoff Clare
Robert Elz wrote, on 12 Apr 2018: > > Date:Wed, 11 Apr 2018 15:14:00 +0100 > From:Geoff Clare > > | I also have a feeling we will have to abandon the neat idea of defining > | shell pattern matching in terms of fnmatch(). > > Yes, but for a slightly different reason

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-11 Thread Robert Elz
Date:Wed, 11 Apr 2018 15:14:00 +0100 From:Geoff Clare Message-ID: <20180411141400.GA32463@lt2.masqnet> | I also have a feeling we will have to abandon the neat idea of defining | shell pattern matching in terms of fnmatch(). Yes, but for a slightly different rea

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-11 Thread Geoff Clare
Robert Elz wrote, on 11 Apr 2018: > > Date:Wed, 11 Apr 2018 12:18:27 +0100 > From:Geoff Clare > > | No, that text is very careful to say "*was* quoted", not "is quoted", > | for precisely this reason. To conform to this requirement, the shell > | has to remember wh

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-11 Thread Robert Elz
Date:Wed, 11 Apr 2018 14:14:18 +0200 From:Joerg Schilling Message-ID: <5acdfc1a.st0sitei1fsdsgeb%joerg.schill...@fokus.fraunhofer.de> | Then we should change the wording. I agree. | The characters '.', '*' and '[' really lose their special meaning inside a |

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-11 Thread Robert Elz
Date:Wed, 11 Apr 2018 12:18:27 +0100 From:Geoff Clare Message-ID: <2018041827.GA29286@lt2.masqnet> | No, that text is very careful to say "*was* quoted", not "is quoted", | for precisely this reason. To conform to this requirement, the shell | has to rememb

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-11 Thread Joerg Schilling
Robert Elz wrote: > Date:Wed, 11 Apr 2018 11:28:38 +0200 > From:Joerg Schilling > Message-ID: > <5acdd546.fkln7tigk21a+de6%joerg.schill...@fokus.fraunhofer.de> > > | The problem is that the term "quote removal" is not related to a real > verified > | shell imp

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-11 Thread Robert Elz
Date:Wed, 11 Apr 2018 11:28:38 +0200 From:Joerg Schilling Message-ID: <5acdd546.fkln7tigk21a+de6%joerg.schill...@fokus.fraunhofer.de> | The problem is that the term "quote removal" is not related to a real verified | shell implementation but rather explained by

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-11 Thread Geoff Clare
Robert Elz wrote, on 11 Apr 2018: > > Incidentally, I know that this part of the 985 new text ... > > the first argument (pattern) is the same as patt, except each character > that was quoted in patt and is not in a bracket expression is prefixed > by a backslash > > is intended to

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-11 Thread Joerg Schilling
Geoff Clare wrote: > Here's a much simpler demonstration of the same "quoting within > brackets" issue: > > $ ls > b > > ksh93: > $ echo ["a-c"] > b > > ksh88 and bash: > $ echo ["a-c"] > [a-c] > > As Joerg pointed out, the intention would have been for POSIX to > specify the ksh88 behaviour, so

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-11 Thread Joerg Schilling
Geoff Clare wrote: > Robert Elz wrote, on 11 Apr 2018: > > > > Lower down, it says ... > > > > In order from the beginning to the end of the case statement, each > > pattern > > that labels a compound-list shall be subjected to tilde expansion, > > parameter > > expansion, command

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-11 Thread Robert Elz
Date:Wed, 11 Apr 2018 10:00:27 +0100 From:Geoff Clare Message-ID: <20180411090027.GA18582@lt2.masqnet> | There is nothing to suggest that this does not apply to the characters | which, when unquoted, have a special meaning within bracket expressions | ('!', '-',

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-11 Thread Joerg Schilling
Martijn Dekker wrote: > Op 10-04-18 om 15:59 schreef Joerg Schilling: > > Whom do you call "current ksh93 lead developers"? > > As far as I can tell from what's going on at the github repo, Siteshwar > Vashisht and Kurtis Rader currently appear to be in charge of its > development. I am still

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-11 Thread Joerg Schilling
Robert Elz wrote: > Date:Tue, 10 Apr 2018 13:41:25 +0100 > From:Martijn Dekker > Message-ID: > > | Does POSIX specify anything, either way, regarding the effect of shell > | quoting within glob bracket patterns? > > I would say it is unclear - in general, quoti

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-11 Thread Joerg Schilling
Martijn Dekker wrote: > Op 10-04-18 om 21:06 schreef Robert Elz: > > Date:Tue, 10 Apr 2018 13:41:25 +0100 > > From:Martijn Dekker > > Message-ID: > > > >| Does POSIX specify anything, either way, regarding the effect of shell > >| quoting within glob bra

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-11 Thread Geoff Clare
I wrote: > > And I believe the standard does clearly require the ksh88/bash > behaviour because of this statement in 2.2.3 Double-Quotes: > > Enclosing characters in double-quotes ("") shall preserve the > literal value of all characters within the double-quotes, with the > exception o

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-11 Thread Geoff Clare
Martijn Dekker wrote, on 10 Apr 2018: > > Re: https://github.com/att/ast/issues/71 > > Consider this test script: > > (set -o posix) 2>/dev/null && set -o posix > emulate sh 2>/dev/null # for zsh > for var in 'a-c' '!a'; do > case b in > ( ["$var"] )echo 'quirk' ;; > ( [$v

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-11 Thread Geoff Clare
Robert Elz wrote, on 11 Apr 2018: > > Lower down, it says ... > > In order from the beginning to the end of the case statement, each > pattern > that labels a compound-list shall be subjected to tilde expansion, > parameter > expansion, command substitution, and arithmetic exp

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-10 Thread Martijn Dekker
Op 10-04-18 om 22:50 schreef Jilles Tjoelker: I prefer "no quirk" twice as output but it is indeed not fully specified. I agree with your preference. Ignoring shell quoting in glob bracket patterns means removing a useful feature: the ability to pass an arbitrary string of characters in a pa

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-10 Thread Jilles Tjoelker
On Tue, Apr 10, 2018 at 01:41:25PM +0100, Martijn Dekker wrote: > Re: https://github.com/att/ast/issues/71 > Consider this test script: > (set -o posix) 2>/dev/null && set -o posix > emulate sh 2>/dev/null # for zsh > for var in 'a-c' '!a'; do > case b in > ( ["$var"] )echo 'quir

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-10 Thread Martijn Dekker
Op 10-04-18 om 15:59 schreef Joerg Schilling: Whom do you call "current ksh93 lead developers"? As far as I can tell from what's going on at the github repo, Siteshwar Vashisht and Kurtis Rader currently appear to be in charge of its development. - M.

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-10 Thread Martijn Dekker
Op 10-04-18 om 21:52 schreef Robert Elz: No, it doesn't. Read that again, with the emphasis I am adding ... |http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09_04_05 | | The conditional construct case shall execute the/compound-list/ | | corresponding t

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-10 Thread Robert Elz
Date:Tue, 10 Apr 2018 21:28:01 +0100 From:Martijn Dekker Message-ID: <6e79f3b1-732e-a7d4-1d07-a04d7a9cf...@inlv.org> | But it is. POSIX explicitly specifies quote removal for 'case' patterns: No, it doesn't. Read that again, with the emphasis I am adding ... |

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-10 Thread Chet Ramey
On 4/10/18 4:28 PM, Martijn Dekker wrote: >> [this includes case patterns as quote removal is not performed on them] > > But it is. POSIX explicitly specifies quote removal for 'case' patterns: > http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09_04_05 > > | The c

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-10 Thread Martijn Dekker
Op 10-04-18 om 21:06 schreef Robert Elz: Date:Tue, 10 Apr 2018 13:41:25 +0100 From:Martijn Dekker Message-ID: | Does POSIX specify anything, either way, regarding the effect of shell | quoting within glob bracket patterns? I would say it is unclear - in g

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-10 Thread Robert Elz
Date:Tue, 10 Apr 2018 13:41:25 +0100 From:Martijn Dekker Message-ID: | Does POSIX specify anything, either way, regarding the effect of shell | quoting within glob bracket patterns? I would say it is unclear - in general, quoting inside [] does not work (XCU 2.

Re: Should shell quoting within glob bracket patterns be effective?

2018-04-10 Thread Joerg Schilling
Martijn Dekker wrote: > Re: https://github.com/att/ast/issues/71 > > Consider this test script: > > (set -o posix) 2>/dev/null && set -o posix > emulate sh 2>/dev/null # for zsh > for var in 'a-c' '!a'; do > case b in > ( ["$var"] )echo 'quirk' ;; > ( [$var] ) echo 'no