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

[SCM] Debian package checker branch, master, updated. 2.5.11-165-g0b82e39



The following commit has been merged in the master branch:
commit 0b82e390043542f7951ab4d6a9f08f17413c6db9
Author: Niels Thykier <niels@thykier.net>
Date:   Sun Feb 17 12:56:28 2013 +0100

    lintian: Add --ignore-lintian-env cmd line option
    
    Add a new command line option ("--ignore-lintian-env") to make lintian
    ignore all of environment variables matching "LINTIAN_*".  Other
    environment variables like TMPDIR and DEB_VENDOR are unaffected by
    this.
    
    Signed-off-by: Niels Thykier <niels@thykier.net>

diff --git a/debian/changelog b/debian/changelog
index fab906f..5be67a6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -177,6 +177,8 @@ lintian (2.5.12) UNRELEASED; urgency=low
       to be ignored.
     + [NT] Accept the magic token "{VENDOR}" as a part of the value
       to --profile.
+    + [NT] Add new command line option "--ignore-lintian-env" to make
+      lintian ignore all environment variables starting with LINTIAN_.
 
   * lib/Lintian/Collect.pm:
     + [NT] Add "is_non_free" method to easily check of a given
diff --git a/frontend/lintian b/frontend/lintian
index 492fde0..a7e9a51 100755
--- a/frontend/lintian
+++ b/frontend/lintian
@@ -204,6 +204,7 @@ Behaviour options:
 Configuration options:
     --cfg CONFIGFILE          read CONFIGFILE for configuration
     --no-cfg                  do not read any config files
+    --ignore-lintian-env      ignore LINTIAN_* env variables
     --include-dir DIR         include checks, libraries (etc.) from DIR
     -j X, --jobs X            limit the number of parallel unpacking jobs to X
     --lab LABDIR              use LABDIR as permanent laboratory
@@ -503,6 +504,7 @@ my %opthash = (                 # ------------------ actions
                'root=s' => \$opt{'LINTIAN_ROOT'},
 
                'jobs|j:i' => \$opt{'jobs'},
+               'ignore-lintian-env' => \$opt{'ignore-lintian-env'},
                'include-dir=s' => \@search_dirs,
                'user-dirs!' => \$opt{'user-dirs'},
 
@@ -546,6 +548,10 @@ if ($> == 0 and not $allow_root) {
     print STDERR "warning: the authors of lintian do not recommend running it with root privileges!\n";
 }
 
+if ($opt{'ignore-lintian-env'}) {
+    delete $ENV{$_} for grep { m/^LINTIAN_/ } keys %ENV;
+}
+
 # }}}
 
 # {{{ Read important environment
diff --git a/man/lintian.pod.in b/man/lintian.pod.in
index 0f77870..4202b29 100644
--- a/man/lintian.pod.in
+++ b/man/lintian.pod.in
@@ -396,12 +396,21 @@ variable.
 Do not read any configuration file.  This option overrides the
 B<--cfg> above.
 
-=item B<--lab> labdir
+=item B<--ignore-lintian-env>
 
-Use labdir as the permanent laboratory.  This is where Lintian keeps
-information about the packages it checks.  This option overrides the
-B<LINTIAN_LAB> environment variable and the configuration file entry
-of the same name.
+Ignore all environment variables starting with I<LINTIAN_>.
+
+This option is mostly useful for applications running B<lintian> for
+checking packages and do not want the invoking user to affect the
+result (by setting LINTIAN_ROOT, LINTIAN_PROFILE etc.).
+
+Note it does I<not> cause B<lintian> to ignore the entire environment
+like I<TMPDIR> or I<DEB_VENDOR>.  The latter can affect the default
+profile (or "{VENDOR}" token for B<--profile>).
+
+Should usually be combined with B<--no-user-dirs> (or unsetting
+$HOME).  Otherwise, users can work around this option by shadowing the
+checks or libraries in their I<$HOME/.lintian>.
 
 =item B<--include-dir> dir
 
@@ -414,7 +423,7 @@ files, support libraries and checks.  The latter two implies that
 Lintian may attempt to I<load and execute code> from this directory.
 
 Unlike with the B<--root> option, B<lintian> will I<not> load
-collections from this directory.
+collections nor the I<lintianrc> from this directory.
 
 This option may appear more than once; each time adding an additional
 directory.  Directories are searched in the order they appear on the
@@ -435,6 +444,13 @@ This option overrides the B<jobs> variable in the configuration file.
 By default Lintian will use I<nproc> to determine a reasonable default
 (or 2, if the nproc fails).
 
+=item B<--lab> labdir
+
+Use labdir as the permanent laboratory.  This is where Lintian keeps
+information about the packages it checks.  This option overrides the
+B<LINTIAN_LAB> environment variable and the configuration file entry
+of the same name.
+
 =item B<--root> rootdir
 
 Look for B<lintian>'s support files (such as check scripts and
@@ -458,6 +474,15 @@ is always included.
 These option can appear multiple times, in which case the of them
 to appear determines the result.
 
+Note that if the intention is only to disable the user's I<$HOME>,
+then unsetting $HOME may suffice.  Alternatively, I</etc> can be
+"re-added" by using I<--include-dir> (caveat: I</etc/lintianrc> will
+be ignored by this).
+
+If the intention is to avoid (unintentional) side-effects from the
+calling user, then this option could be combined with
+B<--ignore-lintian-env>.
+
 =back
 
 Package selection options:

-- 
Debian package checker


Reply to: