Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: traps specified in certain ways are output incorrectly
- X-seq: zsh-workers 36008
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: Mikael Magnusson <mikachu@xxxxxxxxx>
- Subject: Re: traps specified in certain ways are output incorrectly
- Date: Thu, 6 Aug 2015 20:31:34 +0000
- Cc: zsh workers <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=nwJdIhNusRBhN0blJq5eF46ORl8=; b=nDR3U+ G4pIkTfMVkU3Ocw97evxv0RtU8bpuj/ZC47HuB/muqlStgHk9KoXqAuZU6ZeO+0a wQn/XdVOy2albfgsZlTa3+maAfoSSb0oabdZAf80Y9JV5szAH+m4CYgLUgKTatmo Oxzn7vb5EUTFJB58YtQrY9lVg5muEbWG10ke0=
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=nwJdIhNusRBhN0blJq5eF46ORl8=; b=LG6WD Ev5ci0g5QBnSyoKvVPCS17aBTO3sx3x+gAdQIWTWN6p3c/tNDxTizIpIkfCXpCuw DVOf+yAeejaeWLA3aA1RCYosz6Gb7TlN6yZZmnWEa0du4enEX0EEgynoA1MidP0E tNmNTYmJHrWxvw+mFlrSwtlWtmP+rwQ85I1D9s=
- In-reply-to: <CAHYJk3SNvBcqMHL=vBAMVdsPNSmR2Rei8F6rZycQDLoTiEeK8A@mail.gmail.com>
- 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
- References: <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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author