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

Bug#717001: lintian appears to exit with error message, probably perl related, on squeeze



Control: retitle -1 lintian: 2.5.14 not supported on Squeeze
Control: tags -1 confirmed wontfix

On 2013-07-15 23:06, Faheem Mitha wrote:
> Package: lintian
> Version: 2.5.14
> Severity: minor
> 

Hi,

> 
> I'm aware that squeeze is no longer stable, and therefore probably not
> supported. Regardless, I just installed 2.5.14 on squeeze. It
> installed without error, but appears to exit with an error message,
> see below.
> 

Indeed, all the code for supporting Squeeze has been removed in 2.5.14,
so it will generally not work.  Oldstable is currently not a requirement
for Lintian and I am not willing to actively maintain it myself at the
moment.
  If you are interested in maintaining a squeeze backport, you are more
than welcome to do so.  I will gladly help you get started and you are
welcome to maintain this backport as a branch in the lintian git repository.


At the moment, the Lintian codebase is probably still "mostly"
compatible with Squeeze.  I have attached 4 patches you definitely want
to carry if you are rebuilding Lintian for Squeeze[1].  Mind you, the
codebase may still need a bit of fix up beyond these patches.

> The error in question refers to the line
> 
> STDOUT->autoflush;
> 

I suspect, you can fix this by adding a "use FileHandle;" to
frontend/lintian.  If that fails, you can replace the line with (I
believe) "$| = 1;".

> Since the dependencies were satisfied, this may reflect some
> versioning issue.
> 
>                                              Regards, Faheem
> 
> [...]


Yes, we deliberately removed that versioning since it was satisfied in
stable (see the 0002-patch).  Also, without the other patches listed
above/attached, the versioning is meaningless as Lintian would still be
broken (even with its "old" dependencies satisfied).

~Niels

[1] Admittedly, the patches are based on the current master branch
rather than the current release, so they may apply with fuzz or not at
all against the source of 2.5.14.


>From 788ad274b4ee42290fdd7747ef028650b632787f Mon Sep 17 00:00:00 2001
From: Niels Thykier <niels@thykier.net>
Date: Mon, 15 Jul 2013 23:26:26 +0200
Subject: [PATCH 1/4] Revert "minimum-version.t: Allow Perl 5.14.2 features"

This reverts commit ee248d177780eb28e36309110d02079b6fc96e52.
---
 t/scripts/minimum-version.t |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/t/scripts/minimum-version.t b/t/scripts/minimum-version.t
index 78255f1..6cd1ebc 100755
--- a/t/scripts/minimum-version.t
+++ b/t/scripts/minimum-version.t
@@ -11,8 +11,8 @@ use Test::More;
 eval 'use Test::MinimumVersion';
 plan skip_all => 'Test::MinimumVersion required to run this test' if $@;
 
-# squeeze => 5.10.1, Wheezy => 5.14.2
-our $REQUIRED = 'v5.14.2';
+# sarge was released with 5.8.4, etch with 5.8.8, lenny with 5.10.0
+our $REQUIRED = 'v5.10.0';
 
 our @PATHS = qw(checks collection frontend lib reporting private);
 
-- 
1.7.10.4

>From ceabf5caa1af362a01ee4adc3af4ad542477da88 Mon Sep 17 00:00:00 2001
From: Niels Thykier <niels@thykier.net>
Date: Mon, 15 Jul 2013 23:27:13 +0200
Subject: [PATCH 2/4] Revert "d/control: Remove dependencies satisfied in
 stable"

This reverts commit 90dcfbbcf4b523ed7a8220a9660b60ae774e5980.

Conflicts:
	debian/changelog
