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

Re: chown completion



Oliver Kiddle wrote:

> ...
> 
> For non-root users, only the groups listed by the groups command are
> completed first. I think that it is only some configurations which have
> this restriction on chown. Does anyone have any ideas on how to detect
> this?

No, sorry.

> Does the groups command work the same on other unices?

At least it does on this True 64 Unix here.

> ...
> 
> Any ideas on how it should deal with invalid users or groups? As it is,
> it displays `_path_files:330: unknown user' which isn't too bad really.

For users one could test $+userdirs[<name>].

> ...
> 
> Incidentally, if I separate the user/groups with a colon, not a dot in
> the glob, I get this message:
>     _path_files:330: bad pattern: *(^g:users

That was caused by _files which has to put backslashes before the colons
in the pattern it gets and later has to double the number of
backslashes.  There I forgot the `g' before the `s' modifier.


Bart Schaefer wrote:

> ...
>
> That line in _path_files really should be
> 
> 	eval 'tmp1=( $~tmp1 )' 2>/dev/null

Hm.  We should then at least do something like

  eval 'tmp1=( $~tmp1 )' 2>/dev/null || ...

where the `...' either returns with a non-zero value or uses _message to
say that the pattern was badly formed.  Or both.  Or make it selectable
with an option to _path_files.  Or something.


Bye
  Sven

Index: Completion/Unix/Type/_files
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/_files,v
retrieving revision 1.2
diff -u -r1.2 _files
--- Completion/Unix/Type/_files	2001/05/03 17:07:29	1.2
+++ Completion/Unix/Type/_files	2001/05/07 09:02:28
@@ -52,7 +52,7 @@
 
 tried=()
 for def in "$pats[@]"; do
-  eval "def=( ${${def:s/\\:/\\\\\\\\\\\\:}//(#b)([][()|*?^#~<>])/\\${match[1]}} )"
+  eval "def=( ${${def:gs/\\:/\\\\\\\\\\\\:}//(#b)([][()|*?^#~<>])/\\${match[1]}} )"
   for sdef in "$def[@]"; do
 
     tag="${${sdef#*[^\\]:}%%:*}"

-- 
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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