From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 6148 invoked from network); 26 Sep 2023 14:34:19 -0000 Received: from alyss.skarnet.org (95.142.172.232) by inbox.vuxu.org with ESMTPUTF8; 26 Sep 2023 14:34:19 -0000 Received: (qmail 10209 invoked by uid 89); 26 Sep 2023 14:34:40 -0000 Mailing-List: contact supervision-help@list.skarnet.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Received: (qmail 10202 invoked from network); 26 Sep 2023 14:34:40 -0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=westernsemico.com; s=default; h=Message-ID:Date:Subject:To:From: Content-Transfer-Encoding:MIME-Version:Content-Type:Sender:Reply-To:Cc: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=7ziZdn+HV3Ql48SY3gzo4iH8iDvO4rIagni6zfDjZc4=; b=MnHeyouC/zi76x5ziS0q++lavl Kfm6ulK8O57jv4t3q9PlCOaSkHAJE0b7e62b1pObgv35RlSq2yRipAUgVLLkq2WrVtwCrO76HFoGs QPGGdYcTklbh5Y/3oAzlGhema9cE2H1GAhZ1EZYJao4I8RepC7UFTJ9Dtkywc1e5m4e/wDE4t+QWL Fp1KgpB+PBg+dP/Ri+jH61lYuzKtrvMA3WzIgamweeA31tEqCRdn5u1JZOusM1RnUwoV68JSwwIYF vNWrfIBRy7W5tfOu2IlfmMKsjBSRg/2ksazZIglVswlAac6FDfrPFmdaa2wvtuoghdQCaTaLAWeZE L7vCBtaA==; Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Adam Joseph To: supervision@list.skarnet.org Subject: s6-rc-update does not create pipes when already-running service becomes a consumer Date: Tue, 26 Sep 2023 07:33:28 -0700 Message-ID: <169573880839.4539.10047970009995756240@localhost> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - server220.web-hosting.com X-AntiAbuse: Original Domain - list.skarnet.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - westernsemico.com X-Get-Message-Sender-Via: server220.web-hosting.com: authenticated_id: westwhdn/from_h X-Authenticated-Sender: server220.web-hosting.com: adam@westernsemico.com X-Source: X-Source-Args: X-Source-Dir: X-From-Rewrite: unmodified, already matched A simple script to demonstrate this problem is attached below. It appears that s6-rc-update will neglect to create the needed pipes in the following situation: 1. A service X is already running before s6-rc-update is invoked 2. Service X was not the consumer-for any other service prior to s6-rc-upda= te 3. Service X is the consumer-for at least one service after s6-rc-update A similar problem occurs with producer-for. The fix is relatively straightforward; in fill_convtable_and_flags() a chec= k is needed to detect if olddb->services[i].x.longrun.nproducers=3D=3D0 is diffe= rent from newdb->services[x].x.longrun.nproducers=3D=3D0; if so, the NEWSTATE_IS_BIJECTIVE_CONVERSION_TARGET flag should not be added to newstat= e[x] and instead OLDSTATE_RESTART should be added to oldstate[i]. I have a patch that implements this, and the corresponding check for longrun.consumer. Below is a crude shell script which demonstrates the bug. It does not requ= ire root. Before running the script below, you must run the following command = on a different terminal (you'll want to observe its output): mkdir -p /tmp/live/service s6-svscan -- /tmp/live/service/ Here is the script: #!/bin/bash mkdir -p source/consumer echo longrun > source/consumer/type echo -e '#!/bin/bash\ncat > /dev/null' > source/consumer/run chmod +x source/consumer/run mkdir source/producer echo longrun > source/producer/type echo -e '#!/bin/bash\nwhile true; do sleep 1; date; done\n' > source/produc= er/run chmod +x source/producer/run s6-rc-compile compiled source s6-rc-init -l /tmp/live/compiled -c $(pwd)/compiled /tmp/live/service/ s6-rc -l /tmp/live/compiled start producer consumer s6rc-fdholder echo < source/consumer/consumer-for echo consumer > source/producer/producer-for s6-rc-compile compiled2 source s6-rc-update -l /tmp/live/compiled $(pwd)/compiled2 echo <