[SCM] Debian package checker branch, master, updated. 2.5.8-7-g7352cd7
The following commit has been merged in the master branch:
commit 7352cd784dd44f66c59dab57ea4b867406cf1074
Author: Niels Thykier <niels@thykier.net>
Date: Tue Jun 5 12:09:38 2012 +0200
Gracefully handle the absence of $ENV{HOME}
Random googling revealed that some people run Lintian without a
defined $ENV{HOME}[1]. So ensure we handle this use case without
emitting "uninitialized value" warnings.
[1] http://pastebin.com/Bm5JT7hT
In case the pastebin disappears, it contained:
"""
Use of uninitialized value $ENV{"HOME"} in concatenation (.) or string at /usr/bin/lintian line 112.
"""
Signed-off-by: Niels Thykier <niels@thykier.net>
diff --git a/debian/changelog b/debian/changelog
index bd8a15c..2849163 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -16,8 +16,15 @@ lintian (2.5.9) UNRELEASED; urgency=low
+ [NT] raster-image-in-scalable-directory was added in 2.5.7,
not removed.
+ * frontend/lintian{,-info}:
+ + [NT] Remove assumption that $ENV{HOME} is set/defined. If
+ $ENV{HOME} is not sent, user specific profiles will simply
+ be ignored.
+
* lib/Lintian/Collect/Package.pm:
+ [NT] Represent files (from index) as Lintian::Path objects.
+ * lib/Lintian/Data.pm:
+ + [NT] Gracefully handle the absence of $ENV{HOME}.
* lib/Lintian/Package/Source.pm:
+ [NT] sorted_index now returns a list rather than a list ref.
* lib/Lintian/Path.pm:
diff --git a/frontend/lintian b/frontend/lintian
index 10965a5..7cd55b0 100755
--- a/frontend/lintian
+++ b/frontend/lintian
@@ -105,10 +105,12 @@ my %group_cache = (); # Cache to store groups in case of group
# The profile search path except LINTIAN_ROOT/profiles
# which will be added later (we dont know LINTIAN_ROOT
# at this point)
-my @prof_inc = (
- "$ENV{HOME}/.lintian/profiles",
- '/etc/lintian/profiles'
-);
+my @prof_inc;
+# In some (rare) cases, $ENV{HOME} will not be available.
+# - Handle that gracefully by not emitting "Uninitialized ...".
+push @prof_inc, "$ENV{HOME}/.lintian/profiles" if defined $ENV{HOME};
+push @prof_inc, '/etc/lintian/profiles';
+
my $experimental_output_opts = undef;
diff --git a/frontend/lintian-info b/frontend/lintian-info
index a1e5435..6406a18 100755
--- a/frontend/lintian-info
+++ b/frontend/lintian-info
@@ -42,11 +42,12 @@ use Lintian::Internal::FrontendUtil;
use Lintian::Profile;
my %already_displayed = ();
-my @proc_inc = (
- "$ENV{HOME}/.lintian/profiles",
- '/etc/lintian/profiles',
- "$ENV{'LINTIAN_ROOT'}/profiles"
-);
+my @proc_inc;
+# In some (rare) cases, $ENV{HOME} will not be available.
+# - Handle that gracefully by not emitting "Uninitialized ...".
+push @proc_inc, "$ENV{HOME}/.lintian/profiles" if defined $ENV{HOME};
+push @proc_inc, '/etc/lintian/profiles', "$ENV{'LINTIAN_ROOT'}/profiles";
+
my ($annotate, $tags, $help, $prof);
my $profile;
Getopt::Long::config('bundling', 'no_getopt_compat', 'no_auto_abbrev');
diff --git a/lib/Lintian/Data.pm b/lib/Lintian/Data.pm
index c97c1e9..ff6a1b5 100644
--- a/lib/Lintian/Data.pm
+++ b/lib/Lintian/Data.pm
@@ -98,8 +98,12 @@ sub new {
my ($self, $type, $vendors, $start) = @_;
my $root = $profile->root;
my $file;
- my @basedirs = ("$ENV{'HOME'}/.lintian/vendors", "$root/vendors", '/etc/lintian/vendors');
my $cur = $start;
+ my @basedirs;
+ # Gracefully handle $ENV{'HOME'} being unset
+ push @basedirs, "$ENV{'HOME'}/.lintian/vendors" if defined $ENV{'HOME'};
+ push @basedirs, "$root/vendors", '/etc/lintian/vendors';
+
# Do not allow user or system settings to affect the test results.
@basedirs = ("$root/vendors") if $ENV{'LINTIAN_INTERNAL_TESTSUITE'};
OUTER: for (; $cur < scalar @$vendors ; $cur++) {
diff --git a/private/runtests b/private/runtests
index f38801c..e7f184e 100755
--- a/private/runtests
+++ b/private/runtests
@@ -26,6 +26,8 @@ LINTIAN_PROFILE=debian
LINTIAN_INTERNAL_TESTSUITE=1
NO_PKG_MANGLE=true
unset MAKEFLAGS
+# Ensure Lintian works without $ENV{HOME}
+unset HOME
[ "$TEST_WORK_DIR" ] || TEST_WORK_DIR="debian/test-out"
--
Debian package checker
Reply to: