zsh-workers
 help / color / mirror / code / Atom feed
* _libvirt, $opt_args, and noglob
@ 2016-09-04 18:26 Daniel Shahaf
  2016-09-06 23:46 ` Daniel Shahaf
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Shahaf @ 2016-09-04 18:26 UTC (permalink / raw)
  To: zsh-workers; +Cc: Marko Myllynen

The question mark in «noglob virsh -c foo://bar?» is interpreted by the
_call_program subshell as a pattern, causing _libvirt to fail to find
completions:

(setup)
% zstyle :completion:\*:warnings format 'No matches: %D'    
% functions -T $_comps[libvirt]

% noglob virsh -c qemu:///system? start --domain <TAB>
⋮
+_libvirt:142> values=+_libvirt:142> _call_program domains 'virsh -c qemu\:///system? list --inactive --name'
+_libvirt:142> values=( ) 
No matches: cmdopt

Now create a filename that matches that globbing pattern and try the
command again:

% noglob mkdir -p ./qemu:/system?
% noglob virsh -c qemu:///system? start --domain <TAB>
<works>

I believe the reason it works is that the globbing pattern «qemu:///system?»
gets expanded into the filename «qemu:/system?», which happens to work
just fine as an argument to «virsh -c».

(The backslash in front of the colon here is an independent problem, see 39158.)

In the special case of _libvirt, simply adding noglob to the
_call_program arguments would probably fix this.  This might not work
for arbitrary other callsites, though.  I think the general fix would be
to backslash-escape the characters that "need escaping only when noglob
is not present".  (Neither (q) nor (b) do this since both of them escape
backslashes.)

Cheers,

Daniel


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-09-07 22:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-04 18:26 _libvirt, $opt_args, and noglob Daniel Shahaf
2016-09-06 23:46 ` Daniel Shahaf
2016-09-07  9:53   ` Marko Myllynen
2016-09-07 22:42     ` Daniel Shahaf

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).