Received: by mail.netbsd.org (Postfix, from userid 605) id C902884E67; Wed, 17 Aug 2022 18:28:34 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.netbsd.org (Postfix) with ESMTP id 0F93884E5C for ; Wed, 17 Aug 2022 18:28:34 +0000 (UTC) X-Virus-Scanned: amavisd-new at netbsd.org Received: from mail.netbsd.org ([IPv6:::1]) by localhost (mail.netbsd.org [IPv6:::1]) (amavisd-new, port 10025) with ESMTP id h7ENwOxgfdYc for ; Wed, 17 Aug 2022 18:28:33 +0000 (UTC) Received: from cvs.NetBSD.org (ivanova.netbsd.org [199.233.217.197]) by mail.netbsd.org (Postfix) with ESMTP id 7DA8284D1C for ; Wed, 17 Aug 2022 18:28:33 +0000 (UTC) Received: by cvs.NetBSD.org (Postfix, from userid 500) id 7728EFB1A; Wed, 17 Aug 2022 18:28:33 +0000 (UTC) Content-Transfer-Encoding: 7bit Content-Type: multipart/mixed; boundary="_----------=_1660760913143640" MIME-Version: 1.0 Date: Wed, 17 Aug 2022 18:28:33 +0000 From: "Roland Illig" Subject: CVS commit: pkgsrc/pkgtools/lintpkgsrc/files To: pkgsrc-changes@NetBSD.org Reply-To: rillig@netbsd.org X-Mailer: log_accum Message-Id: <20220817182833.7728EFB1A@cvs.NetBSD.org> Sender: pkgsrc-changes-owner@NetBSD.org List-Id: Precedence: bulk List-Unsubscribe: This is a multi-part message in MIME format. --_----------=_1660760913143640 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Module Name: pkgsrc Committed By: rillig Date: Wed Aug 17 18:28:33 UTC 2022 Modified Files: pkgsrc/pkgtools/lintpkgsrc/files: lintpkgsrc.pl Log Message: lintpkgsrc: add error handling for files and subprocesses To generate a diff of this commit: cvs rdiff -u -r1.113 -r1.114 pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. --_----------=_1660760913143640 Content-Disposition: inline Content-Length: 2184 Content-Transfer-Encoding: binary Content-Type: text/x-diff; charset=us-ascii Modified files: Index: pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl diff -u pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl:1.113 pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl:1.114 --- pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl:1.113 Wed Aug 17 18:25:26 2022 +++ pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl Wed Aug 17 18:28:33 2022 @@ -1,5 +1,5 @@ #!@PERL5@ -# $NetBSD: lintpkgsrc.pl,v 1.113 2022/08/17 18:25:26 rillig Exp $ +# $NetBSD: lintpkgsrc.pl,v 1.114 2022/08/17 18:28:33 rillig Exp $ # Written by David Brownlee . # @@ -555,7 +555,7 @@ sub parse_makefile_vars($file, $cwd = un open(FILE, $file) or return undef; chomp(@lines = ); - close(FILE); + close(FILE) or die; push @incdirs, '.'; push @incdirs, dirname($file); @@ -785,10 +785,9 @@ sub invalid_version($pkgmatch) { } sub list_installed_packages() { - open(PKG_INFO, "$conf_pkg_info -e '*' |") - or fail("Unable to run $conf_pkg_info: $!"); + open(PKG_INFO, "$conf_pkg_info -e '*' |") or die; chomp(my @pkgs = ); - close(PKG_INFO); + close(PKG_INFO) or die; map { $_ = canonicalize_pkgname($_) } @pkgs; } @@ -973,11 +972,11 @@ sub parse_makefile_pkgsrc($file) { if (!$pid) { warn "$file: Unable to run make: $!"; } else { - close(WTR); + close(WTR) or die; my @errors = ; - close(ERR); + close(ERR) or die; my ($makepkgname) = ; - close(RDR); + close(RDR) or die; wait; chomp @errors; if (@errors) { warn "\n$file: @errors\n"; } @@ -1228,7 +1227,7 @@ sub check_pkgsrc_distfiles_vs_distinfo($ my $pid2 = fork(); defined $pid2 || fail 'fork'; if ($pid2) { - close($in); + close($in) or die; } else { print $in "@{$sumfiles{$sum}}"; exit 0; @@ -1241,7 +1240,7 @@ sub check_pkgsrc_distfiles_vs_distinfo($ } } } - close($out); + close($out) or die; waitpid($pid, 0) || fail "xargs digest $sum"; waitpid($pid2, 0) || fail 'pipe write to xargs'; } @@ -1563,7 +1562,7 @@ sub check_outdated_installed_packages($p while () { print " $1" if /^(.*?)-\d/; } - close(PKGINFO); + close(PKGINFO) or die; print "\n"; } --_----------=_1660760913143640--