From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS15576 212.103.64.0/19 X-Spam-Status: No, score=-3.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from mx.kolabnow.com (mx.kolabnow.com [212.103.80.155]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id CD5F31F4D7 for ; Fri, 10 Jun 2022 03:22:27 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (4096-bit key; secure) header.d=kolabnow.com header.i=@kolabnow.com header.b="fMU86oAg"; dkim-atps=neutral Received: from localhost (unknown [127.0.0.1]) by mx.kolabnow.com (Postfix) with ESMTP id 8F0B5E8C for ; Fri, 10 Jun 2022 05:22:25 +0200 (CEST) Authentication-Results: ext-mx-out002.mykolab.com (amavisd-new); dkim=pass (4096-bit key) reason="pass (just generated, assumed good)" header.d=kolabnow.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kolabnow.com; h= content-transfer-encoding:mime-version:message-id:date:date :subject:subject:from:from:received:received:received; s= dkim20160331; t=1654831345; x=1656645746; bh=UlINOzBqm4BCJ/sdtO8 hoRITm8lbICEhaXRsbvC1XgI=; b=fMU86oAgrA0gzkUZCy1976TH46VzC3W44Sw DlYesVLdbiIVs15hmc+0i+XcAUG5uQf+5b7MesJOUcVJTbYFkMx3WPl6Xwg7psbL JvHtkSqxcsUOnRc4ELeOjhhU50bGgtDetsRnbWlMBZmrO6Rtme/gqXpkaItF1/2n b9KjTeKKqXqOM42gWCeOB52SlCaoyeHf5F4DqHG6qmuBw5WXCH0QO0loKKA+JtTb 2bNBp+EIBMT4+/zZvitgjHbZHm1fCKSQoF9JUKZ8KbRR4k2x8KVT0jyYZnM23HKN 9YmtOpa+tZYpPEbCh1ElC0HnirBRdhPSL+oErWj5DHDoas7ef0uvlPpj/10gQjKe 9XfdxWVIcoL47sKFUhtyEwXG3NwLNe1H+9gX9inNJBn51R1A/nSMODcObP3bOtS3 SAUugILNlpLowFRCOiL3hdkXJePmX9BUc4KajbifS+H1d0dhnUbkIP/lr60X82Vo F9r2Vl2IVL9UQt3Z9Ff/fhtGZpbXUmIPwHiXqmkXcRf3OaxNamh7xiarj8EKivpY 7FATNZzrGoit2HR2hM11nCbHNdfl9u4QzNUOgKDG0DpyBgiKu4K9Eg8XZvmRJJAA lPmM90ErXbBfeTCy9qqHs7l7b7nSr51TW8/H+GrMxYnyYK+Q8vMKzRoSQF7yEGts rG/XVTqc= X-Virus-Scanned: amavisd-new at mykolab.com Received: from mx.kolabnow.com ([127.0.0.1]) by localhost (ext-mx-out002.mykolab.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Tqa7usxQMj4w for ; Fri, 10 Jun 2022 05:22:25 +0200 (CEST) Received: from int-mx002.mykolab.com (unknown [10.9.13.2]) by mx.kolabnow.com (Postfix) with ESMTPS id 63CAD9FD for ; Fri, 10 Jun 2022 05:22:24 +0200 (CEST) Received: from ext-subm002.mykolab.com (unknown [10.9.6.2]) by int-mx002.mykolab.com (Postfix) with ESMTPS id AD48735E0; Fri, 10 Jun 2022 05:22:22 +0200 (CEST) From: Thiago Jung Bauermann To: meta@public-inbox.org Cc: Thiago Jung Bauermann Subject: [PATCH] t/spawn: Find invalid PID to try to join its process group Date: Fri, 10 Jun 2022 00:21:45 -0300 Message-Id: <20220610032145.110888-1-bauermann@kolabnow.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: In the container used to build packages of the GNU Guix distribution, PID 1 runs as the same user as the test so this spawn that should fail actually succeeds. Fix the problem by going through different PIDs and picking one that either doesn't exist or we aren't allowed to signal. --- t/spawn.t | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) Hello, First of all, thank you for public-inbox! Mailing list archives are so much better now for projects that use this project! I've also been using lei and it's extremely helpful, thank you for this new tool as well. I packaged v1.8.0 for the GNU Guix distribution, but its build environment causes this test to fail. This patch fixes it. I'm not a Perl developer, so please let me know if there's anything I should improve in the code. diff --git a/t/spawn.t b/t/spawn.t index 6168c1f6171c..4af215809962 100644 --- a/t/spawn.t +++ b/t/spawn.t @@ -24,7 +24,17 @@ SKIP: { is(waitpid($pid, 0), $pid, 'waitpid succeeds on spawned process'); is($?, 0, 'true exited successfully'); pipe(my ($r, $w)) or BAIL_OUT; - $pid = eval { spawn(['true'], undef, { pgid => 1, 2 => $w }) }; + + # Find invalid PID to try to join its process group. + my $wrong_pgid = 1; + for (my $i=65534; $i >= 2; $i--) { + if (kill(0, $i) == 0) { + $wrong_pgid = $i; + last; + } + } + + $pid = eval { spawn(['true'], undef, { pgid => $wrong_pgid, 2 => $w }) }; close $w; my $err = do { local $/; <$r> }; # diag "$err ($@)"; base-commit: 930d2dc63e04c652e3b64cc7f3b3a7d377637065