From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id E38BA1F47C for ; Sat, 7 Jan 2023 09:08:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1673082521; bh=Eq0DYaSsBj/66/ra7ePPzvXtwxy4Q3fnIs0CiSpVrBM=; h=From:To:Subject:Date:From; b=0IYwTodWwBckdf8U8ZPcFWSpUATTXWgt3zAdpjyKuq/qncxw9/WoTCYynNpQeW1ku eq1QdXT2k5pucX+lmL6qsLburvbtqVx+MTkLW8NTEu0Jc4ntTpVOsbVdV+gkegEgD0 VfVlcZhS9mnH4pel9dckZvhob9VZz1Xtp9LVGEvU= From: Eric Wong To: mwrap-perl@80x24.org Subject: [PATCH] rproxy: avoid uninitialized stat w/o debugperl Date: Sat, 7 Jan 2023 09:08:42 +0000 Message-Id: <20230107090842.2430670-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: The `_' stat cache is cleared if `-x' fails, so ensure we capture it cheaply from the preceding `-e' before attempting `-x "/usr/bin/debugperl"'. --- lib/Devel/Mwrap/Rproxy.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Devel/Mwrap/Rproxy.pm b/lib/Devel/Mwrap/Rproxy.pm index e2b7097..d5a9d9d 100644 --- a/lib/Devel/Mwrap/Rproxy.pm +++ b/lib/Devel/Mwrap/Rproxy.pm @@ -82,11 +82,13 @@ sub resolve_exe ($$) { $exe = ($l =~ /\A\#\![ \t]*(\S+)/) ? $1 : $^X; } return unless -e $exe; + my @st = stat(_); # Debian `perl-debug' is special: - ($exe eq '/usr/bin/perl' && -x '/usr/bin/debugperl') and + if ($exe eq '/usr/bin/perl' && -x '/usr/bin/debugperl') { + @st = stat(_); $exe = '/usr/bin/debugperl'; - my @st = stat(_); + } $$st = pack('dd', $st[10], $st[7]); # ctime + size $exe; }