From nobody Sat Mar 26 14:52:40 2022 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 766891A38360 for ; Sat, 26 Mar 2022 14:52:51 +0000 (UTC) (envelope-from ganael.laplanche@martymac.org) Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4KQhlQ1b8Yz3l7X; Sat, 26 Mar 2022 14:52:50 +0000 (UTC) (envelope-from ganael.laplanche@martymac.org) Received: (Authenticated sender: ganael.laplanche@martymac.org) by mail.gandi.net (Postfix) with ESMTPSA id C764CFF805; Sat, 26 Mar 2022 14:52:40 +0000 (UTC) Message-ID: <9745f2ef-3aae-5548-c8db-5da7d4ce11e7@martymac.org> Date: Sat, 26 Mar 2022 15:52:40 +0100 List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: Our /bin/sh and process group IDs Content-Language: en-US To: Bryan Drewery , freebsd-hackers@freebsd.org References: <48e49ad0-a12a-d10b-5867-da9736c6c1fd@martymac.org> <243ebc92-26a1-e5e7-67fe-1477ed6b5f7a@FreeBSD.org> From: Ganael Laplanche In-Reply-To: <243ebc92-26a1-e5e7-67fe-1477ed6b5f7a@FreeBSD.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4KQhlQ1b8Yz3l7X X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of ganael.laplanche@martymac.org designates 2001:4b98:dc4:8::229 as permitted sender) smtp.mailfrom=ganael.laplanche@martymac.org X-Spamd-Result: default: False [-1.48 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.99)[-0.987]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2001:4b98:dc4:8::/64]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[martymac.org]; NEURAL_HAM_LONG(-0.93)[-0.933]; NEURAL_SPAM_SHORT(0.84)[0.838]; RCPT_COUNT_TWO(0.00)[2]; MLMMJ_DEST(0.00)[freebsd-hackers]; RCVD_COUNT_ZERO(0.00)[0]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:203476, ipnet:2001:4b98:dc4::/48, country:FR]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_IN_DNSWL_LOW(-0.10)[2001:4b98:dc4:8::229:from] X-ThisMailContainsUnwantedMimeParts: N Le 25/03/2022 à 20:13, Bryan Drewery a écrit : Hello Bryan, > set -m needs to be set from the parent process, not child. Thanks for those clarifications. Is that something required by POSIX (I could not find any documentation about that) ? Or is it a limitation (or bug) of our implementation ? Other shells -mostly- do not behave that way (see my original post). > In this example test_func is a child *and* the sleep is a child which is also > very racy. Here's a pattern I use that works: > [...] Unfortunately, in my case, spawn would have to be called from a sub-process already forked (from a background function, executed as a child process) ; so that wouldn't work either. Anyway, thanks for the hint :) Cheers, -- Ganael LAPLANCHE http://www.martymac.org | http://contribs.martymac.org FreeBSD: martymac , http://www.FreeBSD.org