Re: [PATCH v2] expand: Do not quote backslashes in unquoted parameter expansion

2018-03-28 Thread Herbert Xu
On Thu, Mar 29, 2018 at 07:29:12AM +0200, Harald van Dijk wrote: > > You're right that what other shells implement doesn't allow any possibility > of unescaped backslashes in the shell. But if what they do is what's Well the only shell that does allow it is bash and its behaviour is inconsistent a

Re: [PATCH v2] expand: Do not quote backslashes in unquoted parameter expansion

2018-03-28 Thread Harald van Dijk
On 3/29/18 6:42 AM, Herbert Xu wrote: On Wed, Mar 28, 2018 at 03:06:32PM +0200, Harald van Dijk wrote: Since bash itself is inconsistent, and POSIX unclear, What exactly is unclear about the sentence of POSIX that I quoted? Is there a legitimate interpretation of "It is unspecified whether A

Re: [PATCH v2] expand: Do not quote backslashes in unquoted parameter expansion

2018-03-28 Thread Herbert Xu
On Wed, Mar 28, 2018 at 03:06:32PM +0200, Harald van Dijk wrote: > > >Since bash itself is inconsistent, and POSIX unclear, > What exactly is unclear about the sentence of POSIX that I quoted? Is there > a legitimate interpretation of "It is unspecified whether A or B" that > allows other behaviour

Re: [PATCH v2] expand: Do not quote backslashes in unquoted parameter expansion

2018-03-28 Thread Harald van Dijk
On 28/03/2018 13:00, Herbert Xu wrote: On Wed, Mar 28, 2018 at 12:53:31PM +0200, Harald van Dijk wrote: [un-snip] If a pattern ends with an unescaped , it is unspecified whether the pattern does not match anything or the pattern is treated as invalid. I don't think this allows dash's beh

Re: [PATCH v2] expand: Do not quote backslashes in unquoted parameter expansion

2018-03-28 Thread Herbert Xu
On Wed, Mar 28, 2018 at 12:53:31PM +0200, Harald van Dijk wrote: > > I don't think this allows dash's behaviour of taking the backslash as a > literal, since that still allows a match to succeed. bash lets such a > pattern never match. In other shells, there is no way to get into this > situation,

Re: [PATCH v2] expand: Do not quote backslashes in unquoted parameter expansion

2018-03-28 Thread Harald van Dijk
On 28/03/2018 12:37, Herbert Xu wrote: On Wed, Mar 28, 2018 at 12:03:24PM +0200, Harald van Dijk wrote: When expanded backslashes are no longer treated as quoted, this would call expmeta() with the pattern *\, that is with a single unquoted trailing backslash, so: [...] Thanks for the explana