From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 437d1a8c for ; Sat, 15 Feb 2020 14:10:56 +0000 (UTC) Received: (qmail 7132 invoked by alias); 15 Feb 2020 14:10:51 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 45431 Received: (qmail 21816 invoked by uid 1010); 15 Feb 2020 14:10:51 -0000 X-Qmail-Scanner-Diagnostics: from wout3-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.1/25718. spamassassin: 3.4.2. Clear:RC:0(64.147.123.19):SA:0(-2.6/5.0):. Processed in 4.834482 secs); 15 Feb 2020 14:10:51 -0000 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at daniel.shahaf.name does not designate permitted sender hosts) X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrjedvgdeigecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkjghfofggtgfgsehtqhdttdertdejnecuhfhrohhmpeffrghnihgv lhcuufhhrghhrghfuceougdrshesuggrnhhivghlrdhshhgrhhgrfhdrnhgrmhgvqeenuc ffohhmrghinhepiihshhdrohhrghenucfkphepjeelrddujeekrdejrddukeelnecuvehl uhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepugdrshesuggrnh hivghlrdhshhgrhhgrfhdrnhgrmhgv X-ME-Proxy: Date: Sat, 15 Feb 2020 14:10:04 +0000 From: Daniel Shahaf To: Chris Down Cc: zsh-workers@zsh.org Subject: Re: [PATCH ALTERNATE] builtins: kill: Do not set signal on current pgroup when pid is empty Message-ID: <20200215141004.2e68a381@tarpaulin.shahaf.local2> In-Reply-To: <20200215135248.GA662294@chrisdown.name> References: <20200214151556.GA624243@chrisdown.name> <20200215135248.GA662294@chrisdown.name> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Chris Down wrote on Sat, 15 Feb 2020 09:52 -0400: > There are two ways to solve this issue: >=20 > 1. Add special handling to `kill` to avoid this case. See this patch[0] > for a version that does that. > 2. Change how isanum behaves. Since the only two call sites that use it > both seem like they should handle the case where the input char array > is empty, that seems like a reasonable overall change to me, but > either works. Thanks for the patch and the revisions. I prefer #2. If no one objects (or says POSIX requires =C2=ABkill ''=C2=BB to be equivalent to =C2=ABkill 0=C2=BB=E2=80=A6) I'll apply it. It would be nice to have a regression test for this. Test/C03traps.ztst has the examples, but the test should be added to a B*.ztst file (probably a new one). Would you happen to have time to look into this? No worries if not. Cheers, Daniel > After this patch: >=20 > % trap 'exit 5' TERM > % kill '' > kill: illegal pid: >=20 > 0: https://www.zsh.org/mla/workers/2020/msg00251.html > --- > Src/jobs.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) >=20 > diff --git a/Src/jobs.c b/Src/jobs.c > index e7438251e..0485f2c7c 100644 > --- a/Src/jobs.c > +++ b/Src/jobs.c > @@ -1854,13 +1854,14 @@ scanjobs(void) > =20 > /* This simple function indicates whether or not s may represent * > * a number. It returns true iff s consists purely of digits and * > - * minuses. Note that minus may appear more than once, and the empty * > - * string will produce a `true' response. */ > + * minuses. Note that minus may appear more than once. */ > =20 > /**/ > static int > isanum(char *s) > { > + if (*s =3D=3D '\0') > + return 0; > while (*s =3D=3D '-' || idigit(*s)) > s++; > return *s =3D=3D '\0';