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

Re: zsh completion for umount



On Oct 30,  8:38pm, Fourhundred Thecat wrote:
}
} When I remove everything from .zshrc, and only leave following two lines:
} 
}   autoload -Uz compinit
}   compinit -D
} 
} then completion for mount -o <TAB> starts working, same as you describe.
} That is great progress. But umount m<TAB> still does not complete, nor
} does umount ./m<TAB>

Curious that no one has noticed this before.

Completion for mount / umount works fine as long as you're completing
full paths, either to device files or to mount points.

However, the _canonical_paths function that's used to convert strings
on the command line into the One True Path to either such a device or
mount point, is somewhat deficient when it tries to compare a relative
path to the canonical path, as is necessary to complete the path tail
when the current directory is already part of the canonical path.

I don't have any more time to chase this now, but briefly in case
someone else wants to pick it up:

"_canonical_paths_add_path $PREFIX" is called which, if prefix is not
empty, tries calling zstat to see if it is a real file.  Of course
this fails because it's not a file, it's only a prefix of a filename,
so _canonical_paths_get_canonical_path is NOT called, and the path
from the current directory is not discovered.  The upshot is that
_canonical_paths_add_path only does anything useful if the prefix
on the command line is either already a device or mountpoint, or is
the name of a directory in the partial path to one.

If you try to trick it as Daniel suggested by adding "./", things
are only slightly better in _canonical_paths, but then go sideways
later:  the bug discussed earlier this year, in which the current
prefix is erased but nothing replaces it, affects this completion.



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