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

[PATCH] Completion: Don't prepend SIG to numeric signals in _signals



On the subject of _signals, an issue i noticed is that sometimes zsh doesn't
have the symbolic name for all signals.* `_signals -s` doesn't account for this,
and produces weird results like 'SIG16'. Technically most tools that deal with
signals will accept these, since they just blindly strip off the 'SIG' and use
whatever's left over, but it's weird and AFAIK any support for them is
incidental and undocumented. I think they should be filtered out.

* Ubuntu's zsh 5.4 is missing symbolic names for SIGSTKFLT and SIGPWR. If i
  build from source, they're there, and the scripts that generate the signals
  basically haven't changed in 20 years... so i'm not sure what's up with that.
  Maybe the system that Ubuntu used to build zsh had weird headers.

PS: I noticed that zsh doesn't even *know* about SIGRTMIN through SIGRTMAX
(they're neither listed in $signals nor accepted by kill), probably because
they're defined weirdly in the headers. bash and procps both do, though
`/bin/kill -l` doesn't show them. I might see if they're easy to add.

dana


diff --git a/Completion/Unix/Type/_signals b/Completion/Unix/Type/_signals
index df9a2f339..ffb01eba0 100644
--- a/Completion/Unix/Type/_signals
+++ b/Completion/Unix/Type/_signals
@@ -36,7 +36,7 @@ if [[ -z "$minus" ]] ||
   fi
 
   if [[ -n "$pre" && $PREFIX = ${minus}S* ]]; then
-    sigs=( "${minus}SIG${(@)^signals[first,last]}" )
+    sigs=( "${minus}SIG${(@)^${(@)signals[first,last]:#<->}}" )
     (( $#disp )) && tmp=( "$tmp[@]" "${(@)signals[first,last]}" )
   else
     sigs=()



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