Re: Parameter expansion, patterns and fnmatch

2016-09-03 Thread Harald van Dijk
On 03/09/16 15:58, Herbert Xu wrote: On Sat, Sep 03, 2016 at 03:19:57PM +0200, Harald van Dijk wrote: But yeah, sure, if the bug has been there for over 10 years, and I'm unable to find older versions of dash to check, I would have guessed that dash indeed has never worked this way. OK it

Re: Parameter expansion, patterns and fnmatch

2016-09-03 Thread Harald van Dijk
On 02/09/16 16:51, Herbert Xu wrote: On Fri, Sep 02, 2016 at 09:49:53AM -0500, Eric Blake wrote: On 09/02/2016 09:29 AM, Herbert Xu wrote: On Fri, Sep 02, 2016 at 09:25:15AM -0500, Eric Blake wrote: This also affects case [a in [?) echo ok ;; *) echo bad ;; esac which should print ok.

Re: Parameter expansion, patterns and fnmatch

2016-09-02 Thread Chet Ramey
On 9/2/16 10:46 AM, Herbert Xu wrote: > On Fri, Sep 02, 2016 at 09:25:15AM -0500, Eric Blake wrote: >> >> 2.13.1 Patterns Matching a Single Character >> >> [ >> If an open bracket introduces a bracket expression as in XBD RE >> Bracket Expression, except that the character ( '!' ) >> shall

Re: Parameter expansion, patterns and fnmatch

2016-09-02 Thread Jilles Tjoelker
On Fri, Sep 02, 2016 at 10:04:37PM +0800, Herbert Xu wrote: > Harald van Dijk wrote: > > Yes, this looks like a bug in dash. With the default --disable-fnmatch > > code, when dash encounters [ in a pattern, it immediately treats the > > following characters as part of the

Re: Parameter expansion, patterns and fnmatch

2016-09-02 Thread Eric Blake
On 09/02/2016 09:46 AM, Herbert Xu wrote: > On Fri, Sep 02, 2016 at 09:25:15AM -0500, Eric Blake wrote: >> >> 2.13.1 Patterns Matching a Single Character >> >> [ >> If an open bracket introduces a bracket expression as in XBD RE >> Bracket Expression, except that the character ( '!' ) >>

Re: Parameter expansion, patterns and fnmatch

2016-09-02 Thread Herbert Xu
On Fri, Sep 02, 2016 at 09:49:53AM -0500, Eric Blake wrote: > On 09/02/2016 09:29 AM, Herbert Xu wrote: > > On Fri, Sep 02, 2016 at 09:25:15AM -0500, Eric Blake wrote: > >> > This also affects > > case [a in [?) echo ok ;; *) echo bad ;; esac > > which should print ok.

Re: Parameter expansion, patterns and fnmatch

2016-09-02 Thread Eric Blake
On 09/02/2016 09:29 AM, Herbert Xu wrote: > On Fri, Sep 02, 2016 at 09:25:15AM -0500, Eric Blake wrote: >> This also affects case [a in [?) echo ok ;; *) echo bad ;; esac which should print ok. >>> >>> Even ksh prints bad here. >> >> So ksh is also buggy. > > Good

Re: Parameter expansion, patterns and fnmatch

2016-09-02 Thread Herbert Xu
On Fri, Sep 02, 2016 at 09:25:15AM -0500, Eric Blake wrote: > > 2.13.1 Patterns Matching a Single Character > > [ > If an open bracket introduces a bracket expression as in XBD RE > Bracket Expression, except that the character ( '!' ) > shall replace the character ( '^' ) in its role in a

Re: Parameter expansion, patterns and fnmatch

2016-09-02 Thread Herbert Xu
On Fri, Sep 02, 2016 at 09:25:15AM -0500, Eric Blake wrote: > > >> This also affects > >> > >> case [a in [?) echo ok ;; *) echo bad ;; esac > >> > >> which should print ok. > > > > Even ksh prints bad here. > > So ksh is also buggy. Good luck writing a script with an unquoted [ expecting

Re: Parameter expansion, patterns and fnmatch

2016-09-02 Thread Eric Blake
On 09/02/2016 09:04 AM, Herbert Xu wrote: >> Yes, this looks like a bug in dash. With the default --disable-fnmatch >> code, when dash encounters [ in a pattern, it immediately treats the >> following characters as part of the set. If it then encounters the end >> of the pattern without having

Re: Parameter expansion, patterns and fnmatch

2016-08-17 Thread Olof Johansson
On 2016-08-09 23:39 +0200, Harald van Dijk wrote: > Yes, this looks like a bug in dash. With the default > --disable-fnmatch code, when dash encounters [ in a pattern, it > immediately treats the following characters as part of the set. If > it then encounters the end of the pattern without having