* traps specified in certain ways are output incorrectly
@ 2015-08-05 20:51 Mikael Magnusson
2015-08-06 20:31 ` Daniel Shahaf
0 siblings, 1 reply; 2+ messages in thread
From: Mikael Magnusson @ 2015-08-05 20:51 UTC (permalink / raw)
To: zsh workers
% trap a TERM; trap b SIGKILL; trap c 14; trap
Bad alias flag for signal
Bad alias flag for signal
trap -- b
trap -- c
trap -- a TERM
(The alias flag message is only printed with --enable-zsh-debug).
--
Mikael Magnusson
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: traps specified in certain ways are output incorrectly
2015-08-05 20:51 traps specified in certain ways are output incorrectly Mikael Magnusson
@ 2015-08-06 20:31 ` Daniel Shahaf
0 siblings, 0 replies; 2+ messages in thread
From: Daniel Shahaf @ 2015-08-06 20:31 UTC (permalink / raw)
To: Mikael Magnusson; +Cc: zsh workers
Mikael Magnusson wrote on Wed, Aug 05, 2015 at 22:51:51 +0200:
> % trap a TERM; trap b SIGKILL; trap c 14; trap
> Bad alias flag for signal
> Bad alias flag for signal
> trap -- b
> trap -- c
> trap -- a TERM
>
> (The alias flag message is only printed with --enable-zsh-debug).
This makes it DTRT:
diff --git a/Src/builtin.c b/Src/builtin.c
index a08a7d4..34bad03 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -6565,8 +6565,14 @@ bin_trap(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
zwarnnam(name, "undefined signal: %s", *argv);
break;
}
- if (!strcmp(sigs[sig], *argv))
+ if (idigit(**argv) ||
+ !strcmp(sigs[sig], *argv) ||
+ (!strncmp("SIG", *argv, 3) && !strcmp(sigs[sig], *argv+3))) {
+ /* The signal was specified by number or by canonical name (with
+ * or without SIG prefix).
+ */
flags = 0;
+ }
else {
/*
* Record that the signal is used under an assumed name.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-08-06 20:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-05 20:51 traps specified in certain ways are output incorrectly Mikael Magnusson
2015-08-06 20:31 ` 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).