[1003.1(2016)/Issue7+TC2 0001190]: backslash has two special meanings in the shell and only loses one of them in bracket expressions

2018-04-16 Thread Austin Group Bug Tracker

A NOTE has been added to this issue. 
== 
http://austingroupbugs.net/view.php?id=1190 
== 
Reported By:geoffclare
Assigned To:
== 
Project:1003.1(2016)/Issue7+TC2
Issue ID:   1190
Category:   Base Definitions and Headers
Type:   Clarification Requested
Severity:   Comment
Priority:   normal
Status: New
Name:   Geoff Clare 
Organization:   The Open Group 
User Reference:  
Section:9.3.5 
Page Number:184 
Line Number:6089 
Interp Status:  --- 
Final Accepted Text: 
== 
Date Submitted: 2018-04-13 11:16 UTC
Last Modified:  2018-04-16 08:31 UTC
== 
Summary:backslash has two special meanings in the shell and
only loses one of them in bracket expressions
== 

-- 
 (0003958) geoffclare (manager) - 2018-04-16 08:31
 http://austingroupbugs.net/view.php?id=1190#c3958 
-- 
Special meaning 1 is an escape character in shell quoting, as per 2.2.1 "A
 that is not quoted shall preserve the literal value of the
following character, with the exception of a ."

Special meaning 2 is an escape character in pattern matching, as per 2.13.1
"A  character shall escape the following character. The escaping
 shall be discarded." 

Issue History 
Date ModifiedUsername   FieldChange   
== 
2018-04-13 11:16 geoffclare New Issue
2018-04-13 11:16 geoffclare Name  => Geoff Clare 
2018-04-13 11:16 geoffclare Organization  => The Open Group  
2018-04-13 11:16 geoffclare Section   => 9.3.5   
2018-04-13 11:16 geoffclare Page Number   => 184 
2018-04-13 11:16 geoffclare Line Number   => 6089
2018-04-13 11:16 geoffclare Interp Status => --- 
2018-04-13 11:18 geoffclare Desired Action Updated   
2018-04-13 12:39 kreNote Added: 0003954  
2018-04-13 13:47 geoffclare Note Added: 0003955  
2018-04-14 17:17 stephane   Note Added: 0003957  
2018-04-16 08:31 geoffclare Note Added: 0003958  
==




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, which would include in bracket expressions,
> as that is not excluded.

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 special meaning of backslash stated in XCU 2.13.1 (which also
doesn't mention an exception for bracket expressions).

The whole point of adding fnmatch() to the standard was to provide a
a function which implements XCU 2.13, so any interpretation of the
standard which has backslash being treated differently in fnmatch()
(without FNM_NOESCAPE) than in XCU 2.13 cannot be correct.

While quoting it here, I just noticed that this statement also has
another issue when being read in the context of XCU 2.13.1: it should
refer to '?' losing its special meaning instead of '.'.  I'll update
my proposed change in bug 1190 to address that.

-- 
Geoff Clare 
The Open Group, Apex Plaza, Forbury Road, Reading, RG1 1AX, England



[1003.1(2016)/Issue7+TC2 0001190]: backslash has two special meanings in the shell and only loses one of them in bracket expressions

2018-04-16 Thread Austin Group Bug Tracker

A NOTE has been added to this issue. 
== 
http://austingroupbugs.net/view.php?id=1190 
== 
Reported By:geoffclare
Assigned To:
== 
Project:1003.1(2016)/Issue7+TC2
Issue ID:   1190
Category:   Base Definitions and Headers
Type:   Clarification Requested
Severity:   Comment
Priority:   normal
Status: New
Name:   Geoff Clare 
Organization:   The Open Group 
User Reference:  
Section:9.3.5 
Page Number:184 
Line Number:6089 
Interp Status:  --- 
Final Accepted Text: 
== 
Date Submitted: 2018-04-13 11:16 UTC
Last Modified:  2018-04-16 09:23 UTC
== 
Summary:backslash has two special meanings in the shell and
only loses one of them in bracket expressions
== 

-- 
 (0003959) geoffclare (manager) - 2018-04-16 09:23
 http://austingroupbugs.net/view.php?id=1190#c3959 
-- 
Another problem with this part of 9.3.5 has been identified in email
discussion: it only lists the special characters for BREs.  It should have
different lists for BREs, EREs and shell patterns. New proposed changes...

On page 184 line 6087 section 9.3.5 RE Bracket Expression,
change:The special characters '.', '*', '[', and '\\'
(, , , and ,
respectively) shall lose their special meaning within a bracket
expression.to:When the bracket expression appears
within a BRE, the special characters '.', '*', '[', and '\\' (,
, , and , respectively) shall
lose their special meaning within the bracket expression. When the bracket
expression appears within an ERE, the special characters '.', '(', '*',
'+', '?', '{', '|', '[', and '\\' (, ,
, plus-sign>, , , ,
, and , respectively) shall lose their
special meaning within the bracket expression. When the bracket expression
appears within a shell pattern (see [xref to XCU 2.13]), the special
characters '?', '*', and '[' (, , and
, respectively) shall lose their special meaning
within the bracket expression;  ('\\') shall lose its special
meaning as a pattern matching character (see [xref to XCU 2.13.1]) but, in
situations where shell quoting is performed, shall retain its special
meaning as a shell quoting character (see [xref to XCU 2.2)]. For
example:$ ls
! $ - a b c
$ echo [a\-c]
- a c
$ echo [\!a]
! a
$ echo ["!\$a-c"]
! $ - a c
$ echo [!"\$a-c"]
! b
$ echo [!\]\\]
! $ - a b c 

Issue History 
Date ModifiedUsername   FieldChange   
== 
2018-04-13 11:16 geoffclare New Issue
2018-04-13 11:16 geoffclare Name  => Geoff Clare 
2018-04-13 11:16 geoffclare Organization  => The Open Group  
2018-04-13 11:16 geoffclare Section   => 9.3.5   
2018-04-13 11:16 geoffclare Page Number   => 184 
2018-04-13 11:16 geoffclare Line Number   => 6089
2018-04-13 11:16 geoffclare Interp Status => --- 
2018-04-13 11:18 geoffclare Desired Action Updated   
2018-04-13 12:39 kreNote Added: 0003954  
2018-04-13 13:47 geoffclare Note Added: 0003955  
2018-04-14 17:17 stephane   Note Added: 0003957  
2018-04-16 08:31 geoffclare Note Added: 0003958  
2018-04-16 09:23 geoffclare Note Added: 0003959  
==




[1003.1(2016)/Issue7+TC2 0001190]: backslash has two special meanings in the shell and only loses one of them in bracket expressions

2018-04-16 Thread Austin Group Bug Tracker

A NOTE has been added to this issue. 
== 
http://austingroupbugs.net/view.php?id=1190 
== 
Reported By:geoffclare
Assigned To:
== 
Project:1003.1(2016)/Issue7+TC2
Issue ID:   1190
Category:   Base Definitions and Headers
Type:   Clarification Requested
Severity:   Comment
Priority:   normal
Status: New
Name:   Geoff Clare 
Organization:   The Open Group 
User Reference:  
Section:9.3.5 
Page Number:184 
Line Number:6089 
Interp Status:  --- 
Final Accepted Text: 
== 
Date Submitted: 2018-04-13 11:16 UTC
Last Modified:  2018-04-16 11:06 UTC
== 
Summary:backslash has two special meanings in the shell and
only loses one of them in bracket expressions
== 

-- 
 (0003960) stephane (reporter) - 2018-04-16 11:06
 http://austingroupbugs.net/view.php?id=1190#c3960 
-- 
That's wrong for shell pattern matching. As I said earlier, backslash is
not a pattern matching operator in shell wildcards (not any more than ' or
"), it's only a quoting operator and quoting disables wildcard operators.

For instance,


pattern='\*'
case $string in
  $pattern) echo something;;
esac


Matches on any string that starts with backslash, not on a literal star (at
least in Bourne/ksh/ash/pdksh, not in zsh nor bash, probably a bug as they
match on none of *, \*, \x)

That's different for


find . -name '\*'


Which matches on files called literally "*" (same as -name '[*]') as in
fnmatch() backslash is used as an ersatz of shell quoting.

Also note that $ loses its special meaning inside [...] in ERE (in BRE, is
loses it already by not being the last character of the RE). 

Issue History 
Date ModifiedUsername   FieldChange   
== 
2018-04-13 11:16 geoffclare New Issue
2018-04-13 11:16 geoffclare Name  => Geoff Clare 
2018-04-13 11:16 geoffclare Organization  => The Open Group  
2018-04-13 11:16 geoffclare Section   => 9.3.5   
2018-04-13 11:16 geoffclare Page Number   => 184 
2018-04-13 11:16 geoffclare Line Number   => 6089
2018-04-13 11:16 geoffclare Interp Status => --- 
2018-04-13 11:18 geoffclare Desired Action Updated   
2018-04-13 12:39 kreNote Added: 0003954  
2018-04-13 13:47 geoffclare Note Added: 0003955  
2018-04-14 17:17 stephane   Note Added: 0003957  
2018-04-16 08:31 geoffclare Note Added: 0003958  
2018-04-16 09:23 geoffclare Note Added: 0003959  
2018-04-16 09:25 geoffclare Note Edited: 0003959 
2018-04-16 11:06 stephane   Note Added: 0003960  
==




[1003.1(2016)/Issue7+TC2 0001190]: backslash has two special meanings in the shell and only loses one of them in bracket expressions

2018-04-16 Thread Austin Group Bug Tracker

A NOTE has been added to this issue. 
== 
http://austingroupbugs.net/view.php?id=1190 
== 
Reported By:geoffclare
Assigned To:
== 
Project:1003.1(2016)/Issue7+TC2
Issue ID:   1190
Category:   Base Definitions and Headers
Type:   Clarification Requested
Severity:   Comment
Priority:   normal
Status: New
Name:   Geoff Clare 
Organization:   The Open Group 
User Reference:  
Section:9.3.5 
Page Number:184 
Line Number:6089 
Interp Status:  --- 
Final Accepted Text: 
== 
Date Submitted: 2018-04-13 11:16 UTC
Last Modified:  2018-04-16 11:21 UTC
== 
Summary:backslash has two special meanings in the shell and
only loses one of them in bracket expressions
== 

-- 
 (0003961) stephane (reporter) - 2018-04-16 11:21
 http://austingroupbugs.net/view.php?id=1190#c3961 
-- 
Note that:


pattern='[\]*'
case $string in
  $pattern) echo something;;
esac


matches on []anything in bash and dash, gives an error in zsh, matches on
\anything in Bourne/yash/mksh (as I'd expect), only on [\]* (that I can
tell) in ksh93.

So it does look like a jolly mess. 

Issue History 
Date ModifiedUsername   FieldChange   
== 
2018-04-13 11:16 geoffclare New Issue
2018-04-13 11:16 geoffclare Name  => Geoff Clare 
2018-04-13 11:16 geoffclare Organization  => The Open Group  
2018-04-13 11:16 geoffclare Section   => 9.3.5   
2018-04-13 11:16 geoffclare Page Number   => 184 
2018-04-13 11:16 geoffclare Line Number   => 6089
2018-04-13 11:16 geoffclare Interp Status => --- 
2018-04-13 11:18 geoffclare Desired Action Updated   
2018-04-13 12:39 kreNote Added: 0003954  
2018-04-13 13:47 geoffclare Note Added: 0003955  
2018-04-14 17:17 stephane   Note Added: 0003957  
2018-04-16 08:31 geoffclare Note Added: 0003958  
2018-04-16 09:23 geoffclare Note Added: 0003959  
2018-04-16 09:25 geoffclare Note Edited: 0003959 
2018-04-16 11:06 stephane   Note Added: 0003960  
2018-04-16 11:10 stephane   Note Edited: 0003960 
2018-04-16 11:12 stephane   Note Edited: 0003960 
2018-04-16 11:21 stephane   Note Added: 0003961  
==




[1003.1(2016)/Issue7+TC2 0001190]: backslash has two special meanings in the shell and only loses one of them in bracket expressions

2018-04-16 Thread Austin Group Bug Tracker

A NOTE has been added to this issue. 
== 
http://austingroupbugs.net/view.php?id=1190 
== 
Reported By:geoffclare
Assigned To:
== 
Project:1003.1(2016)/Issue7+TC2
Issue ID:   1190
Category:   Base Definitions and Headers
Type:   Clarification Requested
Severity:   Comment
Priority:   normal
Status: New
Name:   Geoff Clare 
Organization:   The Open Group 
User Reference:  
Section:9.3.5 
Page Number:184 
Line Number:6089 
Interp Status:  --- 
Final Accepted Text: 
== 
Date Submitted: 2018-04-13 11:16 UTC
Last Modified:  2018-04-16 11:45 UTC
== 
Summary:backslash has two special meanings in the shell and
only loses one of them in bracket expressions
== 

-- 
 (0003962) stephane (reporter) - 2018-04-16 11:45
 http://austingroupbugs.net/view.php?id=1190#c3962 
-- 
More fun:


$ ksh -c 'case "[\\]" in [\\]) echo yes;; esac'
yes
$ ksh -c 'case "\\" in [\\]) echo yes;; esac'
yes


(both ksh88 and ksh93, also in Bourne). Same for [] or [] 

Issue History 
Date ModifiedUsername   FieldChange   
== 
2018-04-13 11:16 geoffclare New Issue
2018-04-13 11:16 geoffclare Name  => Geoff Clare 
2018-04-13 11:16 geoffclare Organization  => The Open Group  
2018-04-13 11:16 geoffclare Section   => 9.3.5   
2018-04-13 11:16 geoffclare Page Number   => 184 
2018-04-13 11:16 geoffclare Line Number   => 6089
2018-04-13 11:16 geoffclare Interp Status => --- 
2018-04-13 11:18 geoffclare Desired Action Updated   
2018-04-13 12:39 kreNote Added: 0003954  
2018-04-13 13:47 geoffclare Note Added: 0003955  
2018-04-14 17:17 stephane   Note Added: 0003957  
2018-04-16 08:31 geoffclare Note Added: 0003958  
2018-04-16 09:23 geoffclare Note Added: 0003959  
2018-04-16 09:25 geoffclare Note Edited: 0003959 
2018-04-16 11:06 stephane   Note Added: 0003960  
2018-04-16 11:10 stephane   Note Edited: 0003960 
2018-04-16 11:12 stephane   Note Edited: 0003960 
2018-04-16 11:21 stephane   Note Added: 0003961  
2018-04-16 11:22 stephane   Note Edited: 0003961 
2018-04-16 11:27 stephane   Note Edited: 0003961 
2018-04-16 11:45 stephane   Note Added: 0003962  
==




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 special meaning of backslash stated in XCU 2.13.1 (which also
> doesn't mention an exception for bracket expressions).

It seems that everybody agrees that [a-z] should behave different to ["a-z"].
How this is implemented in the shell is not mentioned in POSIX. It seems 
however that people tend to use a prepended '\\' in strings to mark quoted 
characters in shell internal strings.

> The whole point of adding fnmatch() to the standard was to provide a
> a function which implements XCU 2.13, so any interpretation of the
> standard which has backslash being treated differently in fnmatch()
> (without FNM_NOESCAPE) than in XCU 2.13 cannot be correct.

If the intention was not to add a new interface but to add an interface that 
could be used to give the same results as seen in the shell, then I would 
expect fnmatch() to honor backslashes in [..] constructs as long as 
FNM_NOESCAPE is not in effect.

> While quoting it here, I just noticed that this statement also has
> another issue when being read in the context of XCU 2.13.1: it should
> refer to '?' losing its special meaning instead of '.'.  I'll update
> my proposed change in bug 1190 to address that.

It may be that the original intention was not to enforce people to implement 
shell internal quoting by using prepended '\\' characters in the strings that 
are used internally after tokenization in the parser. In case that a different 
mechanism is used, it would need a different implementation in fnmatch() as 
well.

I am not aware of a shell implementation that today uses a different method, so 
implementing backslash based quoting in fnmatch() seems to be the obvious 
method to recreate the behavior of the shell.

Jörg

-- 
 EMail:jo...@schily.net(home) Jörg Schilling D-13353 Berlin
joerg.schill...@fokus.fraunhofer.de (work) Blog: http://schily.blogspot.com/
 URL: http://cdrecord.org/private/ http://sf.net/projects/schilytools/files/'



[1003.1(2016)/Issue7+TC2 0001190]: backslash has two special meanings in the shell and only loses one of them in bracket expressions

2018-04-16 Thread Austin Group Bug Tracker

A NOTE has been added to this issue. 
== 
http://austingroupbugs.net/view.php?id=1190 
== 
Reported By:geoffclare
Assigned To:
== 
Project:1003.1(2016)/Issue7+TC2
Issue ID:   1190
Category:   Base Definitions and Headers
Type:   Clarification Requested
Severity:   Comment
Priority:   normal
Status: New
Name:   Geoff Clare 
Organization:   The Open Group 
User Reference:  
Section:9.3.5 
Page Number:184 
Line Number:6089 
Interp Status:  --- 
Final Accepted Text: 
== 
Date Submitted: 2018-04-13 11:16 UTC
Last Modified:  2018-04-16 14:41 UTC
== 
Summary:backslash has two special meanings in the shell and
only loses one of them in bracket expressions
== 

-- 
 (0003963) geoffclare (manager) - 2018-04-16 14:41
 http://austingroupbugs.net/view.php?id=1190#c3963 
-- 
Re: http://austingroupbugs.net/view.php?id=1190#c3960, XCU 2.13.1 clearly
defines a pattern-matching rule,
distinct from the usual quoting rule, for backslash in the shell (in the
first paragraph - it specifies it separately in the last paragraph for
non-shell pattern matchers).  It appears that bash and zsh are implementing
the standard as written but the other shells you tested are not.

When testing this stuff note that ksh93 is known to behave incorrectly as
regards quoting inside bracket expressions - that was the reason this whole
discussion started in the first place.  ksh88 also has some weird bugs,
such as ["a\-c"] matching 'a', backslash and 'c' but not  '-'.

Re: http://austingroupbugs.net/view.php?id=1190#c3962, your final observation
would seem to be a reason to keep
the standard's requirements in 2.13.1 as-is, so that pattern='\\*' can be
used for this, which works in bash and presumably zsh. 

Issue History 
Date ModifiedUsername   FieldChange   
== 
2018-04-13 11:16 geoffclare New Issue
2018-04-13 11:16 geoffclare Name  => Geoff Clare 
2018-04-13 11:16 geoffclare Organization  => The Open Group  
2018-04-13 11:16 geoffclare Section   => 9.3.5   
2018-04-13 11:16 geoffclare Page Number   => 184 
2018-04-13 11:16 geoffclare Line Number   => 6089
2018-04-13 11:16 geoffclare Interp Status => --- 
2018-04-13 11:18 geoffclare Desired Action Updated   
2018-04-13 12:39 kreNote Added: 0003954  
2018-04-13 13:47 geoffclare Note Added: 0003955  
2018-04-14 17:17 stephane   Note Added: 0003957  
2018-04-16 08:31 geoffclare Note Added: 0003958  
2018-04-16 09:23 geoffclare Note Added: 0003959  
2018-04-16 09:25 geoffclare Note Edited: 0003959 
2018-04-16 11:06 stephane   Note Added: 0003960  
2018-04-16 11:10 stephane   Note Edited: 0003960 
2018-04-16 11:12 stephane   Note Edited: 0003960 
2018-04-16 11:21 stephane   Note Added: 0003961  
2018-04-16 11:22 stephane   Note Edited: 0003961 
2018-04-16 11:27 stephane   Note Edited: 0003961 
2018-04-16 11:45 stephane   Note Added: 0003962  
2018-04-16 12:18 stephane   Note Edited: 0003962 
2018-04-16 12:22 stephane   Note Edited: 0003962 
2018-04-16 14:41 geoffclare Note Added: 0003963  
==




[1003.1(2016)/Issue7+TC2 0001190]: backslash has two special meanings in the shell and only loses one of them in bracket expressions

2018-04-16 Thread Austin Group Bug Tracker

A NOTE has been added to this issue. 
== 
http://austingroupbugs.net/view.php?id=1190 
== 
Reported By:geoffclare
Assigned To:
== 
Project:1003.1(2016)/Issue7+TC2
Issue ID:   1190
Category:   Base Definitions and Headers
Type:   Clarification Requested
Severity:   Comment
Priority:   normal
Status: New
Name:   Geoff Clare 
Organization:   The Open Group 
User Reference:  
Section:9.3.5 
Page Number:184 
Line Number:6089 
Interp Status:  --- 
Final Accepted Text: 
== 
Date Submitted: 2018-04-13 11:16 UTC
Last Modified:  2018-04-16 14:52 UTC
== 
Summary:backslash has two special meanings in the shell and
only loses one of them in bracket expressions
== 

-- 
 (0003964) geoffclare (manager) - 2018-04-16 14:52
 http://austingroupbugs.net/view.php?id=1190#c3964 
-- 
I have edited http://austingroupbugs.net/view.php?id=1190#c3959 to add '$' and
'^' in the part about ERE special
characters. 

Issue History 
Date ModifiedUsername   FieldChange   
== 
2018-04-13 11:16 geoffclare New Issue
2018-04-13 11:16 geoffclare Name  => Geoff Clare 
2018-04-13 11:16 geoffclare Organization  => The Open Group  
2018-04-13 11:16 geoffclare Section   => 9.3.5   
2018-04-13 11:16 geoffclare Page Number   => 184 
2018-04-13 11:16 geoffclare Line Number   => 6089
2018-04-13 11:16 geoffclare Interp Status => --- 
2018-04-13 11:18 geoffclare Desired Action Updated   
2018-04-13 12:39 kreNote Added: 0003954  
2018-04-13 13:47 geoffclare Note Added: 0003955  
2018-04-14 17:17 stephane   Note Added: 0003957  
2018-04-16 08:31 geoffclare Note Added: 0003958  
2018-04-16 09:23 geoffclare Note Added: 0003959  
2018-04-16 09:25 geoffclare Note Edited: 0003959 
2018-04-16 11:06 stephane   Note Added: 0003960  
2018-04-16 11:10 stephane   Note Edited: 0003960 
2018-04-16 11:12 stephane   Note Edited: 0003960 
2018-04-16 11:21 stephane   Note Added: 0003961  
2018-04-16 11:22 stephane   Note Edited: 0003961 
2018-04-16 11:27 stephane   Note Edited: 0003961 
2018-04-16 11:45 stephane   Note Added: 0003962  
2018-04-16 12:18 stephane   Note Edited: 0003962 
2018-04-16 12:22 stephane   Note Edited: 0003962 
2018-04-16 14:41 geoffclare Note Added: 0003963  
2018-04-16 14:50 geoffclare Note Edited: 0003959 
2018-04-16 14:52 geoffclare Note Added: 0003964  
==




[1003.1(2016)/Issue7+TC2 0001190]: backslash has two special meanings in the shell and only loses one of them in bracket expressions

2018-04-16 Thread Austin Group Bug Tracker

A NOTE has been added to this issue. 
== 
http://austingroupbugs.net/view.php?id=1190 
== 
Reported By:geoffclare
Assigned To:
== 
Project:1003.1(2016)/Issue7+TC2
Issue ID:   1190
Category:   Base Definitions and Headers
Type:   Clarification Requested
Severity:   Comment
Priority:   normal
Status: New
Name:   Geoff Clare 
Organization:   The Open Group 
User Reference:  
Section:9.3.5 
Page Number:184 
Line Number:6089 
Interp Status:  --- 
Final Accepted Text: 
== 
Date Submitted: 2018-04-13 11:16 UTC
Last Modified:  2018-04-16 16:27 UTC
== 
Summary:backslash has two special meanings in the shell and
only loses one of them in bracket expressions
== 

-- 
 (0003965) stephane (reporter) - 2018-04-16 16:27
 http://austingroupbugs.net/view.php?id=1190#c3965 
-- 
Re: http://austingroupbugs.net/view.php?id=1190#c3963

Hmmm. Looks like pattern='\\*' is yet another different case with different
differences between shells.

In Bourne/ksh88/mksh/yash/FreeBSD-sh, it matches on \\anything (as I'd
expect), with dash, ksh93, bash, zsh, it matches on \anything instead.

For busybox-sh, I see two different behaviours with 2 different versions.

Note that as per your proposed text, if I understand correctly, bash and
zsh would not be compliant as with pattern='[\]*', they match on []anything
instead of \anything. 

Issue History 
Date ModifiedUsername   FieldChange   
== 
2018-04-13 11:16 geoffclare New Issue
2018-04-13 11:16 geoffclare Name  => Geoff Clare 
2018-04-13 11:16 geoffclare Organization  => The Open Group  
2018-04-13 11:16 geoffclare Section   => 9.3.5   
2018-04-13 11:16 geoffclare Page Number   => 184 
2018-04-13 11:16 geoffclare Line Number   => 6089
2018-04-13 11:16 geoffclare Interp Status => --- 
2018-04-13 11:18 geoffclare Desired Action Updated   
2018-04-13 12:39 kreNote Added: 0003954  
2018-04-13 13:47 geoffclare Note Added: 0003955  
2018-04-14 17:17 stephane   Note Added: 0003957  
2018-04-16 08:31 geoffclare Note Added: 0003958  
2018-04-16 09:23 geoffclare Note Added: 0003959  
2018-04-16 09:25 geoffclare Note Edited: 0003959 
2018-04-16 11:06 stephane   Note Added: 0003960  
2018-04-16 11:10 stephane   Note Edited: 0003960 
2018-04-16 11:12 stephane   Note Edited: 0003960 
2018-04-16 11:21 stephane   Note Added: 0003961  
2018-04-16 11:22 stephane   Note Edited: 0003961 
2018-04-16 11:27 stephane   Note Edited: 0003961 
2018-04-16 11:45 stephane   Note Added: 0003962  
2018-04-16 12:18 stephane   Note Edited: 0003962 
2018-04-16 12:22 stephane   Note Edited: 0003962 
2018-04-16 14:41 geoffclare Note Added: 0003963  
2018-04-16 14:50 geoffclare Note Edited: 0003959 
2018-04-16 14:52 geoffclare Note Added: 0003964  
2018-04-16 16:27 stephane   Note Added: 0003965  
==




[1003.1(2016)/Issue7+TC2 0001190]: backslash has two special meanings in the shell and only loses one of them in bracket expressions

2018-04-16 Thread Austin Group Bug Tracker

A NOTE has been added to this issue. 
== 
http://austingroupbugs.net/view.php?id=1190 
== 
Reported By:geoffclare
Assigned To:
== 
Project:1003.1(2016)/Issue7+TC2
Issue ID:   1190
Category:   Base Definitions and Headers
Type:   Clarification Requested
Severity:   Comment
Priority:   normal
Status: New
Name:   Geoff Clare 
Organization:   The Open Group 
User Reference:  
Section:9.3.5 
Page Number:184 
Line Number:6089 
Interp Status:  --- 
Final Accepted Text: 
== 
Date Submitted: 2018-04-13 11:16 UTC
Last Modified:  2018-04-16 16:57 UTC
== 
Summary:backslash has two special meanings in the shell and
only loses one of them in bracket expressions
== 

-- 
 (0003966) joerg (reporter) - 2018-04-16 16:57
 http://austingroupbugs.net/view.php?id=1190#c3966 
-- 
Could you please present a reproducable script to verify your claims and
could you please mention which ksh93 version you are testing? 

Issue History 
Date ModifiedUsername   FieldChange   
== 
2018-04-13 11:16 geoffclare New Issue
2018-04-13 11:16 geoffclare Name  => Geoff Clare 
2018-04-13 11:16 geoffclare Organization  => The Open Group  
2018-04-13 11:16 geoffclare Section   => 9.3.5   
2018-04-13 11:16 geoffclare Page Number   => 184 
2018-04-13 11:16 geoffclare Line Number   => 6089
2018-04-13 11:16 geoffclare Interp Status => --- 
2018-04-13 11:18 geoffclare Desired Action Updated   
2018-04-13 12:39 kreNote Added: 0003954  
2018-04-13 13:47 geoffclare Note Added: 0003955  
2018-04-14 17:17 stephane   Note Added: 0003957  
2018-04-16 08:31 geoffclare Note Added: 0003958  
2018-04-16 09:23 geoffclare Note Added: 0003959  
2018-04-16 09:25 geoffclare Note Edited: 0003959 
2018-04-16 11:06 stephane   Note Added: 0003960  
2018-04-16 11:10 stephane   Note Edited: 0003960 
2018-04-16 11:12 stephane   Note Edited: 0003960 
2018-04-16 11:21 stephane   Note Added: 0003961  
2018-04-16 11:22 stephane   Note Edited: 0003961 
2018-04-16 11:27 stephane   Note Edited: 0003961 
2018-04-16 11:45 stephane   Note Added: 0003962  
2018-04-16 12:18 stephane   Note Edited: 0003962 
2018-04-16 12:22 stephane   Note Edited: 0003962 
2018-04-16 14:41 geoffclare Note Added: 0003963  
2018-04-16 14:50 geoffclare Note Edited: 0003959 
2018-04-16 14:52 geoffclare Note Added: 0003964  
2018-04-16 16:27 stephane   Note Added: 0003965  
2018-04-16 16:39 stephane   Note Edited: 0003965 
2018-04-16 16:57 joerg  Note Added: 0003966  
==




[1003.1(2016)/Issue7+TC2 0001192]: Formally obsolete the DES encryption functions 'encrypt' and 'setkey'

2018-04-16 Thread Austin Group Bug Tracker

The following issue has been SUBMITTED. 
== 
http://austingroupbugs.net/view.php?id=1192 
== 
Reported By:zackw
Assigned To:
== 
Project:1003.1(2016)/Issue7+TC2
Issue ID:   1192
Category:   System Interfaces
Type:   Enhancement Request
Severity:   Comment
Priority:   normal
Status: New
Name:   Zack Weinberg 
Organization:   GNU 
User Reference:  
Section:XSH encrypt, setkey; XBD unistd.h, stdlib.h 
Page Number:unknown 
Line Number:unknown 
Interp Status:  --- 
Final Accepted Text: 
== 
Date Submitted: 2018-04-16 18:39 UTC
Last Modified:  2018-04-16 18:39 UTC
== 
Summary:Formally obsolete the DES encryption functions
'encrypt' and 'setkey'
Description: 

The functions 'encrypt' and 'setkey' can be used together to encrypt or
decrypt a single block (64 bits) of data with the DES block cipher.  (The
cipher is not actually specified in POSIX, but interoperability dictates
the use of DES.)

These functions should not be used in new applications for several reasons.
 Most importantly, the DES block cipher has been obsolete for many years
(quoting RFC 4772 , "For many years
now, DES usage has been actively discouraged by the security area of the
IETF" -- that was 2006).  Also, they are not thread safe; they can only
encrypt or decrypt a single 64-bit block of data, requiring programmers to
implement an "mode of operation" by hand if they want to process more data
than that; they use an awkward one-bit-per-byte representation of their
input and output; and decryption is only optionally available.

I request that these functions be formally obsoleted and, in due course,
removed from the standard.

I also recommend that the CRYPT option group change its full name to
"Password Hashing Option Group", as the sole non-obsolescent function in
that group is crypt(), which performs password hashing.
Desired Action: 
# Obsoletion of encrypt and setkey

XSH 'encrypt':
  SYNOPSIS: Change the margin code from XSI to OB XSI.
  APPLICATION USAGE: Change the first paragraph from "Historical
implementations
of the encrypt() function used a rather primitive encoding algorithm."
to
"The encrypt() function historically used the DES block cipher, which
is
no longer considered secure."
  FUTURE DIRECTIONS: Change text from "A future version of the standard
may mark this interface as obsolete or remove it altogether" to "The
encrypt() function may be removed in a future version."
  CHANGE HISTORY:
Add "The encrypt() function is marked obsolescent."

XSH 'setkey':
  SYNOPSIS: Change the margin code from XSI to OB XSI.
  FUTURE DIRECTIONS: Change text from "A future version of the standard
may mark this interface as obsolete or remove it altogether" to "The
setkey() function may be removed in a future version."
  CHANGE HISTORY:
Add "The setkey() function is marked obsolescent."

XBD 'unistd.h':
  Change the margin code for the declaration of encrypt() from XSI to OB
XSI.

XBD 'stdlib.h':
  Change the margin code for the declaration of setkey() from XSI to OB
XSI.

XBD chapter 2 section 2.1.5 ("Option Groups") subsection "Encryption":
  Change the list of functions included in the Encryption Option Group
from

crypt(), encrypt(), setkey()

  to

crypt(), [OB XSI> encrypt(), setkey()  Zack Weinberg   
2018-04-16 18:39 zackw  Organization  => GNU 
2018-04-16 18:39 zackw  Section   => XSH encrypt,
setkey; XBD unistd.h, stdlib.h
2018-04-16 18:39 zackw  Page Number   => unknown 
2018-04-16 18:39 zackw  Line Number   => unknown 
==




[1003.1(2016)/Issue7+TC2 0001190]: backslash has two special meanings in the shell and only loses one of them in bracket expressions

2018-04-16 Thread Austin Group Bug Tracker

A NOTE has been added to this issue. 
== 
http://austingroupbugs.net/view.php?id=1190 
== 
Reported By:geoffclare
Assigned To:
== 
Project:1003.1(2016)/Issue7+TC2
Issue ID:   1190
Category:   Base Definitions and Headers
Type:   Clarification Requested
Severity:   Comment
Priority:   normal
Status: New
Name:   Geoff Clare 
Organization:   The Open Group 
User Reference:  
Section:9.3.5 
Page Number:184 
Line Number:6089 
Interp Status:  --- 
Final Accepted Text: 
== 
Date Submitted: 2018-04-13 11:16 UTC
Last Modified:  2018-04-16 20:11 UTC
== 
Summary:backslash has two special meanings in the shell and
only loses one of them in bracket expressions
== 

-- 
 (0003967) stephane (reporter) - 2018-04-16 20:11
 http://austingroupbugs.net/view.php?id=1190#c3967 
-- 
Re: http://austingroupbugs.net/view.php?id=1190#c3966

That was ksh93u+ on Ubuntu 16.04 amd64.

Try for instance

#! /usr/bin/env bash
export PATTERN STRING
set -o noglob
while read -r PATTERN strings; do
  printf '\n%s\n' "$PATTERN"
  for shell do
printf ' %12s[1]:' "$shell"
for STRING in $strings; do
  (exec -a sh "$shell" -c 'case $STRING in $PATTERN) ;; *) exit 1;
esac') &&
printf ' %s' "$STRING"
done
printf '\n %12s[2]:' "$shell"
for STRING in $strings; do
  (exec -a sh "$shell" -c "case \$STRING in $PATTERN) ;; *) exit 1;
esac") &&
printf ' %s' "$STRING"
done
echo
  done
done << 'EOF'
[\]* \anything []anything [\]anything [\]* [\\]* *
[\\]* \anything []anything [\]anything [\]* [\\]* *
\*   \anything anything \*  *
\\*  \anything \\anything \\* \* *
EOF


To run as

that-script dash bash ksh93 mksh posh yash zsh busybox schily-sh


FWIW, your schily-sh (along with ksh88 which gives the same results) is the
one that gives results closest to what I would expect (except for the
last-resort equality comparison). 

Issue History 
Date ModifiedUsername   FieldChange   
== 
2018-04-13 11:16 geoffclare New Issue
2018-04-13 11:16 geoffclare Name  => Geoff Clare 
2018-04-13 11:16 geoffclare Organization  => The Open Group  
2018-04-13 11:16 geoffclare Section   => 9.3.5   
2018-04-13 11:16 geoffclare Page Number   => 184 
2018-04-13 11:16 geoffclare Line Number   => 6089
2018-04-13 11:16 geoffclare Interp Status => --- 
2018-04-13 11:18 geoffclare Desired Action Updated   
2018-04-13 12:39 kreNote Added: 0003954  
2018-04-13 13:47 geoffclare Note Added: 0003955  
2018-04-14 17:17 stephane   Note Added: 0003957  
2018-04-16 08:31 geoffclare Note Added: 0003958  
2018-04-16 09:23 geoffclare Note Added: 0003959  
2018-04-16 09:25 geoffclare Note Edited: 0003959 
2018-04-16 11:06 stephane   Note Added: 0003960  
2018-04-16 11:10 stephane   Note Edited: 0003960 
2018-04-16 11:12 stephane   Note Edited: 0003960 
2018-04-16 11:21 stephane   Note Added: 0003961  
2018-04-16 11:22 stephane   Note Edited: 0003961 
2018-04-16 11:27 stephane   Note Edited: 0003961 
2018-04-16 11:45 stephane   Note Added: 0003962  
2018-04-16 12:18 stephane   Note Edited: 0003962 
2018-04-16 12:22 stephane   Note Edited: 0003962 
2018-04-16 14:41 geoffclare Note Added: 0003963  
2018-04-16 14:50 geoffclare Note Edited: 0003959 
2018-04-16 14:52 geoffclare Note Added: 0003964  
2018-04-16 16:27 stephane   Note Added: 0003965  
2018-04-16