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

[lintian] 02/05: dplint: Make all include dirs absolute as needed



This is an automated email from the git hooks/post-receive script.

nthykier pushed a commit to branch master
in repository lintian.

commit c57c41e07aa7b1d6aecac32feb8284e966d78f71
Author: Niels Thykier <niels@thykier.net>
Date:   Sun Jan 1 11:28:48 2017 +0000

    dplint: Make all include dirs absolute as needed
    
    Various helpers implicitly rely on this for some include dirs (notably
    "INIT_ROOT"/"LINTIAN_ROOT").  This commit makes dplint consistent in
    turning all include paths into absolute paths before passing them on.
    
    Signed-off-by: Niels Thykier <niels@thykier.net>
---
 debian/changelog |  4 ++++
 frontend/dplint  | 11 ++++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index c9c4c87..6b8d6e2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -15,6 +15,10 @@ lintian (2.5.51) UNRELEASED; urgency=medium
   * lib/Lintian/CheckScript.pm:
     + [NT] Remove fallback code for "old" style "pm"-less checks.
 
+  * frontend/dplint:
+    + [NT] Ensure all include directories are absolute before passing
+      them on to the actual command.
+
  -- Bastien Roucariès <roucaries.bastien+debian@gmail.com>  Fri, 30 Dec 2016 17:14:54 +0100
 
 lintian (2.5.50) unstable; urgency=medium
diff --git a/frontend/dplint b/frontend/dplint
index 59125c2..5b39552 100755
--- a/frontend/dplint
+++ b/frontend/dplint
@@ -57,7 +57,7 @@ package dplint;
 use strict;
 use warnings;
 
-use Cwd qw(realpath);
+use Cwd qw(getcwd realpath);
 use File::Basename qw(dirname basename);
 use Getopt::Long();
 
@@ -66,6 +66,9 @@ use Getopt::Long();
 # is simply a placeholder to make the command work out of the box in
 # the source tree.
 my $INIT_ROOT = find_source_root();
+# NB: @INCLUDE_DIRS + @RESTRICTED_INCLUDE_DIRS should /only/ have
+# absolute paths.  Various bit of lintian code implicitly rely on
+# this.
 my (@INCLUDE_DIRS, @RESTRICTED_INCLUDE_DIRS);
 my $LINTIAN_VERSION; # Substituted during build/install
 
@@ -126,6 +129,12 @@ sub setup_env {
         if (exists($ENV{'HOME'}) or exists($ENV{'XDG_CONFIG_HOME'})) {
             $data_home = data_home('lintian');
         }
+        if (defined($data_home) and $data_home !~ m@^/@) {
+            # Turn the path into an absolute one.  Just in case
+            # someone sets a relative HOME dir.
+            my $cwd = getcwd();
+            $data_home = "${cwd}/${data_home}";
+        }
         unshift(@RESTRICTED_INCLUDE_DIRS, $data_home)
           if defined($data_home) && -d $data_home;
         unshift(@RESTRICTED_INCLUDE_DIRS, '/etc/lintian')

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git


Reply to: