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

Re: umount completion context and tags



On Sun, Dec 14, 2014 at 5:53 PM, Bart Schaefer
<schaefer@xxxxxxxxxxxxxxxx> wrote:
> [Sticking with zsh-users for now but this maybe should move to -workers]
>
> On Dec 14,  4:15pm, Mikael Magnusson wrote:
> } Subject: Re: umount completion context and tags
> }
> } >     umount u<Tab>
> } >     umount udev  (!!!)
> }
> } That's weird in at least two ways. I get the style to work only if i
> } make it ":completion:*".
>
> See previous message about :(u|)mount: ...?

Yeah, I somehow missed this missing u. It works fine if I add it again.

> } Secondly, those are filesystem types, not labels, and are only valid
> } after -t afaik(?), and umount -t produces a broken completion.
>
> Hmm.  On the latter point, "umount -t" works for me:

Sorry, I should have been more specific than just saying it's broken.
It produces this output for me:

% umount -t
---- file system type
\#                 auto\'       following  mqueue    to
\#vfat             available    fuse       msdos     try
[...]

I see now that the gentoo /etc/filesystems has some lines in it with
comments, and the completer doesn't remove them. How about instead of
this,

fss+=( ${$(</etc/filesystems)#\*} )

we use this?

fss+=( ${${${(f)"$(</etc/filesystems)"}:#\#*}#\*} )

> On the former point, I get:
>
> torch% umount u<TAB>
> torch% umount usbfs
>
> Looking at _complete_debug output, usbfs is being completed as a device
> label because there are no matches to "u" for either device-paths or
> directories.  The tag-order '!' style only applies when the other tags
> do have possible matches.

Here, you can use - as the first element of tag-order as
zstyle ':completion:*:umount:*' tag-order - '! device-labels'
and device-labels will never be used, not even as a fallback.

> Now, as to WHY it's being completed as a label, it's because /etc/mtab
> has the line
>
> usbfs /proc/bus/usb usbfs rw 0 0
>
> so _mount assigns
>
> dev_tmp=( /dev/hda2 usbfs /dev/hda1 sunrpc )
>
> which subsquently interprets everything that doesn't start with a slash
> as a device label.

I'm not even sure here what a device label is meant to be. I don't
suppose it's something mounted by LABEL=foo? My mount manpage mentions
partition labels, filesystem labels (and I know these are only
readable by root), and also 'those that are labeled "nodev"' appears.

-- 
Mikael Magnusson



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