This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch main
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=0f503ee3aafaa0a3a955fdd3c63c043b42664d6c

commit 0f503ee3aafaa0a3a955fdd3c63c043b42664d6c
Author: Guillem Jover <[email protected]>
AuthorDate: Thu Apr 25 22:44:19 2024 +0200

    src: Check whether SOURCE_DATE_EPOCH is set before parsing it
    
    The dpkg-deb and dpkg-split program try to parse this environment
    variable to use it for their timestamps inside files to generate
    reproducible artifacts. But when the environment variable is set
    but empty then the parsing function fails with a confusing error
    message.
    
    This is an issue when building a package directly via debian/rules
    that uses the pkg-info.mk fragment file, because that one tries to
    set the SOURCE_DATE_EPOCH and can end up setting it to an empty value
    if the changelog contains an unfinished trailer. This is not an issue
    when using dpkg-buildpackage, though because the code there will
    fallback to use the current time if it there is no value from the
    changelog.
    
    Closes: #1069846
    Based-on-patch-by: Rainer Weikusat <[email protected]>
---
 src/deb/build.c   | 2 +-
 src/split/split.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/deb/build.c b/src/deb/build.c
index aaf3f509c..5da2e76cd 100644
--- a/src/deb/build.c
+++ b/src/deb/build.c
@@ -599,7 +599,7 @@ do_build(const char *const *argv)
   m_output(stdout, _("<standard output>"));
 
   timestamp_str = getenv("SOURCE_DATE_EPOCH");
-  if (timestamp_str)
+  if (str_is_set(timestamp_str))
     timestamp = parse_timestamp(timestamp_str);
   else
     timestamp = time(NULL);
diff --git a/src/split/split.c b/src/split/split.c
index a738d323e..d218ab747 100644
--- a/src/split/split.c
+++ b/src/split/split.c
@@ -164,7 +164,7 @@ mksplit(const char *file_src, const char *prefix, off_t 
maxpartsize,
        version = versiondescribe(&pkg->available.version, vdew_nonambig);
 
        timestamp_str = getenv("SOURCE_DATE_EPOCH");
-       if (timestamp_str)
+       if (str_is_set(timestamp_str))
                timestamp = parse_timestamp(timestamp_str);
        else
                timestamp = time(NULL);

-- 
Dpkg.Org's dpkg

Reply via email to