[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[SCM] Debian package checker branch, master, updated. 2.5.1-96-ga2c368d



The following commit has been merged in the master branch:
commit a2c368dcbb7830b86e61c399cde3d8bef93e1565
Author: Niels Thykier <niels@thykier.net>
Date:   Thu Jul 14 01:41:35 2011 +0200

    Fixed regression that allowed ENV to overrule cmd-line opts
    
    Also caught an "uninitialized" variable usage with $LINTIAN_ROOT

diff --git a/frontend/lintian b/frontend/lintian
index c2a11c5..d722bbd 100755
--- a/frontend/lintian
+++ b/frontend/lintian
@@ -64,6 +64,11 @@ my @MUST_EXPORT = (qw(
 
 # Environment variables Lintian cares about - the list contains
 # the ones that can also be set via the config file
+#
+# %opt (definde below) will be updated with values of the env
+# after parsing cmd-line options.  A given value in %opt is
+# updated to use the ENV variable if the one in %opt is undef
+# and ENV has a value.
 my @ENV_VARS = (
 # LINTIAN_CFG  - handled manually
 # LINTIAN_ROOT - handled manually
@@ -519,7 +524,7 @@ if (defined $opt{'LINTIAN_ROOT'}) {
     unless ($opt{'LINTIAN_ROOT'} =~ m,^/,) {
 	require Cwd;
 	my $cwd = Cwd::getcwd();
-	$opt{'LINTIAN_ROOT'} = "$cwd/$LINTIAN_ROOT";
+	$opt{'LINTIAN_ROOT'} = "$cwd/$opt{'LINTIAN_ROOT'}";
     }
 } else {
     $opt{'LINTIAN_ROOT'} = '/usr/share/lintian';
@@ -559,8 +564,11 @@ if ($> == 0 and not $allow_root) {
 }
 
 # environment variables overwrite settings in conf file, so load them now
+# assuming they were not set by cmd-line options
 foreach my $var (@ENV_VARS) {
-    $opt{$var} = $ENV{$var} if $ENV{$var};
+    # note $opt{$var} will usually always exists due to the call to GetOptions
+    # so we have to use "defined" here
+    $opt{$var} = $ENV{$var} if $ENV{$var} && ! defined $opt{$var};
 }
 
 # search for configuration file if it was not set with --cfg

-- 
Debian package checker


Reply to: