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


Groups > gnu.bash.bug > #15669

Re: quote removal issues within character class

From Chet Ramey <chet.ramey@case.edu>
Newsgroups gnu.bash.bug
Subject Re: quote removal issues within character class
Date 2019-11-13 09:56 -0500
Message-ID <mailman.1342.1573657027.13325.bug-bash@gnu.org> (permalink)
References <CAH7i3LrZFvJ1ELJzTdQzF1tTqhi9FDrA7xWWYWrd4RgWJs0Wtg@mail.gmail.com> <68562615-8764-3b33-37d7-d07355a37292@case.edu>

Show all headers | View raw


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/

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web