Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package unifdef for openSUSE:Factory checked 
in at 2022-08-10 17:14:49
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/unifdef (Old)
 and      /work/SRC/openSUSE:Factory/.unifdef.new.1521 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "unifdef"

Wed Aug 10 17:14:49 2022 rev:22 rq:994274 version:2.12

Changes:
--------
--- /work/SRC/openSUSE:Factory/unifdef/unifdef.changes  2021-03-10 
08:58:34.446970659 +0100
+++ /work/SRC/openSUSE:Factory/.unifdef.new.1521/unifdef.changes        
2022-08-10 17:15:56.766122392 +0200
@@ -1,0 +2,6 @@
+Wed Aug 10 08:15:05 UTC 2022 - Martin Li??ka <mli...@suse.cz>
+
+- Add fix-fgets-.-size-1.patch that fixes broken package
+  (https://github.com/fanf2/unifdef/pull/15).
+
+-------------------------------------------------------------------

New:
----
  fix-fgets-.-size-1.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ unifdef.spec ++++++
--- /var/tmp/diff_new_pack.EaxVW7/_old  2022-08-10 17:15:57.362123948 +0200
+++ /var/tmp/diff_new_pack.EaxVW7/_new  2022-08-10 17:15:57.370123969 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package unifdef
 #
-# Copyright (c) 2021 SUSE LLC
+# Copyright (c) 2022 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -24,6 +24,7 @@
 Release:        0
 URL:            https://dotat.at/prog/unifdef/
 Source:         https://dotat.at/prog/unifdef/unifdef-%{version}.tar.xz
+Patch0:         fix-fgets-.-size-1.patch
 BuildRequires:  xz
 
 %description
@@ -32,10 +33,8 @@
 lines, and it knows only enough about C to know when one of these is
 inactive because it is inside a comment, or a single or double quote.
 
-
-
 %prep
-%setup -q
+%autosetup -p1
 sed -i Makefile \
        -e 's,^\(prefix\).*=.*,\1 =\t%{_prefix},' \
        -e 's,^\(bindir\).*=.*,\1 =\t%{_bindir},' \

++++++ fix-fgets-.-size-1.patch ++++++
>From 9791614057fe7fc72babd78708fdd07857fef9cf Mon Sep 17 00:00:00 2001
From: Martin Liska <mli...@suse.cz>
Date: Wed, 10 Aug 2022 10:06:55 +0200
Subject: [PATCH] Fix fgets(..., size=1)

I noticed the following 2 tests are failing with -O1
-D_FORTIFY_SOURCE=1:

[   44s] FAILED: whitespace-1.out: unifdef -DFOO whitespace.c
[   44s] FAILED: whitespace-2.out: unifdef -DBAR whitespace.c

It's caused by fact that:

fgets returns '\0' if n == 1:

char *
_IO_fgets (char *buf, int n, FILE *fp)
{
  size_t count;
  char *result;
  int old_error;
  CHECK_FILE (fp, NULL);
  if (n <= 0)
    return NULL;
  if (__glibc_unlikely (n == 1))
    {
      /* Another irregular case: since we have to store a NUL byte and
         there is only room for exactly one byte, we don't have to
         read anything.  */
      buf[0] = '\0';
      return buf;
    }
---
 tests/whitespace-1.experr | 2 --
 tests/whitespace-1.expout | 5 +++++
 tests/whitespace-1.exprc  | 2 +-
 tests/whitespace-2.expout | 3 ++-
 unifdef.c                 | 3 ++-
 5 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/tests/whitespace-1.experr b/tests/whitespace-1.experr
index cb23fce..e69de29 100644
--- a/tests/whitespace-1.experr
+++ b/tests/whitespace-1.experr
@@ -1,2 +0,0 @@
-unifdef: whitespace.c: 4: Obfuscated preprocessor control line (#if line 1 
depth 1)
-unifdef: Output may be truncated
diff --git a/tests/whitespace-1.expout b/tests/whitespace-1.expout
index 257cc56..14dd150 100644
--- a/tests/whitespace-1.expout
+++ b/tests/whitespace-1.expout
@@ -1 +1,6 @@
 foo
+                                                                               
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                //spong
+
+#ifdef BAR
+bar
+#endif
diff --git a/tests/whitespace-1.exprc b/tests/whitespace-1.exprc
index 0cfbf08..d00491f 100644
--- a/tests/whitespace-1.exprc
+++ b/tests/whitespace-1.exprc
@@ -1 +1 @@
-2
+1
diff --git a/tests/whitespace-2.expout b/tests/whitespace-2.expout
index 84cabfe..43f6399 100644
--- a/tests/whitespace-2.expout
+++ b/tests/whitespace-2.expout
@@ -1,5 +1,6 @@
 #ifdef FOO
 foo
-#endif                                                                         
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                      
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                      
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                      
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                      
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                      
                      //spong
+#endif                                                                         
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                      
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                      
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                      
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                      
                                                                                
                            
+                                                                               
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                //spong
 
 bar
diff --git a/unifdef.c b/unifdef.c
index dc145a2..b7335aa 100644
--- a/unifdef.c
+++ b/unifdef.c
@@ -846,7 +846,8 @@ parseline(void)
           newline or if there is too much whitespace in a directive */
        if (linestate == LS_HASH) {
                long len = cp - tline;
-               if (fgets(tline + len, MAXLINE - len, input) == NULL) {
+               const char *line = fgets(tline + len, MAXLINE - len, input);
+               if (line == NULL || *line == '\0') {
                        if (ferror(input))
                                err(2, "can't read %s", filename);
                        debug("parser insert newline at EOF", linenum);
-- 
2.37.1

Reply via email to