* [PATCH] fix completion for chmod/chown --reference with escaped filename
@ 2024-09-16 8:13 Philip Sequeira
0 siblings, 0 replies; only message in thread
From: Philip Sequeira @ 2024-09-16 8:13 UTC (permalink / raw)
To: zsh-workers
---
Completion/Unix/Command/_chmod | 4 ++--
Completion/Unix/Command/_chown | 6 +++---
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/Completion/Unix/Command/_chmod b/Completion/Unix/Command/_chmod
index 42e3fa63b..693f348dc 100644
--- a/Completion/Unix/Command/_chmod
+++ b/Completion/Unix/Command/_chmod
@@ -67,13 +67,13 @@ case "$variant" in
;;
esac
-_arguments -C -s -S $aopts "$args[@]" && ret=0
+_arguments -C -s -S -0 $aopts "$args[@]" && ret=0
case "$state" in
files)
if [[ -n $opt_args[--reference] ]]; then
zmodload -F zsh/stat b:zstat 2>/dev/null
- typeset -i8 ref=$(zstat +mode $opt_args[--reference])
+ typeset -i8 ref=$(zstat +mode $opt_args[--reference]:Q)
_wanted files expl file _files -g "*(-.^f${ref#??})" && ret=0
elif [[ $line[1] = [0-7]## ]]; then
_wanted files expl file _files -g "*(-.^f$line[1])" && ret=0
diff --git a/Completion/Unix/Command/_chown b/Completion/Unix/Command/_chown
index 4362d6e75..bcc6aec2f 100644
--- a/Completion/Unix/Command/_chown
+++ b/Completion/Unix/Command/_chown
@@ -71,7 +71,7 @@ case "$variant" in
esac
(( $+words[(r)--reference*] )) || args+=( '(--reference)1: :->owner' )
-_arguments -C -s -S $aopts "$args[@]" '*: :->files' && ret=0
+_arguments -C -s -S -0 $aopts "$args[@]" '*: :->files' && ret=0
case $state in
owner)
@@ -95,8 +95,8 @@ case $state in
(( $+opt_args[-h] || $+opt_args[--no-dereference] )) || deref="-"
if (( $+opt_args[--reference] )); then
zmodload -F zsh/stat b:zstat 2>/dev/null
- usr=$(zstat +uid $opt_args[--reference])
- grp=$(zstat +gid $opt_args[--reference])
+ usr=$(zstat +uid $opt_args[--reference]:Q)
+ grp=$(zstat +gid $opt_args[--reference]:Q)
_wanted files expl file _files -g "*($deref^u$usr,$deref^g$grp)" && ret=0
return ret
fi
--
2.46.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-09-16 8:16 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-16 8:13 [PATCH] fix completion for chmod/chown --reference with escaped filename Philip Sequeira
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).