Processed: Re: Bug#375506: dpkg --search needs more escaping

2007-07-02 Thread Debian Bug Tracking System
Processing commands for [EMAIL PROTECTED]:

 tag 375506 - patch
Bug#375506: dpkg --search needs more escaping
Tags were: patch
Tags removed: patch

 thanks
Stopping processing here.

Please contact me if you need assistance.

Debian bug tracking system administrator
(administrator, Debian Bugs database)



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#375506: dpkg --search needs more escaping

2007-07-02 Thread Justin Pryzby
On Mon, Jul 02, 2007 at 06:16:31PM +0200, Frank Lichtenheld wrote:
 tag 375506 - patch
 thanks
 
 On Wed, Jul 05, 2006 at 05:41:54PM +1000, Brendan O'Dea wrote:
  On Sat, Jul 01, 2006 at 07:07:11PM +0200, Nicolas François wrote:
  On Thu, Jun 29, 2006 at 05:43:48PM +1000, Brendan O'Dea wrote:
   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.
  
  Just a variation of your patch with strstr instead of strcmp, '-S [' works.
  
  It also changes the behaviour a little.  Consider
  'dpkg -S /usr/share/man/man1/\[', which now matches the man page.
  
  Probably not a huge issue given the number of paths which actually do
  contain metacharacters, but the intent was simply to make
  'dpkg -S /full/path' work reliably (i.e. where did that file come from?).
 
 Just for the record, I would opose both patches on the ground of very
 confusing and undefined behaviour.
Also, if this is not intended to work, it's okay to close this..




Bug#375506: dpkg --search needs more escaping

2007-07-02 Thread Frank Lichtenheld
tag 375506 - patch
thanks

On Wed, Jul 05, 2006 at 05:41:54PM +1000, Brendan O'Dea wrote:
 On Sat, Jul 01, 2006 at 07:07:11PM +0200, Nicolas François wrote:
 On Thu, Jun 29, 2006 at 05:43:48PM +1000, Brendan O'Dea wrote:
  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.
 
 Just a variation of your patch with strstr instead of strcmp, '-S [' works.
 
 It also changes the behaviour a little.  Consider
 'dpkg -S /usr/share/man/man1/\[', which now matches the man page.
 
 Probably not a huge issue given the number of paths which actually do
 contain metacharacters, but the intent was simply to make
 'dpkg -S /full/path' work reliably (i.e. where did that file come from?).

Just for the record, I would opose both patches on the ground of very
confusing and undefined behaviour.

A more complete and less confusing patch would probably have to store
the original string before the leading and trailing '*' are inserted,
escape all wildcards in it, then conditionally add the '*'s and
make every match twice, one time with the escaped string.

Gruesse,
-- 
Frank Lichtenheld [EMAIL PROTECTED]
www: http://www.djpig.de/




Bug#375506: dpkg --search needs more escaping

2007-07-02 Thread Frank Lichtenheld
On Mon, Jul 02, 2007 at 12:23:33PM -0400, Justin Pryzby wrote:
 On Mon, Jul 02, 2007 at 06:16:31PM +0200, Frank Lichtenheld wrote:
  Just for the record, I would opose both patches on the ground of very
  confusing and undefined behaviour.
 Also, if this is not intended to work, it's okay to close this..

It is probably not intended to work, which doesn't mean it can't be made
to work if someone is really interested in it :)

Gruesse,
-- 
Frank Lichtenheld [EMAIL PROTECTED]
www: http://www.djpig.de/



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Processed: Re: Bug#375506: dpkg --search needs more escaping

2006-07-02 Thread Debian Bug Tracking System
Processing commands for [EMAIL PROTECTED]:

 tags 375506 patch
Bug#375506: dpkg --search needs more escaping
There were no tags set.
Tags added: patch

 thanks
Stopping processing here.

Please contact me if you need assistance.

Debian bug tracking system administrator
(administrator, Debian Bugs database)



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#375506: dpkg --search needs more escaping

2006-07-01 Thread Nicolas François
tags 375506 patch
thanks

On Thu, Jun 29, 2006 at 05:43:48PM +1000, Brendan O'Dea wrote:
 
 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.

Just a variation of your patch with strstr instead of strcmp, '-S [' works.

 It also doubles the comparisions required against every non-matching
 file.

On my box, it is only 10% slower for this dpkg call.
Maybe this patch is worth being applied.

Kind Regards,
-- 
Nekral
Index: src/query.c
===
--- src/query.c (révision 440)
+++ src/query.c (copie de travail)
@@ -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) 
+strstr(namenode-name, thisarg) == NULL)
+  continue;
 found+= searchoutput(namenode);
   }
   iterfileend(it);


Bug#375506: dpkg --search needs more escaping

2006-06-29 Thread Brendan O'Dea
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.0 +1000
+++ dpkg-1.13.22/src/query.c2006-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]



Bug#375506: dpkg --search needs more escaping

2006-06-28 Thread Justin Pryzby
On Mon, Jun 26, 2006 at 09:46:53PM +0200, Nicolas François wrote:
 Hello,
 
 On Mon, Jun 26, 2006 at 09:53:38AM -0400, Justin Pryzby wrote:
  
  $ dpkg -S /usr/bin/[
  dpkg: /usr/bin/[ not found.
  $ dpkg -S /usr/bin/\\[
  coreutils: /usr/bin/[
  
  coreutils.list:/usr/bin/[
 
 Justin, can you look at #365271.
 It is the same issue.
 
 I don't think dpkg can do much in this case, and I think this bug should
 be closed.
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?

Justin




Bug#375506: dpkg --search needs more escaping

2006-06-26 Thread Justin Pryzby
Package: dpkg
Version: 1.13.21
Severity: normal

$ dpkg -S /usr/bin/[
dpkg: /usr/bin/[ not found.
$ dpkg -S /usr/bin/\\[
coreutils: /usr/bin/[

coreutils.list:/usr/bin/[



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#375506: dpkg --search needs more escaping

2006-06-26 Thread Nicolas François
Hello,

On Mon, Jun 26, 2006 at 09:53:38AM -0400, Justin Pryzby wrote:
 
 $ dpkg -S /usr/bin/[
 dpkg: /usr/bin/[ not found.
 $ dpkg -S /usr/bin/\\[
 coreutils: /usr/bin/[
 
 coreutils.list:/usr/bin/[

Justin, can you look at #365271.
It is the same issue.

I don't think dpkg can do much in this case, and I think this bug should
be closed.

Kind Regards,
-- 
Nekral



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]