On Thursday 25 February 2010, 21:48:23 Jan Engelhardt wrote:
On Thursday 2010-02-25 21:41, Hans-Peter Jansen wrote:
and all is well, up to 13-check-invalid-provides: the test boils down to:
$ echo hylafax | grep -E "^hylafax+[[:space:]]*$" hylafax $
while this is desired here:
$ echo hylafax | grep -G "^hylafax+[[:space:]]*$" $
Using basic regex provide exactly the means of the unversioned package name check, while not tripping over the '+'. According to the man page, only ?, +, {, |, (, and ) lose their special meaning, thus:
$ echo hylafax+ | grep -G "^hylafax+[[:space:]]*$" hylafax+ $
the + is matched literally, which is desired.
echo "$input" | pcregrep '^\Q'"$pkgnamehere"'\E\s*$'
Would fix it once and for all without having to resort to awkward preescaping of pluses and so.
While I'm a big fan of your work (and already snatched some cool tricks from some of your specs ;-)), I think, that 's/-E/-G/' is going to effectively fix the issue in question _without_ any real downsides. The remaining special characters are obscure enough for package names to be ignored: [], ^, $, \ and *. Wait, while at it, is '.' allowed as such? There's no need to quote or preescape anything here: by turning the regex syntax from extended to basic, the fix is done. Quote from man 1+ grep: Basic vs Extended Regular Expressions In basic regular expressions the meta-characters ?, +, {, |, (, and ) lose their special meaning; instead use the backslashed versions \?, \+, \{, \|, \(, and \). Since these aren't needed nor desired to have this special meaning here at all. It's that simple. Some issues with your suggestion from my side: - another package dependency in the mandatory build environment - I haven't heard from pcregrep until you mentioned it (okay, my fault) - I failed to parse that expression on the first sight (okay, my fault again, \Q and \E will stop/start the special meaning of special characters, I guess...) Judge, we will have to subtract the last two, which keeps the first only... Seriously, sanity check of packaging is a major point, and that should be done as comprehensible as possible. Thanks, Pete -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org