tag 759766 patch
thanks
On Sat, Aug 30, 2014 at 12:20:02PM +0900, Nobuhiro Ban wrote:
> Package: libnkf-perl
> Version: 2.13-3+b1
> Severity: grave
>
> Dear Maintainer,
>
> NKF module for perl doesn't work on i386 arch:
> >% perl -e 'use NKF'
> >Can't use an undefined value as a subroutine reference at
> >/usr/lib/i386-linux-gnu/perl/5.20/DynaLoader.pm line 210.
> >END failed--call queue aborted at /usr/lib/i386-linux-gnu/perl5/5.20/NKF.pm
> >line 210.
> >Compilation failed in require at -e line 1.
> >BEGIN failed--compilation aborted at -e line 1.
>
> It works on amd64 arch.
This is a binary compatibility issue caused by not compiling the module
with flags from $Config{ccflags}, particularly -D_FILE_OFFSET_BITS=64.
I'm attaching a patchset that improves the dpkg-buildflags handling
and doesn't override $Config{ccflags}.
--
Niko Tyni [email protected]
>From 2e8b8850c8a3eb5bab045eddb30f5d255193a6dd Mon Sep 17 00:00:00 2001
From: Niko Tyni <[email protected]>
Date: Fri, 29 Aug 2014 21:52:50 -0700
Subject: [PATCH 1/4] Remove redundant use of buildflags.mk
buildflags.mk and dpkg-buildflags are alternative approaches.
It is useless for the first one to export CFLAGS and LDFLAGS, when
the latter overrides them.
---
debian/rules | 3 ---
1 file changed, 3 deletions(-)
diff --git a/debian/rules b/debian/rules
index 0590fb7..9e7b52d 100755
--- a/debian/rules
+++ b/debian/rules
@@ -7,9 +7,6 @@
# This has to be exported to make some magic below work.
export DH_OPTIONS
-DPKG_EXPORT_BUILDFLAGS = 1
-include /usr/share/dpkg/buildflags.mk
-
CFLAGS=$(shell dpkg-buildflags --get CFLAGS)
LDFLAGS=$(shell dpkg-buildflags --get LDFLAGS)
CFLAGS+=$(HARDENING_CFLAGS)
--
2.1.0
>From 74b2ba0d22a3cf302e5ac79b1931f131db7f28e7 Mon Sep 17 00:00:00 2001
From: Niko Tyni <[email protected]>
Date: Fri, 29 Aug 2014 22:02:38 -0700
Subject: [PATCH 2/4] Use CPPFLAGS from dpkg-buildflags in the build
These currently include -D_FORTIFY_SOURCE=2
---
debian/rules | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/debian/rules b/debian/rules
index 9e7b52d..63ab1f9 100755
--- a/debian/rules
+++ b/debian/rules
@@ -7,7 +7,7 @@
# This has to be exported to make some magic below work.
export DH_OPTIONS
-CFLAGS=$(shell dpkg-buildflags --get CFLAGS)
+CFLAGS=$(shell dpkg-buildflags --get CFLAGS) $(shell dpkg-buildflags --get CPPFLAGS)
LDFLAGS=$(shell dpkg-buildflags --get LDFLAGS)
CFLAGS+=$(HARDENING_CFLAGS)
LDFLAGS+=$(HARDENING_LDFLAGS)
--
2.1.0
>From 129955540dee54a970209152beb191e4f30c2f31 Mon Sep 17 00:00:00 2001
From: Niko Tyni <[email protected]>
Date: Fri, 29 Aug 2014 22:04:51 -0700
Subject: [PATCH 3/4] Pass build flags to the NKF Perl module in OPTIMIZE and
LD
This mirrors what debhelper currently does at compatibility level 9,
and doesn't override $Config{ccflags} from Perl, fixing binary
compatibility issues on 32-bit architectures.
Bug-Debian: https://bugs.debian.org/759766
---
debian/rules | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/debian/rules b/debian/rules
index 63ab1f9..a482f3c 100755
--- a/debian/rules
+++ b/debian/rules
@@ -40,11 +40,11 @@ override_dh_auto_clean:
override_dh_auto_configure:
(cd NKF.mod && \
- /usr/bin/perl Makefile.PL INSTALLDIRS=vendor)
+ /usr/bin/perl Makefile.PL INSTALLDIRS=vendor OPTIMIZE="$(CFLAGS)" LD="cc $(LDFLAGS)")
override_dh_auto_build:
make nkf CC=cc CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)"
- (cd NKF.mod && make CCFLAGS="$(CFLAGS)" LDDFLAGS="$(LDFLAGS)")
+ (cd NKF.mod && make)
override_dh_auto_install:
install -s -m 755 nkf debian/nkf/usr/bin
--
2.1.0
>From 09435ea0c61b08837e16628a470f402906d72794 Mon Sep 17 00:00:00 2001
From: Niko Tyni <[email protected]>
Date: Fri, 29 Aug 2014 22:18:04 -0700
Subject: [PATCH 4/4] Run the NKF.mod test suite too
This would have caught the binary compatibility issues
in #759766.
---
debian/rules | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/debian/rules b/debian/rules
index a482f3c..b0b6b55 100755
--- a/debian/rules
+++ b/debian/rules
@@ -46,6 +46,10 @@ override_dh_auto_build:
make nkf CC=cc CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)"
(cd NKF.mod && make)
+override_dh_auto_test:
+ make test
+ make -C NKF.mod test
+
override_dh_auto_install:
install -s -m 755 nkf debian/nkf/usr/bin
./debian/nkf/usr/bin/nkf -e nkf.1j > debian/nkf.1j.tmp
--
2.1.0