Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
_libvirt, $opt_args, and noglob
- X-seq: zsh-workers 39172
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: _libvirt, $opt_args, and noglob
- Date: Sun, 4 Sep 2016 18:26:22 +0000
- Cc: Marko Myllynen <myllynen@xxxxxxxxxx>
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=cc:content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=Prd7qOB7MD0ENelSldOTSte/77g=; b=YebRpJ tZ0M4W31IwnTfYacedt1UIlCICqojGaX4e3TQicfwbfl8NhdN3wYakCe7u4jYT5X Sn9XkNS5oA3C0t18rzcbciFVyCwTF3nrkCgJMmI1yKeQv0ULaOlBLfUi4sJkcAcJ v0NtnoFOeRVOOqD/HiOZokSEKtymGHtYbjfnk=
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=Prd7qOB7MD0ENelSldOTSte/77g=; b=Yl9g5 Z9wkZieCQW+nmRreSHxr4c2vm+C8yTg+H5nbLdstBUl+aGyCJcLSW6y9Tz8rHpja CIbCv3y00tgKi4kUJprTBRFFh1m7dMVT7z8tq0wtXD9BDgH6byyqFSB2rrY1h3ow iEemLBZeA4XJUPW6XOJ1lYwDS/q40+ul8ZH4DM=
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author