Your message dated Wed, 29 Apr 2015 19:22:23 +0000
with message-id <[email protected]>
and subject line Bug#511793: fixed in sng 1.0.6-2
has caused the Debian Bug report #511793,
regarding sng: [PATCH] exit status fails to reflect presence of errors
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
511793: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=511793
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: sng
Version: 1.0.2-5
Severity: normal

SNG exits with a zero (success) status in the presence of at least some
errors.

The attached bad.sng file contains a deliberate error.  To reproduce:

  sng bad.sng && echo 'Success reported for erroneous file'

The comments in the code suggest an awareness of at least part of the
problem, but incorrectly state that it works "if you are only checking
the status of a single file".

Fix: keep track of error statuses throughout, and exit with the greatest
seen.  Patch attached.

-- System Information:
Debian Release: 4.0
  APT prefers stable
  APT policy: (500, 'stable'), (50, 'unstable')
Architecture: amd64 (x86_64)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-4-amd64
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)

Versions of packages sng depends on:
ii  libc6                  2.3.6.ds1-13etch5 GNU C Library: Shared libraries
ii  libpng12-0             1.2.15~beta5-1    PNG library - runtime
ii  x11-common             1:7.1.0-19        X Window System (X.Org) infrastruc
ii  zlib1g                 1:1.2.3-13        compression library - runtime

sng recommends no packages.

-- no debconf information

-- 
Aaron Crane ** http://aaroncrane.co.uk/
#SNG: from bad.png
IHDR {
    width: 1; height: 1; bitdepth: 8;
    using brightly coloured machine tools;
}
IMAGE {
    pixels hex
ffffff
}
diff --git sng-1.0.2.orig/main.c sng-1.0.2/main.c
index 21d4697..28577a7 100644
--- sng-1.0.2.orig/main.c
+++ sng-1.0.2/main.c
@@ -9,7 +9,6 @@
 #include "config.h"
 
 int verbose;
-int sng_error;
 int idat;
 
 png_struct *png_ptr;
@@ -152,9 +151,15 @@ void initialize_hash(int hashfunc(color_item *),
  *
  ************************************************************************/
 
+static int max(int x, int y)
+{
+    return x > y ? x : y;
+}
+
 int main(int argc, char *argv[])
 {
     int i = 1;
+    int error_status = 0;
 
 #ifdef __EMX__
     _wildcard(&argc, &argv);   /* Unix-like globbing for OS/2 and DOS */
@@ -213,6 +218,7 @@ int main(int argc, char *argv[])
 	    if (argv[i][dot] != '.')
 	    {
 		fprintf(stderr, "sng: %s is neither SNG nor PNG\n", argv[i]);
+		error_status = max(error_status, 1);
 		continue;
 	    }
 	    else if (strcmp(argv[i] + dot, ".sng") == 0)
@@ -232,6 +238,7 @@ int main(int argc, char *argv[])
 	    else
 	    {
 		fprintf(stderr, "sng: %s is neither SNG nor PNG\n", argv[i]);
+		error_status = max(error_status, 1);
 		continue;
 	    }
 
@@ -243,6 +250,7 @@ int main(int argc, char *argv[])
 		fprintf(stderr,
 			"sng: couldn't open %s for input (%d)\n",
 			argv[i], errno);
+		error_status = max(error_status, 1);
 		continue;
 	    }
 	    if ((fpout = fopen(outfile, "w")) == NULL)
@@ -250,17 +258,16 @@ int main(int argc, char *argv[])
 		fprintf(stderr,
 			"sng: couldn't open for output %s (%d)\n",
 			outfile, errno);
+		error_status = max(error_status, 1);
 		continue;
 	    }
 
 	    if (sng2png)
-		sngc(fpin, argv[i], fpout);
+		error_status = max(error_status, sngc(fpin, argv[i], fpout));
 	    else
-		sngd(fpin, argv[i], fpout);
+		error_status = max(error_status, sngd(fpin, argv[i], fpout));
 	}
     }
 
-    /* This only returns the error on the last file.  Works OK if you are only
-     * checking the status of a single file. */
-    return sng_error;
+    return error_status;
 }
diff --git sng-1.0.2.orig/sng.h sng-1.0.2/sng.h
index 2e9872f..4ea17c8 100644
--- sng-1.0.2.orig/sng.h
+++ sng-1.0.2/sng.h
@@ -25,7 +25,6 @@ extern void initialize_hash(int hashfunc(color_item *),
 
 extern int verbose;
 extern int idat;
-extern int sng_error;
 
 extern int linenum;
 extern char *file;
diff --git sng-1.0.2.orig/sngd.c sng-1.0.2/sngd.c
index 5854a0e..a91fedd 100644
--- sng-1.0.2.orig/sngd.c
+++ sng-1.0.2/sngd.c
@@ -33,6 +33,9 @@ static char *current_file;
 png_structp png_ptr;
 png_infop info_ptr;
 
+/* Error status for the file being processed; reset to 0 at the top of sngd() */
+static int sng_error;
+
 /*****************************************************************************
  *
  * Interface to RGB database
@@ -1061,7 +1064,6 @@ int sngd(FILE *fp, char *name, FILE *fpout)
    if (png_ptr == NULL)
    {
       fclose(fp);
-      sng_error = 1;
       return(1);
    }
 
@@ -1071,8 +1073,7 @@ int sngd(FILE *fp, char *name, FILE *fpout)
    {
       fclose(fp);
       png_destroy_read_struct(&png_ptr, (png_infopp)NULL, (png_infopp)NULL);
-      sng_error = 1;
-      return(FAIL);
+      return 1;
    }
 
    /* Set error handling if you are using the setjmp/longjmp method (this is
@@ -1085,7 +1086,6 @@ int sngd(FILE *fp, char *name, FILE *fpout)
       png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
       fclose(fp);
       /* If we get here, we had a problem reading the file */
-      sng_error = 1;
       return(1);
    }
 
@@ -1146,8 +1146,8 @@ int sngd(FILE *fp, char *name, FILE *fpout)
    /* close the file */
    fclose(fp);
 
-   /* that's it */
-   return(0);
+   /* that's it; return this file's error status */
+   return sng_error;
 }
 
 /* sngd.c ends here */

--- End Message ---
--- Begin Message ---
Source: sng
Source-Version: 1.0.6-2

We believe that the bug you reported is fixed in the latest version of
sng, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Reiner Herrmann <[email protected]> (supplier of updated sng package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Format: 1.8
Date: Wed, 29 Apr 2015 20:20:36 +0200
Source: sng
Binary: sng
Architecture: source amd64
Version: 1.0.6-2
Distribution: unstable
Urgency: low
Maintainer: Reiner Herrmann <[email protected]>
Changed-By: Reiner Herrmann <[email protected]>
Description:
 sng        - specialized markup language for representing PNG contents
Closes: 511793
Changes:
 sng (1.0.6-2) unstable; urgency=low
 .
   * Dropped patch which removed Makefile in favor of
     proper cleanup in debian/rules.
   * Allow parallel building.
   * Added patch by Aaron Crane which reports correct exit
     codes (Closes: #511793).
   * Upload to unstable.
Checksums-Sha1:
 60aee64c9672dd41434fb40dd28532c6596f0f6d 1705 sng_1.0.6-2.dsc
 66c8ace20bfd8696db133aaa642c7ead167e011e 4712 sng_1.0.6-2.debian.tar.xz
 91d5917eb5a521e89639dbce52e123327be9fb82 33280 sng_1.0.6-2_amd64.deb
Checksums-Sha256:
 0ece54fe44da5cba9f58dd93caa33a406e7dbc2afd15629ab9349858dfb9d297 1705 
sng_1.0.6-2.dsc
 c9210bb231a367b429d9bae5a66fb978c9804529a7174c35f0aaf0b88ebe2b11 4712 
sng_1.0.6-2.debian.tar.xz
 a409d245286eccbff1702e812d06b06fe4e5e1b1c1374823b63a96f11c513fe2 33280 
sng_1.0.6-2_amd64.deb
Files:
 dde27a4f09061dbb4ee56dbd0f701f77 1705 graphics optional sng_1.0.6-2.dsc
 04410a8d69a14facc1a00b7456f39066 4712 graphics optional 
sng_1.0.6-2.debian.tar.xz
 29beb15a9454b5d3c64773a5f698c9cd 33280 graphics optional sng_1.0.6-2_amd64.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iQIcBAEBCAAGBQJVQSnRAAoJEEAsIlA9Nuk2i40P/i4dNv2eUjcTAsvFCcUaVJrd
ZSTG0kE5FMxvAcUvPiDwVIwto5QX/kNWgmLczi/z2oZj36kFYjPkIv3SS6hb0h/p
k64qpHrHzuZAxguHrq0RVsbrtS+CcXiMJiGrgx9B9bzzh0zpTYA0gHkapi4/CPwO
6lySCzz5IRbtn3dR64sGRjjZZNHL2hVF1JKd0HzN+KHK5XtP6u/qY9sqiI/SvQA/
FFlcygymJiHGHNAreqWDsFR7AVd4S3cZqza6+w6SySufSSxYx+aG+aZXI6rZ7Sie
HZPdshnE5VQe7Mk2D//ZhK762P7EFIDVifryIK0fPbEwEOJlQVu208PvoYXr7ToQ
qSuoPePnmmq/DkkmwmyoQh2pqPgM4Wtk0iBnPPCCPVIcMRu9YZRwc8qbDAtzirkg
l6sE5hXXcUsi6KTQW2R7U4RLxiKnS8m6jzMoXXt8woBzH7nJdfgSHUx2LfUn3/Lo
EPZ9JeINGdnadb/2OM8LRxzZA0voLoQeVkabbGAjDwGBAdRJGvXDb8xvu0Hi+QB/
otD8We1d2GzOtvH6uQ3Dcg7aoHuBzkKTSYMLqVsqbNNeQQJ4T7Aa3PEFprlTw7EJ
jSDX4rmKOWAYaAVa2U/6+zp4+691ZgRcsnLXz0lqCzSORj1JhEb0pjovUAGxUmEj
lMm5x/VfL+DOAL73Xe58
=L2uW
-----END PGP SIGNATURE-----

--- End Message ---

Reply via email to