control: forwarded -1 https://github.com/hroptatyr/dateutils/pull/103
On Wed, 8 May 2019 01:01:24 +0200 =?UTF-8?Q?Bernhard_=c3=9cbelacker?= 
<bernha...@mailbox.org> wrote:
> Control: tags 907348 + patch upstream
> 
> 
> Dear Maintainer,
> I tried to have a look and tracked it down into the file
> lib/leap-seconds.def which is generated by ltrcc.
> 
> Unfortunately this generator seems not prepared for at least i386.
> 
> With attached patch the generated file is equal to one
> generated at amd64, and the tests pass on both architectures.
> 
> Could not find an matching upstream bug.
> 
I'm uploading this fix in deferred/10, please Thorsten let me know if I can 
speed it up!

I also rebased the patch and forwarded it upstream, since nobody did it so far.

patch attached

G.
diff -Nru dateutils-0.4.5/debian/changelog dateutils-0.4.5/debian/changelog
--- dateutils-0.4.5/debian/changelog    2018-10-17 19:59:01.000000000 +0200
+++ dateutils-0.4.5/debian/changelog    2019-07-10 09:12:59.000000000 +0200
@@ -1,3 +1,14 @@
+dateutils (0.4.5-1.1) unstable; urgency=medium
+
+  [ Gianfranco Costamagna ]
+  * Non-maintainer upload
+
+  [ Bernhard Übelacker ]
+  * debian/patches/0001-Use-unsigned-type-for-leap-second-
+    conversion.patch: Fix 32bit builds (Closes: #907348)
+
+ -- Gianfranco Costamagna <locutusofb...@debian.org>  Wed, 10 Jul 2019 
09:12:59 +0200
+
 dateutils (0.4.5-1) unstable; urgency=medium
 
   * New upstream release (Closes: #907348, #909031)
diff -Nru 
dateutils-0.4.5/debian/patches/0001-Use-unsigned-type-for-leap-second-conversion.patch
 
dateutils-0.4.5/debian/patches/0001-Use-unsigned-type-for-leap-second-conversion.patch
--- 
dateutils-0.4.5/debian/patches/0001-Use-unsigned-type-for-leap-second-conversion.patch
      1970-01-01 01:00:00.000000000 +0100
+++ 
dateutils-0.4.5/debian/patches/0001-Use-unsigned-type-for-leap-second-conversion.patch
      2019-07-10 09:12:59.000000000 +0200
@@ -0,0 +1,154 @@
+From 6f653805ee528e9068d3108af7227dea685f88ed Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Bernhard=20=C3=9Cbelacker?= <bernha...@mailbox.org>
+Date: Tue, 7 May 2019 19:13:21 +0200
+Subject: [PATCH] Use unsigned type for leap second conversion.
+
+https://bugs.debian.org/907348
+---
+ lib/ltrcc.c | 40 ++++++++++++++++++++--------------------
+ 1 file changed, 20 insertions(+), 20 deletions(-)
+
+diff --git a/lib/ltrcc.c b/lib/ltrcc.c
+index 20c0e38..11c8a74 100644
+--- a/lib/ltrcc.c
++++ b/lib/ltrcc.c
+@@ -55,10 +55,10 @@
+ #include "version.c"
+ 
+ 
+-static __attribute__((pure, const)) long int
+-ntp_to_unix_epoch(long int x)
++static __attribute__((pure, const)) unsigned long int
++ntp_to_unix_epoch(unsigned long int x)
+ {
+-      return x - 25567L * 86400L;
++      return x - 25567U * 86400U;
+ }
+ 
+ 
+@@ -68,7 +68,7 @@ ntp_to_unix_epoch(long int x)
+ static int
+ pr_line_corr(const char *line, size_t llen, va_list UNUSED(vap))
+ {
+-      static long int cor;
++      static unsigned long int cor;
+       char *sp, *ep;
+ 
+       if (llen == PROLOGUE) {
+@@ -96,7 +96,7 @@ const int32_t %s[] = {\n\
+       /* otherwise process */
+       if ((sp = memchr(line, '\t', llen)) == NULL) {
+               return -1;
+-      } else if ((ep = NULL, cor = strtol(++sp, &ep, 10), ep == NULL)) {
++      } else if ((ep = NULL, cor = strtoul(++sp, &ep, 10), ep == NULL || cor 
== ULONG_MAX)) {
+               return -1;
+       }
+ 
+@@ -108,10 +108,10 @@ const int32_t %s[] = {\n\
+ static int
+ pr_line_d(const char *line, size_t llen, va_list vap)
+ {
+-      static long int cor;
++      static unsigned long int cor;
+       struct dt_d_s d;
+       dt_dtyp_t typ;
+-      long int val;
++      unsigned long int val;
+       int colp;
+       char *ep;
+ 
+@@ -155,7 +155,7 @@ const uint32_t %s[] = {\n\
+               return 0;
+       }
+       /* otherwise process */
+-      if ((ep = NULL, val = strtol(line, &ep, 10), ep == NULL)) {
++      if ((ep = NULL, val = strtoul(line, &ep, 10), ep == NULL || val == 
ULONG_MAX)) {
+               return -1;
+       }
+ 
+@@ -164,7 +164,7 @@ const uint32_t %s[] = {\n\
+       d = dt_dconv(typ, d);
+ 
+       if (!colp) {
+-              if ((cor = strtol(ep, &ep, 10), ep == NULL)) {
++              if ((cor = strtoul(ep, &ep, 10), ep == NULL || val == 
ULONG_MAX)) {
+                       return -1;
+               }
+               /* just output the line then */
+@@ -179,9 +179,9 @@ const uint32_t %s[] = {\n\
+ static int
+ pr_line_dt(const char *line, size_t llen, va_list vap)
+ {
+-      static long int cor;
++      static unsigned long int cor;
+       dt_dtyp_t __attribute__((unused)) typ;
+-      long int val;
++      unsigned long int val;
+       int colp;
+       char *ep;
+ 
+@@ -225,7 +225,7 @@ const int32_t %s[] = {\n\
+               return 0;
+       }
+       /* otherwise process */
+-      if ((ep = NULL, val = strtol(line, &ep, 10), ep == NULL)) {
++      if ((ep = NULL, val = strtoul(line, &ep, 10), ep == NULL || val == 
ULONG_MAX)) {
+               return -1;
+       }
+ 
+@@ -234,15 +234,15 @@ const int32_t %s[] = {\n\
+       val = ntp_to_unix_epoch(val);
+ 
+       if (!colp) {
+-              if ((cor = strtol(ep, &ep, 10), ep == NULL)) {
++              if ((cor = strtoul(ep, &ep, 10), ep == NULL || cor == 
ULONG_MAX)) {
+                       return -1;
+               }
+               /* just output the line then */
+-              fprintf(stdout, "\t{0x%xU/* %li */, %li},\n",
+-                      (uint32_t)val, val, cor);
++              fprintf(stdout, "\t{0x%lxU/* %li */, %li},\n",
++                      val, val, cor);
+       } else {
+               /* column-oriented mode */
+-              fprintf(stdout, "\t0x%xU/* %li */,\n", (uint32_t)val, val);
++              fprintf(stdout, "\t0x%lxU/* %li */,\n", val, val);
+       }
+       return 0;
+ }
+@@ -250,12 +250,12 @@ const int32_t %s[] = {\n\
+ static int
+ pr_line_t(const char *line, size_t llen, va_list vap)
+ {
+-      static long int cor;
++      static unsigned long int cor;
+       struct dt_t_s t = dt_t_initialiser();
+       dt_dtyp_t typ;
+       int colp;
+       char *ep;
+-      long int val;
++      unsigned long int val;
+ 
+       /* extract type from inner list */
+       typ = va_arg(vap, dt_dtyp_t);
+@@ -292,7 +292,7 @@ const uint32_t %s[] = {\n\
+               return 0;
+       }
+       /* otherwise process */
+-      if ((ep = NULL, val = strtol(line, &ep, 10), ep == NULL)) {
++      if ((ep = NULL, val = strtoul(line, &ep, 10), ep == NULL || val == 
ULONG_MAX)) {
+               return -1;
+       }
+       val--;
+@@ -303,7 +303,7 @@ const uint32_t %s[] = {\n\
+       t.hms.h = val % 24L;
+ 
+       /* read correction */
+-      if ((val = strtol(ep, &ep, 10), ep == NULL)) {
++      if ((val = strtoul(ep, &ep, 10), ep == NULL || val == ULONG_MAX)) {
+               return -1;
+       }
+ 
+-- 
+2.20.1
+
diff -Nru dateutils-0.4.5/debian/patches/series 
dateutils-0.4.5/debian/patches/series
--- dateutils-0.4.5/debian/patches/series       2016-11-27 16:34:01.000000000 
+0100
+++ dateutils-0.4.5/debian/patches/series       2019-07-10 09:12:59.000000000 
+0200
@@ -1,2 +1,3 @@
 0001-do-not-use-march-native-compiler-flags.diff
 0002-reproducible-build.diff
+0001-Use-unsigned-type-for-leap-second-conversion.patch

Reply via email to