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

Bug#847596: locales-all non-deterministically generates either kk_KZ.PT154 or kk_KZ.RK1048 despite declaring support for both



Package: locales-all
Version: 2.24-7
Severity: normal

Dear Maintainer,

The build of locales-all sometimes generates kk_KZ.PT154 (about 1/6 of the
time) and sometimes generates kk_KZ.RK1048 (about 5/6 of the time), even though
it declares support for both. Note also that RK1048 is patched in, via
debian/patches/localedata/supported.diff. You can find my test files here:

https://people.debian.org/~infinity0/res/debrepro/

Some of them are attached, for your convenience.

To build these, I applied glibc.debdiff to 2.24-7 then ran `debrepro` on the
unpacked source tree. Note they are reproducible except for locales-all. Note
also that `debrepro` does not reliably reproduce this unreproducibility, you
have to run it a few times to see it. I ran it 3 times, for a total of 6
builds, before I saw this. Then:

$ sudo dpkg -i first/libc6_2.24-7.1_amd64.deb
[..]
$ sudo dpkg -i first/libc-bin_2.24-7.1_amd64.deb
[..]
$ sudo dpkg -i first/libc-l10n_2.24-7.1_all.deb
[..]
$ sudo dpkg -i first/locales_2.24-7.1_all.deb
[..]

$ sudo dpkg -i first/locales-all_2.24-7.1_amd64.deb
[..]
$ python3 ./localetest.py 
** error trying to set locale to kk_KZ.PT154
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory

$ sudo dpkg -i second/locales-all_2.24-7.1_amd64.deb 
[..]
$ python3 ./localetest.py
** error trying to set locale to kk_KZ.RK1048
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory


-- System Information:
Debian Release: stretch/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable-debug'), (500, 'testing-debug'), (300, 'unstable'), (200, 'experimental'), (1, 'experimental-debug')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.6.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.utf8, LC_CTYPE=en_GB.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
diff -Nru glibc-2.24/debian/changelog glibc-2.24/debian/changelog
--- glibc-2.24/debian/changelog	2016-11-25 22:09:39.000000000 +0000
+++ glibc-2.24/debian/changelog	2016-11-15 18:03:37.000000000 +0000
@@ -1,3 +1,10 @@
+glibc (2.24-7.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Try for reproducibility.
+
+ -- Ximin Luo <infinity0@profitbricks-build17-amd64>  Tue, 15 Nov 2016 18:03:37 +0000
+
 glibc (2.24-7) unstable; urgency=medium
 
   [ Samuel Thibault ]
diff -Nru glibc-2.24/debian/rules glibc-2.24/debian/rules
--- glibc-2.24/debian/rules	2016-11-25 21:59:04.000000000 +0000
+++ glibc-2.24/debian/rules	2016-11-15 18:03:37.000000000 +0000
@@ -45,6 +45,7 @@
 
 DEB_SOURCE_PACKAGE := $(strip $(shell egrep '^Source: ' debian/control | cut -f 2 -d ':'))
 
+SOURCE_DATE_EPOCH ?= $(shell dpkg-parsechangelog -STimestamp)
 DEB_VERSION := $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ')
 GLIBC_VERSION = $(shell echo $(DEB_VERSION) | sed -e 's/.*://' -e 's/[+-].*//')
 
diff -Nru glibc-2.24/debian/rules.d/build.mk glibc-2.24/debian/rules.d/build.mk
--- glibc-2.24/debian/rules.d/build.mk	2016-11-25 12:02:24.000000000 +0000
+++ glibc-2.24/debian/rules.d/build.mk	2016-11-15 18:03:37.000000000 +0000
@@ -316,18 +316,16 @@
 $(stamp)source: $(stamp)patch
 	mkdir -p $(build-tree)
 	cd .. && \
-	       find $(GLIBC_SOURCES) -depth -newermt '$(DEB_BUILD_DATE)' \
-			-print0 | \
-               xargs -0r touch --no-dereference --date='$(DEB_BUILD_DATE)'
-	cd .. && \
 		find $(GLIBC_SOURCES) -print0 | \
 		LC_ALL=C sort -z | \
 		tar -c -J --null -T - --no-recursion \
 			--mode=go=rX,u+rw,a-s \
+			--clamp-mtime --mtime "@$(SOURCE_DATE_EPOCH)" \
 			--owner=root --group=root --numeric-owner \
 			-f $(CURDIR)/$(build-tree)/glibc-$(GLIBC_VERSION).tar.xz
 	mkdir -p debian/glibc-source/usr/src/glibc
 	tar cf - --files-from debian/glibc-source.filelist \
+		--clamp-mtime --mtime "@$(SOURCE_DATE_EPOCH)" \
 	  | tar -x -C debian/glibc-source/usr/src/glibc -f -
 
 	touch $@
diff -Nru glibc-2.24/debian/rules.d/debhelper.mk glibc-2.24/debian/rules.d/debhelper.mk
--- glibc-2.24/debian/rules.d/debhelper.mk	2016-11-25 22:08:30.000000000 +0000
+++ glibc-2.24/debian/rules.d/debhelper.mk	2016-11-15 18:03:37.000000000 +0000
@@ -77,8 +77,7 @@
 		-exec chmod a+x '{}' ';'
 	dh_makeshlibs -Xgconv/ -p$(curpass) -V "$(call xx,shlib_dep)"
 	# Add relevant udeb: lines in shlibs files
-	chmod a+x debian/shlibs-add-udebs
-	./debian/shlibs-add-udebs $(curpass)
+	sh ./debian/shlibs-add-udebs $(curpass)
 
 	dh_installdeb -p$(curpass)
 	dh_shlibdeps -p$(curpass)
#!/usr/bin/python3

import subprocess
import sys
import os

with open("/usr/share/i18n/SUPPORTED") as fp:
    for line in fp.readlines():
        fullname, enc = line.rstrip().split(" ", 1)
        if not enc:
            raise ValueError(line)
        enc2, loc = None, None
        if "." in fullname:
            name, rest = fullname.split(".", 1)
            if "@" in rest:
                enc2, loc = rest.split("@", 1)
        elif "@" in fullname:
            name, loc = fullname.split("@", 1)
        else:
            name = fullname
        if enc2 and enc2 != enc:
            raise ValueError(line)

        if loc:
            locale = "%s.%s@%s" % (name, enc, loc)
        else:
            locale = "%s.%s" % (name, enc)
        if not locale:
            raise ValueError(line)
        
        _, err = subprocess.Popen(
            "LC_ALL={0} LANG={0} locale".format(locale),
            stdout=subprocess.DEVNULL,
            stderr=subprocess.PIPE,
            shell=True).communicate()
        if err:
            print("** error trying to set locale to %s" % locale)
            print(err.decode(), end='')

Reply to: