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 496A91F66E for ; Fri, 10 Jun 2022 15:28:37 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (4096-bit key; secure) header.d=kolabnow.com header.i=@kolabnow.com header.b="e4eR72+A"; dkim-atps=neutral Received: from localhost (unknown [127.0.0.1]) by mx.kolabnow.com (Postfix) with ESMTP id 05048E47; Fri, 10 Jun 2022 17:28:34 +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:content-type:content-type:mime-version :message-id:in-reply-to:date:date:subject:subject:from:from :references:received:received:received; s=dkim20160331; t= 1654874913; x=1656689314; bh=kmKo4NAoIwPoUuBmZZIpxaAxwC8U0/j4GLk qxgxNWcs=; b=e4eR72+ArHff9Nf7RnsanYLpJ3De/WNVeXM3ktEbyTswXujGjqW PkdJpVOfb/rFjauMI7RoHovPDsH5hj4D1VlUdMp9xpTlTC87uvEW3CZ9BOVHqWlD M3xzVdmiF6AoqOsPtC2pJNDjEeM1p8UU6ETDE+OYN93gBos+nxH0Uot0tl7oq+xu FL6NXy/UMTJaDCJvZuHlqa80avPZkkeFte68T/NICmNwxhr8OoPEz/1IfjieAwb7 G0Z0FbMdYaR2XiFpHkZtcs4hE5YsfQdxpNENEZtff7r7BDA2FHNz5j4LOGPNO8UJ RSRT1hDt//mWmfs6XS7DhtWwZwn4+4K2qBcUiyJnjHC7AbNHghBoLFYsojObfPjZ oeHbo77kvshnaaLBxNk6ly41pfNyn/zUVTJEDcIkgxSvV77WNyDE8ipJ6N7B9osI L0AzY0EDLemlYTrZhvhyedntjl+M2GuSKrqs54aiRKA92i/3I2ElQzNWKy4be93G 9CHEb8RJXv8UscuJUq1EOA3oS96Hs+et0z/MPvdjd73I9NpEqc9DkbOIHYc+trk4 6HSaCLjiDeTpOv/mnoZgEPGNS30iy46PnNdKSAlWbFTSJYFgt28Fswr5/s04c30D ye3H0mQtjW5y+SiQGn4TiwZLf/iJ6Djtab+7sLr/M+ylALeRDqsybHVA= 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 r89kq04-O9lF; Fri, 10 Jun 2022 17:28:33 +0200 (CEST) Received: from int-mx002.mykolab.com (unknown [10.9.13.2]) by mx.kolabnow.com (Postfix) with ESMTPS id DB28D841; Fri, 10 Jun 2022 17:28:31 +0200 (CEST) Received: from ext-subm002.mykolab.com (unknown [10.9.6.2]) by int-mx002.mykolab.com (Postfix) with ESMTPS id D259E369C; Fri, 10 Jun 2022 17:28:30 +0200 (CEST) References: <20220610032145.110888-1-bauermann@kolabnow.com> <20220610095509.M660001@dcvr> From: Thiago Jung Bauermann To: Eric Wong Cc: meta@public-inbox.org Subject: Re: [PATCH] t/spawn: Find invalid PID to try to join its process group Date: Fri, 10 Jun 2022 12:13:09 -0300 In-reply-to: <20220610095509.M660001@dcvr> Message-ID: <874k0s5yia.fsf@kolabnow.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: Hello Eric, Thank you for responding so quickly! Eric Wong writes: > Thiago Jung Bauermann wrote: >> In the container used to build packages of the GNU Guix distribution, PI= D 1 >> runs as the same user as the test so this spawn that should fail actually >> succeeds. > > Ah, interesting... It's amazing how much variation there is out there, right? :-) >> First of all, thank you for public-inbox! Mailing list archives are so m= uch >> better now for projects that use this project! >>=20 >> I've also been using lei and it's extremely helpful, thank you for this = new >> tool as well. > > You're welcome, hoping I'll soon be able to get my brain working > again to work on it.. Sorry to hear about your brain state. Hope that hacking on public-inbox is fun and exciting and helps you get it working again! >> I packaged v1.8.0 for the GNU Guix distribution, but its build environme= nt >> causes this test to fail. This patch fixes it. > > Thanks for packaging and this patch. You're most welcome. Guix was stuck in version 1.6 for various reasons and lei kept coming up in the Guix mailing list during discussions about improved email workflows. We were eager to get at least 1.7 so that we could all enjoy it. >> I'm not a Perl developer, so please let me know if there's anything I sh= ould >> improve in the code. > > No worries, neither are most people these days :) Some comments below. Thank you for the comments. >> 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 =3D eval { spawn(['true'], undef, { pgid =3D> 1, 2 =3D> $w }) }; >> + >> + # Find invalid PID to try to join its process group. >> + my $wrong_pgid =3D 1; >> + for (my $i=3D65534; $i >=3D 2; $i--) { >> + if (kill(0, $i) =3D=3D 0) { >> + $wrong_pgid =3D $i; >> + last; >> + } >> + } >> + > > Perhaps 65534 is enough for common purposes, but my FreeBSD VM > and newer Linux systems see PIDs greater than that (in the > millions, even). > > Instead of 65534, starting the loop with some absurdly high > number (e.g 0x7fffffff) seems to work just as quickly on both > Linux and FreeBSD 12. Not sure if that causes problems on Guix > or other systems, but it's unlikely. Makes sense. 0x7fffffff worked for me so I changed the loop to start from there. > Style note: we indent exclusively with hard tabs. Our indentation > is more consistent with Linux kernel/git (C) style > than what is commonly found in CPAN and other Perl projects. Sorry, I should have paid attention to indentation style and tab vs spaces. I fixed my code to fix both issues. I'll send a v2 shortly. I'll also propose a patch adding an .editorconfig file=C2=B9 that adjusts these settings automatically for various editors. > Thanks again Thank you again for quickly reviewing this patch. --=20 Thanks Thiago =C2=B9 https://EditorConfig.org