From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: from zero.zsh.org (zero.zsh.org [IPv6:2a02:898:31:0:48:4558:7a:7368]) by inbox.vuxu.org (Postfix) with ESMTP id 0849D2546F for ; Wed, 28 Feb 2024 08:53:29 +0100 (CET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1709106809; b=ThXVaG0TfvrbnYxONjWrMLyCXoK0jXBXLkJ7Me2C+/WBWQAuw9yE/4DFJiYFM6WEMFtwiWcaYg 5N6HBfBqeKR+JaAVzHI5gEhtnNDBRGT1YZ4zX2awfq9xKiQRBpoS3FN+LdgWldIgkKOB3ZwQ64 9rBtfLty2uMeOWzvaNGrdN8C0hH2sKfnw/3+YtiEM/U1neKuvvvMya5zcjcTJKJUWJ5Z9Jmuf/ H+M6wSwAl0OPzgKjyKPvSMWmtoretq/CZ27wzIcXLWXKeHQFNlV5+A1AA8sg20fYMUYUWXlZaT 97VFNE/aC3XsnbWpLJtB0oEkdPEznkRdvaWIjPHvbtnsXw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ej1-f46.google.com) smtp.remote-ip=209.85.218.46; dkim=pass header.d=brasslantern-com.20230601.gappssmtp.com header.s=20230601 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1709106809; bh=qJOimABtHEAfRHAuQAZZ71EscYpUWd4eH7XL4xvGtfc=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:To:Subject:Message-ID: Date:From:In-Reply-To:References:MIME-Version:DKIM-Signature:DKIM-Signature; b=jvYm2O4izcaje5V4cR0KQiEWcj70FvLiwNClwfFmyXjvJb5rZUXHrexT1QaB2hP937VEbSGOz7 CbTfpOx4I/wYRrBHn+6c6ypedQny7/oJ9BMRlDRrNyunFq+KOwMZi0x181p6iCPsqyYgoyvo4x /T69zwyq/BFFgKVFdVY9VlyeSwj4O/h7SL4vXy3s5qwxuM4f4BzaXKW7APhDEcLDaihy4IfL5i YFNnbQoRFRRu7jggTYESsPb6/4DNujSNWAL9kKx8U0B/h4CxC/6bkueuJgaJr4HBbzXKV8ckDJ KVs7DjCWJKDFXrGSdtlFba0cu90GqIeZ7kna8TTiidKOKQ==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Transfer-Encoding: Content-Type:To:Subject:Message-ID:Date:From:In-Reply-To:References: MIME-Version:Reply-To:Cc:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=EPsU+DEC3n7nmnmIcfUSh6DpK2RRzHcpdkFAK9HEbnM=; b=Dk3hx87+OMT9nHHoL2bi7sjAZc wSxiCL4izeOyAxL7WGZ6p2mNEkUbYNnDG0uJGZl7t8fb7KZ4O3gMzspsc6FYDurSUQOWcEojf+XqI 5Ug174UYOjTFsVNS+hOeHirXrp7JBbHAFlJFF/Q7DT3xwpnzwhAUL6Xy4thUVRvbyT5a/D8mA5BBd brXh/QglHRWA91kiyb8wRB3RYbZn+GSSPvwzOkU/+DqrcUrk3O4Ip7WTl5OB3LwOuA8c9MiTgPYlM UjWBX3mGW43K5qlXi6qy5DATg8l1K3P8aWyv8DeAXhRsH1ny+lo24xzpzT4+yHe2XDbvNc6C0C98b N5gww7Ng==; Received: by zero.zsh.org with local id 1rfEkr-00058v-BO; Wed, 28 Feb 2024 07:53:29 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ej1-f46.google.com) smtp.remote-ip=209.85.218.46; dkim=pass header.d=brasslantern-com.20230601.gappssmtp.com header.s=20230601 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-ej1-f46.google.com ([209.85.218.46]:56726) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1rfEkX-0004s3-Oq; Wed, 28 Feb 2024 07:53:10 +0000 Received: by mail-ej1-f46.google.com with SMTP id a640c23a62f3a-a3f1bf03722so568274466b.1 for ; Tue, 27 Feb 2024 23:53:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20230601.gappssmtp.com; s=20230601; t=1709106789; x=1709711589; darn=zsh.org; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=EPsU+DEC3n7nmnmIcfUSh6DpK2RRzHcpdkFAK9HEbnM=; b=ejflhOm05NzRBLrTAD5c5q4Z7tbvzrKwJ5cdSJWe+3DFfontXHkNMsSUeYxuIIiibC atYoPbIuvs5hCbUmW2F+i9huQBtKUmaAh4BcRRSQeFN5vtjerD906AhNOYW0zAVq949Z MgtfLGj/uONOkTf7BR+435APaxEcZNbllsOnzyyE1T7xy4uJ6TbcXnEl1c+MhzEjFLL2 mu2bdarvauWcF3dk33krTsB9w2XmG2hFCahuQV9yBM3OxQaz9Cg9Ju3ktnDdq6aaqFXi oUlvz9s4syn4RpxToCTTwTevZN0aPM57tVvRyK/1MOom99PqDJAnRxe0KiSTSv0Pwcx4 Hjhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709106789; x=1709711589; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EPsU+DEC3n7nmnmIcfUSh6DpK2RRzHcpdkFAK9HEbnM=; b=YYZ+kO3mCxT6immAxuArRIESfHNa9EozCxt46uWdNxhJ0E1dZhj5MEdgM5tXU/Pb6s SJIBErUWXOTd4Chp0P8GqFSCr0ZKRDP1IdkP/1UIaZjcKgHta4Kx7zuW0Oz8tJk+L4z+ KmPlBHR+4YsG5GXOnIgYRyLfYdlP2Ikp3/QWJbqMgKhh1+ykqQ+llv9NeDaumznzvaoY +DwGoQCWI2CYZ9SyK9akTXpj0tAifuEV6tugdRngSosEN9KkciXoACaVrw6tfuDDKE7O 5LABJRq6ZHdO7PlBAgRSVpuih+h+aehcYxScIyV6XNFR+5K+OHnQu+4RFUTnkH1S5i3b MWhQ== X-Gm-Message-State: AOJu0Yw1k2OtdknHMftr0wfEw31dZgF73M7LE6JGfon1fRpbAt60frpn nmbxk57J1bwouUYCDLH/uL2Hgr0pBzThsVrC8v+Qzn3bIJl1A5iOWfAcmtyLenfqz7xSiUuGer5 9MIVT1HXQ6JyN3nQStYmKAG/1gNYywahKuOzd60Ci8T0niVxK8g== X-Google-Smtp-Source: AGHT+IG6qjh9Tpa8NY3nLifH4mcURXVYL+eG3Y5D+tLDpwiciD47uvcaJ+FBVcDtYhCr8wGi3RUM9TEVN9VMTVae5+Y= X-Received: by 2002:a17:906:1857:b0:a3e:d210:1e87 with SMTP id w23-20020a170906185700b00a3ed2101e87mr6936762eje.77.1709106789081; Tue, 27 Feb 2024 23:53:09 -0800 (PST) MIME-Version: 1.0 References: <20240227070502.ek5ocpwxm6cpp5gz@chazelas.org> <20240228053934.cp76m7jfnhommrl3@chazelas.org> In-Reply-To: <20240228053934.cp76m7jfnhommrl3@chazelas.org> From: Bart Schaefer Date: Tue, 27 Feb 2024 23:52:57 -0800 Message-ID: Subject: Re: "kill -STOP" as noticed in ksh93u+ gitlab To: Zsh hackers list Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Seq: 52633 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: On Tue, Feb 27, 2024 at 9:39=E2=80=AFPM Stephane Chazelas wrote: > > 2024-02-27 18:04:34 -0800, Bart Schaefer: > [...] > > Changing the "kill" command doesn't (in zsh at least) affect the > > "suspend" command. [...] > > % kill -STOP $$ > > kill: kill 605210 failed: operation not permitted > > % > > I can't reproduce that on Ubuntu 22.04. The wording of that > error suggests it's the system blocking the kill() with EPERM. Sorry, I worded that badly. I meant I actually DID change the kill command. I made the corresponding change as in the ksh93u+ diffs. Posted without implying yet that it be used: diff --git a/Src/jobs.c b/Src/jobs.c index 118c5e61b..cfc783f46 100644 --- a/Src/jobs.c +++ b/Src/jobs.c @@ -2890,7 +2890,12 @@ bin_kill(char *nam, char **argv, UNUSED(Options ops), UNUSED(int func)) returnval++; } else { int pid =3D atoi(*argv); - if ( + if (pid =3D=3D mypid && islogin && + (sig =3D=3D SIGSTOP || sig =3D=3D SIGTSTP)) { + zwarnnam("kill", "kill %s failed: %e", *argv, errno =3D EPE= RM); + returnval++; + } else if ( + #ifdef HAVE_SIGQUEUE use_sigqueue ? sigqueue(pid, sig, sigqueue_info) : #endif > If we're blocking kill -s STOP $$, should we also block kill -s > STOP 0 and kill -s STOP -1? That's less likely than someone starting a subshell and forgetting that $$ doesn't mean the PID of the subshell. And if using 0 / -1 the intention is to signal multiple processes. I suppose zsh could signal_block() the signal it is about to pass to kill(), but that seems like (ahem) overkill.