On Tue, Jun 27, 2006 at 03:00:46PM -0400, Justin Pryzby wrote:
>I'd forgotten or didn't know that dpkg-query did globs. Should a
>pattern with '[' without a closing ']' be treated as invalid? I guess
>since the shell doesn't, fnmatch doesn't, so dpkg can't... Is this
>correct?
The shell handles glob expansion failure by falling back to using the
literal value.
We could do something similar for --search (see patch following),
although note that while this means that '-S /usr/bin/[' now works,
'-S [' will not.
It also doubles the comparisions required against every non-matching
file.
--bod
--- dpkg-1.13.22.orig/src/query.c 2006-06-02 13:45:21.000000000 +1000
+++ dpkg-1.13.22/src/query.c 2006-06-29 17:28:50.561965098 +1000
@@ -294,7 +294,9 @@
} else {
it= iterfilestart();
while ((namenode= iterfilenext(it)) != 0) {
- if (fnmatch(thisarg,namenode->name,0)) continue;
+ if (fnmatch(thisarg,namenode->name,0) &&
+ strcmp(thisarg,namenode->name))
+ continue;
found+= searchoutput(namenode);
}
iterfileend(it);
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]