Bug#636086: [PATCH] Use C.UTF-8 from current libc-bin, rather than our own private en_US.UTF-8
I've attached a git patch fixing this bug.
I omitted the debian/changelog entry to avoid spurious conflicts, but
the contents of the git changelog should work for that purpose.
Please consider applying this patch.
Thanks,
Josh Triplett
>From ba67a2231b3ed9801debcd227f24c20e62c74149 Mon Sep 17 00:00:00 2001
From: Josh Triplett <josh@joshtriplett.org>
Date: Sat, 30 Jul 2011 15:48:09 -0700
Subject: [PATCH] Use C.UTF-8 from current libc-bin, rather than our own
private en_US.UTF-8
Add dependency on libc-bin (>= 2.13-1), and remove dependency on
locales. Change all references to en_US.UTF-8 to use C.UTF-8 instead.
Remove the code generating and managing the private locale, including
the dpkg triggers and the empty /var/lib/lintian directory. Remove the
private locale itself unconditionally in the maintainer scripts. Remove
all the code propagating $LOCPATH. Remove the code in private/runtests
setting LC_COLLATE=C, which can't have mattered since the later code
exporting it had a typo (LC_COLLCATE) rendering it ineffective. Update
the documentation.
---
.gitignore | 1 -
checks/infofiles | 3 +--
checks/manpages | 7 +++----
checks/manpages.desc | 2 +-
debian/control | 2 +-
debian/dirs | 1 -
debian/postinst | 38 ++------------------------------------
debian/prerm | 8 ++------
debian/rules | 1 -
debian/triggers | 2 --
doc/lintian.xml | 7 +++----
frontend/lintian | 9 ---------
lib/Util.pm | 2 +-
private/runtests | 13 +------------
14 files changed, 15 insertions(+), 81 deletions(-)
delete mode 100644 debian/triggers
diff --git a/.gitignore b/.gitignore
index 126c8f2..1f9d0da 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,4 +5,3 @@
/doc/lintian.html/
/doc/lintian.txt
/runtests
-/debian/test.locale/
diff --git a/checks/infofiles b/checks/infofiles
index b1917cf..b38380f 100644
--- a/checks/infofiles
+++ b/checks/infofiles
@@ -89,8 +89,7 @@ foreach my $file (@{$info->sorted_index}) {
fail("cannot fork: $!");
} elsif ($pid == 0) {
my $f = quotemeta($info->unpacked($file));
- my %newenv = (LANG => 'C', PATH => $ENV{PATH},
- LOCPATH => $ENV{LOCPATH});
+ my %newenv = (LANG => 'C', PATH => $ENV{PATH});
undef %ENV;
%ENV = %newenv;
exec "zcat $f 2>&1"
diff --git a/checks/manpages b/checks/manpages
index 39e3ba4..7726f1b 100644
--- a/checks/manpages
+++ b/checks/manpages
@@ -218,8 +218,7 @@ foreach my $file (@{$info->sorted_index}) {
if (not defined $pid) {
fail("cannot run lexgrog: $!");
} elsif ($pid == 0) {
- my %newenv = (LANG => 'en_US.UTF-8', PATH => $ENV{PATH},
- LOCPATH => $ENV{LOCPATH});
+ my %newenv = (LANG => 'C.UTF-8', PATH => $ENV{PATH});
undef %ENV;
%ENV = %newenv;
exec "lexgrog \Q$path\E 2>&1"
@@ -252,8 +251,8 @@ foreach my $file (@{$info->sorted_index}) {
if (not defined $pid) {
fail("cannot run man -E UTF-8 -l: $!");
} elsif ($pid == 0) {
- my %newenv = (LANG => 'en_US.UTF-8', PATH => $ENV{PATH},
- MANWIDTH => 80, LOCPATH => $ENV{LOCPATH});
+ my %newenv = (LANG => 'C.UTF-8', PATH => $ENV{PATH},
+ MANWIDTH => 80);
undef %ENV;
%ENV = %newenv;
exec "($cmd >/dev/null) 2>&1"
diff --git a/checks/manpages.desc b/checks/manpages.desc
index e9106c3..cca0c96 100644
--- a/checks/manpages.desc
+++ b/checks/manpages.desc
@@ -174,7 +174,7 @@ Info: This man page provokes warnings or errors from man.
"Debugging" in the groff manual.
.
To test this for yourself you can use the following command:
- LANG=en_US.UTF-8 MANWIDTH=80 man --warnings -E UTF-8 -l <file> >/dev/null
+ LANG=C.UTF-8 MANWIDTH=80 man --warnings -E UTF-8 -l <file> >/dev/null
Tag: manpage-has-errors-from-pod2man
Severity: normal
diff --git a/debian/control b/debian/control
index 71413f6..497e7c9 100644
--- a/debian/control
+++ b/debian/control
@@ -62,6 +62,7 @@ Depends: binutils,
gettext,
intltool-debian,
libapt-pkg-perl,
+ libc-bin (>= 2.13-1),
libclass-accessor-perl,
libdigest-sha-perl,
libdpkg-perl,
@@ -70,7 +71,6 @@ Depends: binutils,
libparse-debianchangelog-perl,
libtimedate-perl,
liburi-perl,
- locales,
man-db,
perl,
unzip,
diff --git a/debian/dirs b/debian/dirs
index 419b920..ea49a65 100644
--- a/debian/dirs
+++ b/debian/dirs
@@ -1,5 +1,4 @@
etc
usr/bin
usr/share/lintian
-var/lib/lintian
var/spool/lintian
diff --git a/debian/postinst b/debian/postinst
index fd7c783..1ed779d 100644
--- a/debian/postinst
+++ b/debian/postinst
@@ -1,42 +1,8 @@
#!/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 ]; then
-
- # handle upgrades from the previous, incorrect, directory:
- rm -rf "$locale_dir"
- gen_locale
- 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.
- rm -rf "$locale_dir"
-
- if [ -f /usr/share/locale/locale.alias ]; then
- gen_locale
- fi
-fi
+# Remove our old generated locale
+rm -rf /var/lib/lintian/
#DEBHELPER#
diff --git a/debian/prerm b/debian/prerm
index 698ed52..bfc9d93 100644
--- a/debian/prerm
+++ b/debian/prerm
@@ -2,11 +2,7 @@
set -e
-#
-# Remove our generated locale unless we're only upgrading.
-
-if [ 'upgrade' != "$1" ] ; then
- rm -rf /var/lib/lintian/
-fi
+# Remove our old generated locale
+rm -rf /var/lib/lintian/
#DEBHELPER#
diff --git a/debian/rules b/debian/rules
index 626bf81..4b5831a 100755
--- a/debian/rules
+++ b/debian/rules
@@ -81,7 +81,6 @@ clean: $(neededfiles)
rm -rf doc/lintian.html/ doc/lintian.txt
rm -rf debian/tests
rm -rf man/man1/
- rm -fr debian/test.locale
dh_clean
binary-indep: $(neededfiles) build
diff --git a/debian/triggers b/debian/triggers
deleted file mode 100644
index d921082..0000000
--- a/debian/triggers
+++ /dev/null
@@ -1,2 +0,0 @@
-interest /usr/share/locale/locale.alias
-interest /usr/lib/locales-all
diff --git a/doc/lintian.xml b/doc/lintian.xml
index 1716f74..37d4b7d 100644
--- a/doc/lintian.xml
+++ b/doc/lintian.xml
@@ -287,10 +287,9 @@
</para>
<para>
The only known caveat of using Lintian from the source
- directory is that Lintian requires a C.UTF-8 (or en_US.UTF-8)
- locale to correctly process some files.
- The <systemitem role="package">lintian</systemitem> Debian
- package will set up this locale during installation.
+ directory is that Lintian requires a C.UTF-8 locale to
+ correctly process some files. libc-bin 2.13-1 and later
+ provide such a locale.
</para>
</sect1>
diff --git a/frontend/lintian b/frontend/lintian
index dc6ffbb..93e6290 100755
--- a/frontend/lintian
+++ b/frontend/lintian
@@ -696,15 +696,6 @@ if ($ENV{'LINTIAN_INTERNAL_TESTSUITE'}){
$opt{'verbose'} = 1 if $debug;
$ENV{'LINTIAN_DEBUG'} = $debug;
-# 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 "$LINTIAN_ROOT/locale/en_US.UTF-8") {
- $ENV{LOCPATH} = "$LINTIAN_ROOT/locale";
-} elsif (-d '/var/lib/lintian/locale/en_US.UTF-8') {
- $ENV{LOCPATH} = '/var/lib/lintian/locale';
-}
-
# }}}
# {{{ Loading lintian's own libraries (now LINTIAN_ROOT is known)
diff --git a/lib/Util.pm b/lib/Util.pm
index 08b5a8e..e587b84 100644
--- a/lib/Util.pm
+++ b/lib/Util.pm
@@ -254,7 +254,7 @@ sub file_is_encoded_in_non_utf8 {
# Just like system, except cleanses the environment first to avoid any strange
# side effects due to the user's environment.
sub system_env {
- my @whitelist = qw(PATH INTLTOOL_EXTRACT LOCPATH);
+ my @whitelist = qw(PATH INTLTOOL_EXTRACT);
my %newenv = map { exists $ENV{$_} ? ($_ => $ENV{$_}) : () } @whitelist;
my $pid = fork;
if (not defined $pid) {
diff --git a/private/runtests b/private/runtests
index f6fe04b..6fdf1ee 100755
--- a/private/runtests
+++ b/private/runtests
@@ -15,20 +15,16 @@ if [ "$1" = "-t" ] ; then
TAG=yes
fi
-LANG="en_US.UTF-8"
-LC_COLLATE="C"
+LANG="C.UTF-8"
LINTIAN_ROOT=""
LINTIAN_PROFILE=debian
LINTIAN_INTERNAL_TESTSUITE=1
-LOCPATH="$(pwd)/debian/test.locale"
NO_PKG_MANGLE=true
export LANG
-export LC_COLLCATE
export LINTIAN_ROOT
export LINTIAN_PROFILE
export LINTIAN_INTERNAL_TESTSUITE
-export LOCPATH
export NO_PKG_MANGLE
fail(){
@@ -36,13 +32,6 @@ fail(){
exit 1
}
-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"
-fi
-
t/runtests --dump-logs -k $PARALLEL_ARGS t debian/tests "$@"
if [ "$TAG" = "" ] ; then
testset/runtests -k testset debian/tests "$@"
--
1.7.5.4
Reply to: