Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #15669 > unrolled thread

Re: quote removal issues within character class

Started byChet Ramey <chet.ramey@case.edu>
First post2019-11-13 09:56 -0500
Last post2019-11-13 09:56 -0500
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: quote removal issues within character class Chet Ramey <chet.ramey@case.edu> - 2019-11-13 09:56 -0500

#15669 — Re: quote removal issues within character class

FromChet Ramey <chet.ramey@case.edu>
Date2019-11-13 09:56 -0500
SubjectRe: quote removal issues within character class
Message-ID<mailman.1342.1573657027.13325.bug-bash@gnu.org>
On 11/8/19 4:50 PM, Oğuz wrote:
> v=foo
> echo ${v#[[:"lower":]]}
> 
> should print oo, but it prints foo instead. This is reproducible on bash
>> 4.4
> 
> Plus
> 
> case foo in (*[![:"lower":]]*) echo bar; esac
> 
> prints bar, while

The idea is that at this point in command processing, quote removal hasn't
been performed. According to the abstract model the shell uses for word
expansions, that means the double quotes are still present in the word, and
`"lower"' is not the same as `lower'.

There was a recent extensive discussion of this and other points on the
posix mailing list, and, as kre said, the committee has decided to make
this a special case. I changed this about a month ago, and the chage is
in the devel branch.

> case foo in (*[![":lower":]]*) echo bar; esac
> 
> doesn't print anything. And this is only reproducible on bash >5.0

This is an invalid character class, since a class has to begin with the
two-character sequence `[:'. The intervening double quote causes that test
to fail (this case is not so special, it seems). The first `]' then
terminates the bracket expression, so th string has to contain at least
a `]' to have a possibility of matching.

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

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web