---
 debian/changelog |    2 --
 debian/control   |   15 ++++++++++++---
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index b8a9b28..6267e79 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -315,8 +315,6 @@ lintian (2.5.13) unstable; urgency=low
       Jover for the suggestion.  (Closes: #706241)
 
   * debian/control:
-    + [NT] Remove irrelevant (versioned) dependencies that are now
-      trivially satisfied in stable.
     + [NT] Recommend libautodie-perl (>= 2.18) and libperlio-gzip-perl
       as these can greatly effect performance of Lintian.
   * debian/lintian.install:
diff --git a/debian/control b/debian/control
index bcba816..2cff30a 100644
--- a/debian/control
+++ b/debian/control
@@ -16,14 +16,16 @@ Build-Depends: binutils,
                diffstat,
                docbook-utils,
                docbook-xml,
+               dpkg-dev (>= 1.16.1~),
                fakeroot,
                file,
                gettext,
-               hardening-includes,
+               hardening-includes (>= 2.2~),
                intltool-debian,
-               javahelper,
+               javahelper (>= 0.32~),
                libapt-pkg-perl,
                libarchive-zip-perl,
+               libc-bin (>= 2.13) | locales,
                libclass-accessor-perl,
                libclone-perl,
                libdpkg-perl,
@@ -47,6 +49,8 @@ Build-Depends: binutils,
                man-db,
                patchutils,
                perl,
+               perl (>= 5.12) | libtest-simple-perl (>= 0.93),
+               perl (>= 5.14~) | libautodie-perl (>= 2.10~),
                python,
                python-all-dev,
                python-numpy,
@@ -55,6 +59,7 @@ Build-Depends: binutils,
                t1utils,
                unzip,
                xz-utils,
+               xz-utils (>= 5.1.1alpha+20120614) | xz-lzma | lzma,
                zip
 Standards-Version: 3.9.4
 Vcs-Git: git://anonscm.debian.org/lintian/lintian.git
@@ -68,10 +73,11 @@ Depends: binutils,
          diffstat,
          file,
          gettext,
-         hardening-includes,
+         hardening-includes (>= 2.2~),
          intltool-debian,
          libapt-pkg-perl,
          libarchive-zip-perl,
+         libc-bin (>= 2.13) | locales,
          libclass-accessor-perl,
          libclone-perl,
          libdigest-sha-perl,
@@ -87,6 +93,7 @@ Depends: binutils,
          man-db,
          patchutils,
          perl,
+         perl (>= 5.14~) | libautodie-perl (>= 2.10~),
          t1utils,
          ${misc:Depends}
 Recommends: libautodie-perl (>= 2.18),
@@ -95,6 +102,8 @@ Suggests: binutils-multiarch,
           dpkg-dev,
           libhtml-parser-perl,
           libtext-template-perl,
+          lzma,
+          man-db (>= 2.5.1-1),
           xz-utils
 Multi-Arch: foreign
 Description: Debian package checker
-- 
1.7.10.4

>From 6b0261ce5809a6aefede48cc7e8caced3cda13b8 Mon Sep 17 00:00:00 2001
From: Niels Thykier <niels@thykier.net>
Date: Mon, 15 Jul 2013 23:28:17 +0200
Subject: [PATCH 3/4] Revert "Remove the code for setting/updating LOCPATH"

This reverts commit 699ba59bee1a2bf27682bfe092c8e741ec0e1e7f.

Conflicts:
	debian/changelog
	lib/Lintian/Util.pm
---
 debian/changelog    |    3 ---
 frontend/lintian    |    9 +++++++++
 lib/Lintian/Util.pm |   37 ++++++++++++++++++++++++++++++++++---
 private/runtests    |   25 +++++++++++++++++++++++++
 4 files changed, 68 insertions(+), 6 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 6267e79..6fe881b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -333,7 +333,6 @@ lintian (2.5.13) unstable; urgency=low
       of introducing security issues.
 
   * frontend/lintian:
-    + [NT] Ignore LINTIAN_ROOT/locale and /var/lib/lintian/locale.
     + [NT] Export LINTIAN_INCLUDE_DIRS and LINTIAN_HELPERS_DIR to
       subprocesses.  These are ":"-separated lists of dirs used by
       Lintian.  The first being a list of raw include dirs and the
@@ -375,8 +374,6 @@ lintian (2.5.13) unstable; urgency=low
     + [NT] Replace resolve_pkg_path with to normalize_pkg_path.
       The latter has slightly different return values in some
       cases.
-    + [NT] Avoid the LOCPATH dance to find the path to an UTF-8
-      locale now that stable's libc-bin provides C.UTF-8 for us.
     + [NT] Add new function, locate_helper_tool, to find helper
       tools.
 
diff --git a/frontend/lintian b/frontend/lintian
index 25a610c..30e8a3e 100755
--- a/frontend/lintian
+++ b/frontend/lintian
@@ -861,6 +861,15 @@ if ($debug) {
     $opt{'verbose'} = 0 unless defined $opt{'verbose'};
 }
 
+# Use our custom-generated locale for programs we call, if it's available.  We
+# first look in the Lintian root and then in /var/lib/lintian, which is the
+# standard location for the install-time-generated locale.
+if (-d "$opt{'LINTIAN_ROOT'}/locale/en_US.UTF-8") {
+    $ENV{LOCPATH} = "$opt{'LINTIAN_ROOT'}/locale";
+} elsif (-d '/var/lib/lintian/locale/en_US.UTF-8') {
+    $ENV{LOCPATH} = '/var/lib/lintian/locale';
+}
+
 $Lintian::Output::GLOBAL->verbosity_level ($opt{'verbose'});
 $Lintian::Output::GLOBAL->debug ($debug);
 $Lintian::Output::GLOBAL->color ($opt{'color'});
diff --git a/lib/Lintian/Util.pm b/lib/Lintian/Util.pm
index 3b94b8d..7535a92 100644
--- a/lib/Lintian/Util.pm
+++ b/lib/Lintian/Util.pm
@@ -786,21 +786,52 @@ The list of whitelisted %ENV variables are:
  LOCPATH
  LC_ALL (*)
 
-(*) LC_ALL is a special case as clean_env will change its value to
-either "C.UTF-8" or "C" (if CLOC is given and a truth value).
+(*) LC_ALL is a special case as clean_env will change its value using
+the following rules:
+
+
+If CLOC is given (and a truth value), clean_env will set LC_ALL to
+"C".
+
+Otherwise, clean_env sets LC_ALL to "C.UTF-8" or "en_US.UTF-8" by
+checking for the presence of the following paths (in preferred order):
+
+ $ENV{LOCPATH}/C.UTF-8
+ $ENV{LOCPATH}/en_US.UTF-8
+ /usr/lib/locale/C.UTF-8
+ /usr/lib/locale/en_US.UTF-8
+
+If none of these exists, LC_ALL is set to en_US.UTF-8 (as locales-all
+provides that locale without creating any paths in /usr/lib/locaale).
 
 =cut
 
 sub clean_env {
     my ($cloc) = @_;
     my @whitelist = qw(PATH INTLTOOL_EXTRACT LOCPATH);
+    my @locales = qw(C.UTF-8 en_US.UTF-8);
     my %newenv = map { exists $ENV{$_} ? ($_ => $ENV{$_}) : () } (@whitelist, @_);
     %ENV = %newenv;
-    $ENV{'LC_ALL'} = 'C.UTF-8';
 
     if ($cloc) {
         $ENV{LC_ALL} = 'C';
+        return;
+    }
+
+    foreach my $locpath ($ENV{LOCPATH}, '/usr/lib/locale') {
+        if ($locpath && -d $locpath) {
+            foreach my $loc (@locales) {
+                if ( -d "$locpath/$loc" ) {
+                    $ENV{LC_ALL} = $loc;
+                    return;
+                }
+            }
+        }
     }
+    # We could not find any valid locale so far - presumably we get our locales
+    # from "locales-all", so just set it to "en_US.UTF-8".
+    # (related bug: #663459)
+    $ENV{LC_ALL} = 'en_US.UTF-8';
     return;
 }
 
diff --git a/private/runtests b/private/runtests
index be04ae0..de51852 100755
--- a/private/runtests
+++ b/private/runtests
@@ -53,6 +53,31 @@ fail(){
     exit 1
 }
 
+# In Wheezy (and newer) libc-bin provides a C.UTF-8 locale.
+# In Squeeze (and older) we either need locales-all or generate
+# an en_US.UTF-8 locale ourselves.
+if [ -e "/usr/lib/locale/C.UTF-8" ] ; then
+    echo "Using C.UTF-8 locale from /usr/lib/locale"
+    unset LOCPATH
+elif dpkg -l | grep -q ^"ii *locales-all " ; then
+    echo "Using en_US.UTF-8 locale from locales-all"
+    unset LOCPATH
+else
+    LOCPATH="$(pwd)/debian/test.locale"
+    export LOCPATH
+
+    # Apparently, it is not possible to generate a C.UTF-8 locale in
+    # Squeeze, so settle with an en_US.UTF-8 one.
+    if [ ! -e "$LOCPATH"/en_US.UTF-8 ] ; then
+        echo "Generating en_US.UTF-8 locale for the test suite"
+        mkdir -p "$LOCPATH"
+        localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias \
+            --quiet "$LOCPATH"/en_US.UTF-8 || fail "Locale generation failed"
+    else
+        echo "Using pre-generated en_US.UTF-8 locale in $LOCPATH"
+    fi
+fi
+
 if [ "${NEW_SUITE}" = 1 ] ; then
     t/runtests --dump-logs -k $PARALLEL_ARGS t "$TEST_WORK_DIR" "$@"
 fi
-- 
1.7.10.4

>From 952d7e1bf71b822af7837035f5cd7b6ad9f9bfcc Mon Sep 17 00:00:00 2001
From: Niels Thykier <niels@thykier.net>
Date: Mon, 15 Jul 2013 23:28:55 +0200
Subject: [PATCH 4/4] Revert "d/{postinst,prerm,triggers}: Drop unused files"

This reverts commit 60e8779bc2dc256de3ea6590bb00ac7cd132c0d1.

Conflicts:
	debian/changelog
---
 debian/changelog |    6 ------
 debian/postinst  |   50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 debian/prerm     |   14 ++++++++++++++
 debian/triggers  |    3 +++
 4 files changed, 67 insertions(+), 6 deletions(-)
 create mode 100644 debian/postinst
 create mode 100644 debian/prerm
 create mode 100644 debian/triggers

diff --git a/debian/changelog b/debian/changelog
index 6fe881b..d3cb5f1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -319,12 +319,6 @@ lintian (2.5.13) unstable; urgency=low
       as these can greatly effect performance of Lintian.
   * debian/lintian.install:
     + [NT] Install "helpers" as /usr/share/lintian/helpers
-  * debian/{postinst,prerm}:
-    + [NT] Remove unused maintainer scripts now that stable's
-      libc-bin provides a C.UTF-8.
-  * debian/triggers:
-    + [NT] Remove unused trigger now that stable's libc-bin
-      provides a C.UTF-8.
 
   * doc/tutorial/**/*.pod:
     + [NT] Fix a number of spelling mistakes in the POD.
diff --git a/debian/postinst b/debian/postinst
new file mode 100644
index 0000000..bf64725
--- /dev/null
+++ b/debian/postinst
@@ -0,0 +1,50 @@
+#!/bin/sh
+#
+# Lintian requires a UTF-8 locale in order to properly do man page tests.
+# Generate one at installation time so that we're guaranteed to have one.
+
+set -eu
+
+locale_dir=/var/lib/lintian/locale
+
+gen_locale() {
+    echo 'Generating en_US.UTF-8 locale for internal Lintian use....'
+    mkdir -p "$locale_dir"
+    if ! localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias \
+                --quiet "$locale_dir"/en_US.UTF-8 ; then
+        rm -rf "$locale_dir"
+        exit 1
+    fi
+}
+
+if [ "$1" = "configure" ]; then
+    if [ ! -f "$locale_dir/en_US.UTF-8/LC_CTYPE" ] &&
+	[ -f /usr/share/locale/locale.alias ] &&
+	[ ! -d /usr/lib/locale/C.UTF-8/ ] ; then
+
+	# handle upgrades from the previous, incorrect, directory:
+	rm -rf "$locale_dir"
+	gen_locale
+    elif [ -d "$locale_dir" -a -d /usr/lib/locale/C.UTF-8/ ] ; then
+        # handle upgrades into a system with the libc C.UTF-8
+        rm -rf "$locale_dir"
+    fi
+fi
+
+if [ "$1" = "triggered" ]; then
+    # Remove our locale directory in all cases:
+    # If locales is removed, locales-all should provide us the locale
+    # we want.
+    # If locales is upgraded, we should still regenerate our locale.
+    # If the libc provided C.UTF-8 appeared, we do not need our locale
+    # anymore.
+    rm -rf "$locale_dir"
+
+    if [ -f /usr/share/locale/locale.alias ] &&
+	[ ! -d /usr/lib/locale/C.UTF-8/ ] ; then
+
+	gen_locale
+    fi
+fi
+
+#DEBHELPER#
diff --git a/debian/prerm b/debian/prerm
new file mode 100644
index 0000000..76f97cb
--- /dev/null
+++ b/debian/prerm
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+set -e
+
+#
+# Remove our generated locale if we are not upgrading or
+# we are upgrading into a system with a libc provided
+# C.UTF-8 (libc-bin >= 2.13)
+
+if [ 'upgrade' != "$1" -o -d '/usr/lib/locale/C.UTF-8/' ] ; then
+    rm -rf /var/lib/lintian/
+fi
+
+#DEBHELPER#
diff --git a/debian/triggers b/debian/triggers
new file mode 100644
index 0000000..4cdecc2
--- /dev/null
+++ b/debian/triggers
@@ -0,0 +1,3 @@
+interest /usr/share/locale/locale.alias
+interest /usr/lib/locales-all
+interest /usr/lib/locale/C.UTF-8
-- 
1.7.10.4


Reply to: