Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package logwarn for openSUSE:Factory checked in at 2022-05-28 22:16:55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/logwarn (Old) and /work/SRC/openSUSE:Factory/.logwarn.new.2254 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "logwarn" Sat May 28 22:16:55 2022 rev:12 rq:979595 version:1.0.17 Changes: -------- --- /work/SRC/openSUSE:Factory/logwarn/logwarn.changes 2021-11-21 23:53:09.762063254 +0100 +++ /work/SRC/openSUSE:Factory/.logwarn.new.2254/logwarn.changes 2022-05-28 22:17:37.433059560 +0200 @@ -1,0 +2,7 @@ +Sat May 28 14:44:50 UTC 2022 - Archie Cobbs <archie.co...@gmail.com> + +- Upgrade to release 1.0.17 + + Use fstat(2) instead of stat(2) to avoid tiny race condition + + Fix bug when parsing consecutive "-T" flags + +------------------------------------------------------------------- Old: ---- logwarn-1.0.16.obscpio New: ---- logwarn-1.0.17.obscpio ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ logwarn.spec ++++++ --- /var/tmp/diff_new_pack.lcb7dZ/_old 2022-05-28 22:17:37.885060119 +0200 +++ /var/tmp/diff_new_pack.lcb7dZ/_new 2022-05-28 22:17:37.889060124 +0200 @@ -1,7 +1,7 @@ # # spec file for package logwarn # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # Copyright (c) 2010-2011 Archie L. Cobbs. All rights reserved. # # All modifications and additions to the file contributed by third parties @@ -18,7 +18,7 @@ Name: logwarn -Version: 1.0.16 +Version: 1.0.17 Release: 0 Summary: Utility for finding interesting messages in log files License: Apache-2.0 ++++++ _service ++++++ --- /var/tmp/diff_new_pack.lcb7dZ/_old 2022-05-28 22:17:37.917060159 +0200 +++ /var/tmp/diff_new_pack.lcb7dZ/_new 2022-05-28 22:17:37.921060164 +0200 @@ -2,8 +2,8 @@ <service mode="localonly" name="obs_scm"> <param name="scm">git</param> <param name="url">https://github.com/archiecobbs/logwarn</param> - <param name="versionformat">1.0.16</param> - <param name="revision">1.0.16</param> + <param name="versionformat">1.0.17</param> + <param name="revision">1.0.17</param> <param name="filename">logwarn</param> </service> <service mode="buildtime" name="tar"/> ++++++ logwarn-1.0.16.obscpio -> logwarn-1.0.17.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logwarn-1.0.16/CHANGES new/logwarn-1.0.17/CHANGES --- old/logwarn-1.0.16/CHANGES 2021-11-21 22:04:37.000000000 +0100 +++ new/logwarn-1.0.17/CHANGES 2022-05-28 16:42:46.000000000 +0200 @@ -1,3 +1,8 @@ +Version 1.0.17 Released May 28, 2022 + + - Use fstat(2) instead of stat(2) to avoid tiny race condition + - Fix bug when parsing consecutive "-T" flags + Version 1.0.16 Released November 21, 2021 - Store repeated timestamps more efficiently in state file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logwarn-1.0.16/configure.ac new/logwarn-1.0.17/configure.ac --- old/logwarn-1.0.16/configure.ac 2021-11-21 22:04:37.000000000 +0100 +++ new/logwarn-1.0.17/configure.ac 2022-05-28 16:42:46.000000000 +0200 @@ -16,7 +16,7 @@ # limitations under the License. # -AC_INIT([logwarn Utility for finding interesting messages in log files], [1.0.16], [https://github.com/archiecobbs/logwarn/], [logwarn]) +AC_INIT([logwarn Utility for finding interesting messages in log files], [1.0.17], [https://github.com/archiecobbs/logwarn/], [logwarn]) AC_CONFIG_AUX_DIR(scripts) AM_INIT_AUTOMAKE dnl AM_MAINTAINER_MODE diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logwarn-1.0.16/main.c new/logwarn-1.0.17/main.c --- old/logwarn-1.0.16/main.c 2021-11-21 22:04:37.000000000 +0100 +++ new/logwarn-1.0.17/main.c 2022-05-28 16:42:46.000000000 +0200 @@ -230,17 +230,13 @@ fprintf(stderr, "%s: invalid zero repeat count in \"-T %s\"", PACKAGE, argv[i]); exit(EXIT_ERROR); } - if (++i >= argc) { // ignore but allow "-T X/Y" as the last command line argument - memset(repeat, 0, sizeof(*repeat)); - break; - } state.num_repeats++; if ((repeat->occurrences = malloc(repeat->num * sizeof(repeat->occurrences))) == NULL) { fprintf(stderr, "%s: %s: %s\n", PACKAGE, "malloc", strerror(errno)); exit(EXIT_ERROR); } memset(repeat->occurrences, 0, repeat->num * sizeof(*repeat->occurrences)); - patstr = argv[i]; + continue; } // It's a new pattern diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logwarn-1.0.16/state.c new/logwarn-1.0.17/state.c --- old/logwarn-1.0.16/state.c 2021-11-21 22:04:37.000000000 +0100 +++ new/logwarn-1.0.17/state.c 2022-05-28 16:42:46.000000000 +0200 @@ -46,14 +46,24 @@ { char buf[1024]; struct stat sb; + int errno_save; FILE *fp; + int fd; reset_state(state); state->line = 1; - if (stat(state_file, &sb) == -1 || S_ISDIR(sb.st_mode)) - return -1; if ((fp = fopen(state_file, "r")) == NULL) return -1; + if ((fd = fileno(fp)) == -1) { + fprintf(stderr, "%s: %s: %s\n", PACKAGE, state_file, strerror(errno)); + exit(EXIT_ERROR); + } + if (fstat(fd, &sb) == -1 || S_ISDIR(sb.st_mode)) { + errno_save = errno; + fclose(fp); + errno = errno_save; + return -1; + } while (fgets(buf, sizeof(buf), fp) != NULL) { const char *s = buf; unsigned long value; @@ -233,6 +243,7 @@ { struct stat sb; FILE *fp; + int fd; int ch; // Read state file @@ -240,19 +251,23 @@ state->line = 1; if (logfile == NULL) return; - if (stat(logfile, &sb) == -1) { + if ((fp = fopen(logfile, "r")) == NULL) { fprintf(stderr, "%s: %s: %s\n", PACKAGE, logfile, strerror(errno)); exit(EXIT_ERROR); } - if (S_ISDIR(sb.st_mode & S_IFMT)) { - fprintf(stderr, "%s: %s: %s\n", PACKAGE, logfile, strerror(EISDIR)); + if ((fd = fileno(fp)) == -1) { + fprintf(stderr, "%s: %s: %s\n", PACKAGE, logfile, strerror(errno)); exit(EXIT_ERROR); } - state->inode = sb.st_ino; - if ((fp = fopen(logfile, "r")) == NULL) { + if (fstat(fd, &sb) == -1) { fprintf(stderr, "%s: %s: %s\n", PACKAGE, logfile, strerror(errno)); exit(EXIT_ERROR); } + if (S_ISDIR(sb.st_mode)) { + fprintf(stderr, "%s: %s: %s\n", PACKAGE, logfile, strerror(EISDIR)); + exit(EXIT_ERROR); + } + state->inode = sb.st_ino; while ((ch = getc(fp)) != EOF) { state->pos++; if (ch == '\n') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logwarn-1.0.16/tests/test0010 new/logwarn-1.0.17/tests/test0010 --- old/logwarn-1.0.16/tests/test0010 2021-11-21 22:04:37.000000000 +0100 +++ new/logwarn-1.0.17/tests/test0010 2022-05-28 16:42:46.000000000 +0200 @@ -15,3 +15,8 @@ # Another variant that caused a crash cat logfile.2 >> logfile verify_output output.2 -an -f statefile logfile -T 1/0 + +# Test that with consecutive "-T" flags, all but the last is ignored +cp logfile.1 logfile +reset_state_file statefile logfile +verify_output /dev/null -f statefile logfile -T 1/1 -T 4/10 'this is a test [0-9]' !'this line does not match' ++++++ logwarn.obsinfo ++++++ --- /var/tmp/diff_new_pack.lcb7dZ/_old 2022-05-28 22:17:38.029060298 +0200 +++ /var/tmp/diff_new_pack.lcb7dZ/_new 2022-05-28 22:17:38.033060302 +0200 @@ -1,6 +1,6 @@ name: logwarn -version: 1.0.16 -mtime: 1637528677 -commit: eb4f94c8d7e96fe05ab31342e0acad6e76579db9 +version: 1.0.17 +mtime: 1653748966 +commit: d2ed59a6d67d94a43788ac89a8f829b462a9ef69