zsh-workers
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: Mikael Magnusson <mikachu@gmail.com>
Cc: zsh workers <zsh-workers@zsh.org>
Subject: Re: traps specified in certain ways are output incorrectly
Date: Thu, 6 Aug 2015 20:31:34 +0000	[thread overview]
Message-ID: <20150806203134.GD2018@tarsus.local2> (raw)
In-Reply-To: <CAHYJk3SNvBcqMHL=vBAMVdsPNSmR2Rei8F6rZycQDLoTiEeK8A@mail.gmail.com>

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.


      reply	other threads:[~2015-08-06 20:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-05 20:51 Mikael Magnusson
2015-08-06 20:31 ` Daniel Shahaf [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150806203134.GD2018@tarsus.local2 \
    --to=d.s@daniel.shahaf.name \
    --cc=mikachu@gmail.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).