Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Bug#482662: zsh: completion with locate gives extra output



On Sat, 24 May 2008 20:21:35 +0000
Clint Adams <schizo@xxxxxxxxxx> wrote:
> On Sat, May 24, 2008 at 10:16:56PM +0530, Sykora wrote:
> > I just typed "locate" at the prompt and pressed space, followed by tab. 
> > 
> > 
> > $> locate Usage: locate [-d path | --database=path] [-e | -E | --[non-]existing]
> >       [-i | --ignore-case] [-w | --wholename] [-b | --basename] 
> >       [--limit=N | -l N] [-S | --statistics] [-0 | --null] [-c | --count]
> >       [-P | -H | --nofollow] [-L | --follow] [-m | --mmap ] [ -s | --stdio ]
> >       [-A | --all] [-p | --print] [-r | --regex ] [--regextype=TYPE]
> >       [--max-database-age D] [--version] [--help]
> >       pattern...
> > 
> > Report bugs to <bug-findutils@xxxxxxx>.
> > <CURSOR HERE>
> 
> Ah, okay. You are using GNU locate and I am using mlocate.
> 
> So _locate is trying to match *(#i)gnu locate*, which does not appear in the
> `locate -V` output (nor does it appear in the `locate --version` output).
> Does anyone have an older version of findutils handy? Would matching for
> *findutils* or (#i)*findutils*gnu* cover all possibilities?

Presumably also copying stderr to stdout.

Index: Completion/Unix/Command/_locate
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_locate,v
retrieving revision 1.2
diff -u -r1.2 _locate
--- Completion/Unix/Command/_locate	11 Feb 2008 16:28:30 -0000	1.2
+++ Completion/Unix/Command/_locate	25 May 2008 14:50:52 -0000
@@ -11,7 +11,7 @@
   ;;
 
   (locate)
-  input="$(_call_program locate $words[1] -V)"
+  input="$(_call_program locate $words[1] -V 2>&1)"
   case $input in
     (*mlocate*)
     ltype=mlocate
@@ -21,7 +21,7 @@
     ltype=slocate
     ;;
 
-    (*(#i)gnu locate*)
+    (*(#i)gnu locate*|*findutils*gnu*)
     ltype=gnu
     ;;
 

-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/



Messages sorted by: Reverse Date, Date, Thread, Author