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

Re: [BUGREPORT] zsh-4.0.4 (i686-pc-linux-gnu)



Peter Stephenson wrote:

> monbil_f@xxxxxxxx wrote:
> > morpheus# chgrp adm kern.log
> > _path_files:340: unknown group
> > morpheus# chgrp adm kern.log
> > 
> > when i tab after kern.log and a space in order to choose another file to
> > chgrp.
> 
> What's happening is that it's trying to complete files which aren't
> already owned by the group `adm'.  So the file completion code in
> _path_files uses a pattern for that purpose.  It then complains if the
> group `adm' doesn't exist.  However, it should only do that if the group
> adm *really* doesn't exist on your system.  Are you sure it does?  In
> which case the problem is somewhere inside zsh, to do with its interface
> with the system commands for reading groups.

I can't see much the completion code can do besides trying to keep
globbing quiet (in _path_files) and checking if the group exists (in
_chown). That stuff in _chown could be improved, obviously.


Bye
  Sven

Index: Completion/Unix/Command/_chown
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_chown,v
retrieving revision 1.6
diff -u -r1.6 _chown
--- Completion/Unix/Command/_chown	22 Jan 2002 10:22:48 -0000	1.6
+++ Completion/Unix/Command/_chown	2 Jul 2002 14:03:53 -0000
@@ -1,6 +1,6 @@
 #compdef chown chgrp
 
-local suf usr grp req expl line
+local suf usr grp req line
 
 line=( "${(@)words[2,CURRENT-1]:#-*}" )
 
@@ -33,6 +33,9 @@
   req=( ${usr:+\^u$usr} ${grp:+\^g$grp} )
   (( EUID )) && req=( u$EUID$^req )
   req=( -$^req )
+  req="*(${(j:,:)req})"
 
-  _wanted files expl file _files -g "*(${(j:,:)req})" && return 0
+  ( : $~req ) 2> /dev/null || req='*'
+
+  _files -g "$req" && return 0
 fi
Index: Completion/Unix/Type/_path_files
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/_path_files,v
retrieving revision 1.18
diff -u -r1.18 _path_files
--- Completion/Unix/Type/_path_files	29 May 2002 15:05:24 -0000	1.18
+++ Completion/Unix/Type/_path_files	2 Jul 2002 14:03:53 -0000
@@ -338,7 +338,7 @@
     else
       compfiles -p$cfopt tmp1 accex "$skipped" "$_matcher $matcher[2]" '' fake "$pats[@]"
     fi
-    tmp1=( $~tmp1 )
+    tmp1=( $~tmp1 ) 2> /dev/null
 
     if [[ -n "$PREFIX$SUFFIX" ]]; then
       # See which of them match what's on the line.

-- 
Sven Wischnowsky                          wischnow@xxxxxxxxx



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