Package: dpkg
Version: 1.21.22
Severity: minor
Tags: patch
X-Debbugs-Cc: rweiku...@cyberadapt.com

The /usr/share/dpkg/pkg-info.mk file invokes dpkg-parsechangelog to
set the SOURCE_DATE_EPOCH environment variable to the date of the
last changelog entry for the package being built. If this changelog
entry hasn't yet been finalized with a date, eg, if it looks like this
(actual example):

apache2 (2.4.59-ca001-1-deb12u2) unstable; urgency=medium

  * updated to Debian 12 sources

 --

SOURCE_DATE_EPOCH is set to an empty string. This causes the
parse_timestamp routine in build.c to fail and print the (rather
confusing) error message:

unable to parse timestamp '': Success

(Success being printed because errno isn't set). Package generation then
fails because dpkg-deb afterwards terminates with an exit code of 2.

Building such packages may not be a supported feature but I've been
using it for dev builds of packages for about 20 years (and plan to
continue doing so). The included patch avoids the issue by ignoring the
value of SOURCE_DATA_EPOCH when it's empty.

-- patch:
--- a/src/deb/build.c
+++ b/src/deb/build.c
@@ -598,7 +598,7 @@ do_build(const char *const *argv)
   m_output(stdout, _("<standard output>"));
 
   timestamp_str = getenv("SOURCE_DATE_EPOCH");
-  if (timestamp_str)
+  if (timestamp_str && *timestamp_str)
     timestamp = parse_timestamp(timestamp_str);
   else
     timestamp = time(NULL);
--

-- Package-specific info:
This system uses merged-usr-via-aliased-dirs, going behind dpkg's
back, breaking its core assumptions. This can cause silent file
overwrites and disappearances, and its general tools misbehavior.
See <https://wiki.debian.org/Teams/Dpkg/FAQ#broken-usrmerge>.

-- System Information:
Debian Release: 12.5
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 6.1.0-18-amd64 (SMP w/24 CPU threads; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages dpkg depends on:
ii  libbz2-1.0   1.0.8-5+b1
ii  libc6        2.36-9+deb12u4
ii  liblzma5     5.4.1-0.2
ii  libmd0       1.0.4-2
ii  libselinux1  3.4-1+b6
ii  libzstd1     1.5.4+dfsg2-5
ii  tar          1.34+dfsg-1.2+deb12u1
ii  zlib1g       1:1.2.13.dfsg-1

dpkg recommends no packages.

Versions of packages dpkg suggests:
ii  apt            2.6.1
pn  debsig-verify  <none>

-- no debconf information

Reply via email to