Hi Pierre!

On Fri, 12 Aug 2016 09:31:53 +0200 Michael Biebl <bi...@debian.org> wrote:
> Source: liblognorm
> Version: 2.0.1-1
> Severity: serious
> 
> Hi,
> 
> as can be seen on [1], the liblognorm package FTBFS on arm64, ppc64el
> and s390x (some archs are still building and might be affected as well).
> 
> In all cases the build was killed after 150min due to inactivity when
> trying to build the test suite.
> 
> 
> [1] https://buildd.debian.org/status/package.php?p=liblognorm&suite=unstable

Since I haven't heard back from you regarding #834121 and #834081 and
this was blocking rsyslog from entering testing, I've made an NMU fixing
both issues. The debdiff is attached.

I've also forwarded the patch for this issue upstream, so it should
hopefully be merged for the next upstream release.

Cheers,
Michael


-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?
diff -Nru liblognorm-2.0.1/debian/changelog liblognorm-2.0.1/debian/changelog
--- liblognorm-2.0.1/debian/changelog   2016-08-09 09:41:20.000000000 +0200
+++ liblognorm-2.0.1/debian/changelog   2016-10-05 00:36:31.000000000 +0200
@@ -1,3 +1,14 @@
+liblognorm (2.0.1-1.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix infinite loop in lognormalizer's read_line() function due to incorrect
+    use of fgetc(). (Closes: #834121)
+  * Fix misleading indentation warnings with GCC6.
+  * Fix dependencies of liblognorm-dev which requires libfastjson-dev instead
+    of libjson-c-dev. (Closes: #834081)
+
+ -- Michael Biebl <bi...@debian.org>  Wed, 05 Oct 2016 00:36:31 +0200
+
 liblognorm (2.0.1-1) unstable; urgency=medium
 
   [ Pierre Chifflier ]
diff -Nru liblognorm-2.0.1/debian/control liblognorm-2.0.1/debian/control
--- liblognorm-2.0.1/debian/control     2016-08-09 09:41:20.000000000 +0200
+++ liblognorm-2.0.1/debian/control     2016-10-05 00:36:31.000000000 +0200
@@ -21,7 +21,7 @@
 Depends: liblognorm5 (= ${binary:Version}),
     ${misc:Depends},
     ${sphinxdoc:Depends},
-    libjson-c-dev,
+    libfastjson-dev,
     libestr-dev
 Multi-Arch: foreign
 Description: log normalizing library - development files
diff -Nru 
liblognorm-2.0.1/debian/patches/0001-fix-infinite-loop-in-read_line.patch 
liblognorm-2.0.1/debian/patches/0001-fix-infinite-loop-in-read_line.patch
--- liblognorm-2.0.1/debian/patches/0001-fix-infinite-loop-in-read_line.patch   
1970-01-01 01:00:00.000000000 +0100
+++ liblognorm-2.0.1/debian/patches/0001-fix-infinite-loop-in-read_line.patch   
2016-10-05 00:36:02.000000000 +0200
@@ -0,0 +1,40 @@
+From 09838dec129e1d006d4e911c86f077204f50f54a Mon Sep 17 00:00:00 2001
+From: Michael Biebl <bi...@debian.org>
+Date: Wed, 5 Oct 2016 00:18:17 +0200
+Subject: [PATCH 1/3] fix infinite loop in read_line()
+
+fgetc returns an int and we were using char to store the result. This is
+not safe on certain architectures. As a result, the loop in
+lognormalizer's read_line() function never finished.
+
+GCC complained about this issue:
+
+lognormalizer.c: In function 'read_line':
+lognormalizer.c:185:10: warning: comparison is always false due to limited 
range of data type [-Wtype-limits]
+   if (ch == EOF) break;
+          ^~
+
+Fix this by using type int instead of char.
+
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=834121
+Fixes: #217
+---
+ src/lognormalizer.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/lognormalizer.c b/src/lognormalizer.c
+index cdf9204..10e3ba8 100644
+--- a/src/lognormalizer.c
++++ b/src/lognormalizer.c
+@@ -179,7 +179,7 @@ read_line(FILE *fp)
+       size_t line_capacity = DEFAULT_LINE_SIZE;
+       char *line = NULL;
+       size_t line_len = 0;
+-      char ch = 0;
++      int ch = 0;
+       do {
+               ch = fgetc(fp);
+               if (ch == EOF) break;
+-- 
+2.9.3
+
diff -Nru 
liblognorm-2.0.1/debian/patches/0002-use-proper-type-for-OffsetHour-in-ln_parseRFC5424Dat.patch
 
liblognorm-2.0.1/debian/patches/0002-use-proper-type-for-OffsetHour-in-ln_parseRFC5424Dat.patch
--- 
liblognorm-2.0.1/debian/patches/0002-use-proper-type-for-OffsetHour-in-ln_parseRFC5424Dat.patch
     1970-01-01 01:00:00.000000000 +0100
+++ 
liblognorm-2.0.1/debian/patches/0002-use-proper-type-for-OffsetHour-in-ln_parseRFC5424Dat.patch
     2016-10-05 00:36:02.000000000 +0200
@@ -0,0 +1,52 @@
+From c65023ef46cbfb4cd3f4c177a479d70e39bcd4b2 Mon Sep 17 00:00:00 2001
+From: Michael Biebl <bi...@debian.org>
+Date: Wed, 5 Oct 2016 00:23:38 +0200
+Subject: [PATCH 2/3] use proper type for OffsetHour in ln_parseRFC5424Date()
+
+GCC spotted the following errors:
+
+v1_parser.c: In function 'ln_parseRFC5424Date':
+v1_parser.c:266:17: warning: comparison is always false due to limited range 
of data type [-Wtype-limits]
+   if(OffsetHour < 0 || OffsetHour > 23)
+                 ^
+
+parser.c: In function 'ln_v2_parseRFC5424Date':
+parser.c:227:17: warning: comparison is always false due to limited range of 
data type [-Wtype-limits]
+   if(OffsetHour < 0 || OffsetHour > 23)
+                 ^
+
+Fix it by using type int for OffsetHour.
+---
+ src/parser.c    | 2 +-
+ src/v1_parser.c | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/parser.c b/src/parser.c
+index 8da8d20..76f0836 100644
+--- a/src/parser.c
++++ b/src/parser.c
+@@ -161,7 +161,7 @@ PARSER_Parse(RFC5424Date)
+       int second;
+       __attribute__((unused)) int secfrac;    /* fractional seconds (must be 
32 bit!) */
+       __attribute__((unused)) int secfracPrecision;
+-      char OffsetHour;        /* UTC offset in hours */
++      int OffsetHour;         /* UTC offset in hours */
+       int OffsetMinute;       /* UTC offset in minutes */
+       size_t len;
+       size_t orglen;
+diff --git a/src/v1_parser.c b/src/v1_parser.c
+index 3c1a875..436876d 100644
+--- a/src/v1_parser.c
++++ b/src/v1_parser.c
+@@ -200,7 +200,7 @@ PARSER(RFC5424Date)
+       int second;
+       __attribute__((unused)) int secfrac;    /* fractional seconds (must be 
32 bit!) */
+       __attribute__((unused)) int secfracPrecision;
+-      char OffsetHour;        /* UTC offset in hours */
++      int OffsetHour;         /* UTC offset in hours */
+       int OffsetMinute;       /* UTC offset in minutes */
+       size_t len;
+       size_t orglen;
+-- 
+2.9.3
+
diff -Nru 
liblognorm-2.0.1/debian/patches/0003-fix-misleading-indentation-warnings-with-GCC6.patch
 
liblognorm-2.0.1/debian/patches/0003-fix-misleading-indentation-warnings-with-GCC6.patch
--- 
liblognorm-2.0.1/debian/patches/0003-fix-misleading-indentation-warnings-with-GCC6.patch
    1970-01-01 01:00:00.000000000 +0100
+++ 
liblognorm-2.0.1/debian/patches/0003-fix-misleading-indentation-warnings-with-GCC6.patch
    2016-10-05 00:36:02.000000000 +0200
@@ -0,0 +1,44 @@
+From b061a924c9091df5b29c1ff1446434f2c5f93810 Mon Sep 17 00:00:00 2001
+From: Michael Biebl <bi...@debian.org>
+Date: Wed, 5 Oct 2016 00:14:35 +0200
+Subject: [PATCH 3/3] fix misleading indentation warnings with GCC6
+
+v1_samp.c had mixed tabs and spaces indentation which GCC 6 complains
+about:
+
+v1_samp.c: In function 'ln_v1_processSamp':
+v1_samp.c:764:5: warning: this 'if' clause does not guard... 
[-Wmisleading-indentation]
+     if(getLineType(buf, lenBuf, &offs, &typeStr) != 0)
+     ^~
+v1_samp.c:767:2: note: ...this statement, but the latter is misleadingly 
indented as if it is guarded by the 'if'
+  if(!es_strconstcmp(typeStr, "prefix")) {
+  ^~
+
+Fix by using tabs consistently in that function.
+---
+ src/v1_samp.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/src/v1_samp.c b/src/v1_samp.c
+index 44efdfc..a81940a 100644
+--- a/src/v1_samp.c
++++ b/src/v1_samp.c
+@@ -758,11 +758,11 @@ struct ln_v1_samp *
+ ln_v1_processSamp(ln_ctx ctx, const char *buf, es_size_t lenBuf)
+ {
+       struct ln_v1_samp *samp = NULL;
+-    es_str_t *typeStr = NULL;
+-    es_size_t offs;
++      es_str_t *typeStr = NULL;
++      es_size_t offs;
+ 
+-    if(getLineType(buf, lenBuf, &offs, &typeStr) != 0)
+-        goto done;
++      if(getLineType(buf, lenBuf, &offs, &typeStr) != 0)
++              goto done;
+ 
+       if(!es_strconstcmp(typeStr, "prefix")) {
+               if(getPrefix(buf, lenBuf, offs, &ctx->rulePrefix) != 0) goto 
done;
+-- 
+2.9.3
+
diff -Nru liblognorm-2.0.1/debian/patches/series 
liblognorm-2.0.1/debian/patches/series
--- liblognorm-2.0.1/debian/patches/series      2016-08-09 09:41:20.000000000 
+0200
+++ liblognorm-2.0.1/debian/patches/series      2016-10-05 00:36:15.000000000 
+0200
@@ -0,0 +1,3 @@
+0001-fix-infinite-loop-in-read_line.patch
+0002-use-proper-type-for-OffsetHour-in-ln_parseRFC5424Dat.patch
+0003-fix-misleading-indentation-warnings-with-GCC6.patch

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to