tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: shell (/bin/sh) pattern matching bugs
Hello,
About the POSIX description "2.13.1 Patterns Matching a Single
Character", have the draft assigned a precedence between "XBD RE Bracket
Expression" and the shell behavior, i.e. "XBD RE Bracket"
taking precedence over the shell behavior?
Because one might interpret the reference to "XBD RE Bracket" as voiding
the quoting dance inside a bracket expression, since in a RE the special
characters loose their special meaning, and one could argue, it seems,
that this is the case for the double quotes too? (Unfortunately, the
shell description re-introduce the quoting in the mention "with an
unquoted <circumflex>" and the last alinea "When pattern matching is
used where shell quote removal is not performed..." makes my limited
english grammar parser bug: I don't understand how one can, at the same
time, speak about quoting for removing special meaning, speak about
the keeping of the quotes and adding that the characters have to be, in
this context, escaped to loose their special meaning; my french
mind interprets this as the double quotes are still there but are
ordinary characters so in '["[:alpha:]"]' there is a redundancy of
the ordinary '"' character...; who is responsible for "escaping": the
user, or the shell developer? In my mind, the user...)
This doesn't "solve" all the problems, but if the majority of the
implementations are more on less on the same side (applying normal
shell substitutions rules and quote removal except in the find()
and fnmatch() before interpreting the patterns), the POSIX wording,
as you have already explained, should be adjusted to the de facto
uses and not the reverse, and the actual version of the shell you
maintain would not have to try to be compliant with a specification
that, as is, is not "regular"---more exceptions than rules, which
is a bit surprising in "regular" expressions...
Best regards,
--
Thierry Laronde <tlaronde +AT+ polynum +dot+ com>
http://www.kergis.com/
http://www.sbfa.fr/
Key fingerprint = 0FF7 E906 FBAF FE95 FD89 250D 52B1 AE95 6006 F40C
Home |
Main Index |
Thread Index |
Old Index