Re: CVS commit: src/usr.bin/gzip
> Your diff is backwards and I guess that is the cause for the confusion. Ah, I checked a wrong tree. Sorry for the noise. --- Izumi Tsutsui
Re: CVS commit: src/usr.bin/gzip
On Sat, Jun 01, 2024 at 11:17:11PM +0900, Izumi Tsutsui wrote: > > Log Message: > > Fix typo in previous > > --- > @@ -1126,7 +1126,7 @@ copymodes(int fd, const struct stat *sbp > if (fchmod(fd, sb.st_mode) < 0) > maybe_warn("couldn't fchmod: %s", file); > > -#if !HAVE_NBTOOL_CONFIG_H > +#ifdef !HAVE_NBTOOL_CONFIG_H [..] > If HAVE_NBTOOL_CONFIG_H is not defined, it's treated as 0 so > !HAVE_NBTOOL_CONFIG_H still works. Your diff is backwards and I guess that is the cause for the confusion. The change was from #ifdef (which does not work with !) to #if, to unbreak the build. The !HAVE_NBTOOL_CONFIG_H is still there and everything should work as you intended. Martin
Re: CVS commit: src/usr.bin/gzip
martin@ wrote: > Module Name: src > Committed By: martin > Date: Sat Jun 1 10:17:12 UTC 2024 > > Modified Files: > src/usr.bin/gzip: gzip.c > > Log Message: > Fix typo in previous --- @@ -1126,7 +1126,7 @@ copymodes(int fd, const struct stat *sbp if (fchmod(fd, sb.st_mode) < 0) maybe_warn("couldn't fchmod: %s", file); -#if !HAVE_NBTOOL_CONFIG_H +#ifdef !HAVE_NBTOOL_CONFIG_H TIMESPEC_TO_TIMEVAL([0], _atimespec); TIMESPEC_TO_TIMEVAL([1], _mtimespec); if (futimes(fd, times) < 0) --- What's the problem in previous? gzip.c already has the following lines: >> #if HAVE_NBTOOL_CONFIG_H >> #include "nbtool_config.h" >> #endif and also has >> #if !HAVE_NBTOOL_CONFIG_H >> #define DISKUNIT(dev) (minor(dev) / MAXPARTITIONS) >> #define DISKPART(dev) (minor(dev) % MAXPARTITIONS) >> #define DISKMINOR(unit, part) \ >> (((unit) * MAXPARTITIONS) + (part)) >> #endif /* !HAVE_NBTOOL_CONFIG_H */ (though etc uses !defined(HAVE_NBTOOL_CONFIG_H)) If HAVE_NBTOOL_CONFIG_H is not defined, it's treated as 0 so !HAVE_NBTOOL_CONFIG_H still works. If you don't like !HAVE_NBTOOL_CONFIG_H, could you please fix all other files? Thanks, --- Izumi Tsutsui
CVS commit: src/usr.bin/gzip
Module Name:src Committed By: martin Date: Sat Jun 1 10:17:12 UTC 2024 Modified Files: src/usr.bin/gzip: gzip.c Log Message: Fix typo in previous To generate a diff of this commit: cvs rdiff -u -r1.126 -r1.127 src/usr.bin/gzip/gzip.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/gzip/gzip.c diff -u src/usr.bin/gzip/gzip.c:1.126 src/usr.bin/gzip/gzip.c:1.127 --- src/usr.bin/gzip/gzip.c:1.126 Sat Jun 1 09:45:36 2024 +++ src/usr.bin/gzip/gzip.c Sat Jun 1 10:17:12 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: gzip.c,v 1.126 2024/06/01 09:45:36 tsutsui Exp $ */ +/* $NetBSD: gzip.c,v 1.127 2024/06/01 10:17:12 martin Exp $ */ /* * Copyright (c) 1997-2024 Matthew R. Green @@ -34,7 +34,7 @@ #ifndef lint __COPYRIGHT("@(#) Copyright (c) 1997-2024 Matthew R. Green. " "All rights reserved."); -__RCSID("$NetBSD: gzip.c,v 1.126 2024/06/01 09:45:36 tsutsui Exp $"); +__RCSID("$NetBSD: gzip.c,v 1.127 2024/06/01 10:17:12 martin Exp $"); #endif /* not lint */ /* @@ -1126,7 +1126,7 @@ copymodes(int fd, const struct stat *sbp if (fchmod(fd, sb.st_mode) < 0) maybe_warn("couldn't fchmod: %s", file); -#ifdef !HAVE_NBTOOL_CONFIG_H +#if !HAVE_NBTOOL_CONFIG_H TIMESPEC_TO_TIMEVAL([0], _atimespec); TIMESPEC_TO_TIMEVAL([1], _mtimespec); if (futimes(fd, times) < 0)
CVS commit: src/usr.bin/gzip
Module Name:src Committed By: martin Date: Sat Jun 1 10:17:12 UTC 2024 Modified Files: src/usr.bin/gzip: gzip.c Log Message: Fix typo in previous To generate a diff of this commit: cvs rdiff -u -r1.126 -r1.127 src/usr.bin/gzip/gzip.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/gzip
Module Name:src Committed By: tsutsui Date: Sat Jun 1 09:45:37 UTC 2024 Modified Files: src/usr.bin/gzip: gzip.c Log Message: Don't try to set non-POSIX struct stat members on tools builds. Fixes PR/58278 (src/tools/gzip build failed on Cygwin). To generate a diff of this commit: cvs rdiff -u -r1.125 -r1.126 src/usr.bin/gzip/gzip.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/gzip/gzip.c diff -u src/usr.bin/gzip/gzip.c:1.125 src/usr.bin/gzip/gzip.c:1.126 --- src/usr.bin/gzip/gzip.c:1.125 Tue Apr 2 12:42:35 2024 +++ src/usr.bin/gzip/gzip.c Sat Jun 1 09:45:36 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: gzip.c,v 1.125 2024/04/02 12:42:35 christos Exp $ */ +/* $NetBSD: gzip.c,v 1.126 2024/06/01 09:45:36 tsutsui Exp $ */ /* * Copyright (c) 1997-2024 Matthew R. Green @@ -34,7 +34,7 @@ #ifndef lint __COPYRIGHT("@(#) Copyright (c) 1997-2024 Matthew R. Green. " "All rights reserved."); -__RCSID("$NetBSD: gzip.c,v 1.125 2024/04/02 12:42:35 christos Exp $"); +__RCSID("$NetBSD: gzip.c,v 1.126 2024/06/01 09:45:36 tsutsui Exp $"); #endif /* not lint */ /* @@ -1126,7 +1126,7 @@ copymodes(int fd, const struct stat *sbp if (fchmod(fd, sb.st_mode) < 0) maybe_warn("couldn't fchmod: %s", file); -#ifdef TIMESPEC_TO_TIMEVAL +#ifdef !HAVE_NBTOOL_CONFIG_H TIMESPEC_TO_TIMEVAL([0], _atimespec); TIMESPEC_TO_TIMEVAL([1], _mtimespec); if (futimes(fd, times) < 0)
CVS commit: src/usr.bin/gzip
Module Name:src Committed By: tsutsui Date: Sat Jun 1 09:45:37 UTC 2024 Modified Files: src/usr.bin/gzip: gzip.c Log Message: Don't try to set non-POSIX struct stat members on tools builds. Fixes PR/58278 (src/tools/gzip build failed on Cygwin). To generate a diff of this commit: cvs rdiff -u -r1.125 -r1.126 src/usr.bin/gzip/gzip.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/gzip
Module Name:src Committed By: christos Date: Sat May 4 13:18:06 UTC 2024 Modified Files: src/usr.bin/gzip: unlz.c Log Message: PR/58233: RVP: Fix lzip dictionary size calculation To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/usr.bin/gzip/unlz.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/gzip/unlz.c diff -u src/usr.bin/gzip/unlz.c:1.9 src/usr.bin/gzip/unlz.c:1.10 --- src/usr.bin/gzip/unlz.c:1.9 Sat May 4 09:17:03 2024 +++ src/usr.bin/gzip/unlz.c Sat May 4 09:18:06 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: unlz.c,v 1.9 2024/05/04 13:17:03 christos Exp $ */ +/* $NetBSD: unlz.c,v 1.10 2024/05/04 13:18:06 christos Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -602,7 +602,7 @@ static unsigned lz_get_dict_size(unsigned char c) { unsigned dict_size = 1 << (c & 0x1f); - dict_size -= (dict_size >> 2) * ( (c >> 5) & 0x7); + dict_size -= (dict_size >> 4) * ( (c >> 5) & 0x7); if (dict_size < MIN_DICTIONARY_SIZE || dict_size > MAX_DICTIONARY_SIZE) return 0; return dict_size;
CVS commit: src/usr.bin/gzip
Module Name:src Committed By: christos Date: Sat May 4 13:18:06 UTC 2024 Modified Files: src/usr.bin/gzip: unlz.c Log Message: PR/58233: RVP: Fix lzip dictionary size calculation To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/usr.bin/gzip/unlz.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/gzip
Module Name:src Committed By: christos Date: Sat May 4 13:17:03 UTC 2024 Modified Files: src/usr.bin/gzip: unlz.c unxz.c Log Message: PR/58223: RVP: Don't write to stdout when testing. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/usr.bin/gzip/unlz.c src/usr.bin/gzip/unxz.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/gzip/unlz.c diff -u src/usr.bin/gzip/unlz.c:1.8 src/usr.bin/gzip/unlz.c:1.9 --- src/usr.bin/gzip/unlz.c:1.8 Sat Jun 10 00:45:25 2023 +++ src/usr.bin/gzip/unlz.c Sat May 4 09:17:03 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: unlz.c,v 1.8 2023/06/10 04:45:25 simonb Exp $ */ +/* $NetBSD: unlz.c,v 1.9 2024/05/04 13:17:03 christos Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -295,7 +295,7 @@ lz_flush(struct lz_decoder *lz) size_t size = (size_t)offs; lz_crc_update(>crc, lz->obuf + lz->spos, size); - if (fwrite(lz->obuf + lz->spos, 1, size, lz->fout) != size) + if (!tflag && fwrite(lz->obuf + lz->spos, 1, size, lz->fout) != size) return -1; lz->wrapped = lz->pos >= lz->dict_size; Index: src/usr.bin/gzip/unxz.c diff -u src/usr.bin/gzip/unxz.c:1.8 src/usr.bin/gzip/unxz.c:1.9 --- src/usr.bin/gzip/unxz.c:1.8 Sat Oct 6 12:36:45 2018 +++ src/usr.bin/gzip/unxz.c Sat May 4 09:17:03 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: unxz.c,v 1.8 2018/10/06 16:36:45 martin Exp $ */ +/* $NetBSD: unxz.c,v 1.9 2024/05/04 13:17:03 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: unxz.c,v 1.8 2018/10/06 16:36:45 martin Exp $"); +__RCSID("$NetBSD: unxz.c,v 1.9 2024/05/04 13:17:03 christos Exp $"); #include #include @@ -99,7 +99,8 @@ unxz(int i, int o, char *pre, size_t pre if (strm.avail_out == 0 || ret != LZMA_OK) { const size_t write_size = sizeof(obuf) - strm.avail_out; - if (write(o, obuf, write_size) != (ssize_t)write_size) + if (!tflag && + write(o, obuf, write_size) != (ssize_t)write_size) maybe_err("write failed"); strm.next_out = obuf;
CVS commit: src/usr.bin/gzip
Module Name:src Committed By: christos Date: Sat May 4 13:17:03 UTC 2024 Modified Files: src/usr.bin/gzip: unlz.c unxz.c Log Message: PR/58223: RVP: Don't write to stdout when testing. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/usr.bin/gzip/unlz.c src/usr.bin/gzip/unxz.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/gzip
Module Name:src Committed By: christos Date: Tue Apr 2 12:42:35 UTC 2024 Modified Files: src/usr.bin/gzip: gzip.c Log Message: oops the #endif was too far down. To generate a diff of this commit: cvs rdiff -u -r1.124 -r1.125 src/usr.bin/gzip/gzip.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/gzip
Module Name:src Committed By: christos Date: Tue Apr 2 12:42:35 UTC 2024 Modified Files: src/usr.bin/gzip: gzip.c Log Message: oops the #endif was too far down. To generate a diff of this commit: cvs rdiff -u -r1.124 -r1.125 src/usr.bin/gzip/gzip.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/gzip/gzip.c diff -u src/usr.bin/gzip/gzip.c:1.124 src/usr.bin/gzip/gzip.c:1.125 --- src/usr.bin/gzip/gzip.c:1.124 Mon Apr 1 18:20:58 2024 +++ src/usr.bin/gzip/gzip.c Tue Apr 2 08:42:35 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: gzip.c,v 1.124 2024/04/01 22:20:58 christos Exp $ */ +/* $NetBSD: gzip.c,v 1.125 2024/04/02 12:42:35 christos Exp $ */ /* * Copyright (c) 1997-2024 Matthew R. Green @@ -34,7 +34,7 @@ #ifndef lint __COPYRIGHT("@(#) Copyright (c) 1997-2024 Matthew R. Green. " "All rights reserved."); -__RCSID("$NetBSD: gzip.c,v 1.124 2024/04/01 22:20:58 christos Exp $"); +__RCSID("$NetBSD: gzip.c,v 1.125 2024/04/02 12:42:35 christos Exp $"); #endif /* not lint */ /* @@ -1762,6 +1762,7 @@ check_siginfo(void) out: print_info = 0; } +#endif static off_t cat_fd(unsigned char * prepend, size_t count, off_t *gsizep, int fd) @@ -1799,7 +1800,6 @@ cat_fd(unsigned char * prepend, size_t c *gsizep = in_tot; return (in_tot); } -#endif static void handle_stdin(void)
CVS commit: src/usr.bin/gzip
Module Name:src Committed By: christos Date: Mon Apr 1 22:20:58 UTC 2024 Modified Files: src/usr.bin/gzip: gzip.c Log Message: Handle not having SIGINFO (Jan-Benedict Glaw) To generate a diff of this commit: cvs rdiff -u -r1.123 -r1.124 src/usr.bin/gzip/gzip.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/gzip/gzip.c diff -u src/usr.bin/gzip/gzip.c:1.123 src/usr.bin/gzip/gzip.c:1.124 --- src/usr.bin/gzip/gzip.c:1.123 Sun Mar 31 22:20:52 2024 +++ src/usr.bin/gzip/gzip.c Mon Apr 1 18:20:58 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: gzip.c,v 1.123 2024/04/01 02:20:52 christos Exp $ */ +/* $NetBSD: gzip.c,v 1.124 2024/04/01 22:20:58 christos Exp $ */ /* * Copyright (c) 1997-2024 Matthew R. Green @@ -34,7 +34,7 @@ #ifndef lint __COPYRIGHT("@(#) Copyright (c) 1997-2024 Matthew R. Green. " "All rights reserved."); -__RCSID("$NetBSD: gzip.c,v 1.123 2024/04/01 02:20:52 christos Exp $"); +__RCSID("$NetBSD: gzip.c,v 1.124 2024/04/01 22:20:58 christos Exp $"); #endif /* not lint */ /* @@ -192,7 +192,9 @@ static int qflag; /* quiet mode */ static int rflag; /* recursive mode */ static int tflag; /* test */ static int vflag; /* verbose mode */ +#ifdef SIGINFO static sig_atomic_t print_info = 0; +#endif #else #define qflag 0 #define tflag 0 @@ -244,7 +246,11 @@ static void infile_set(const char *newin static off_t infile_total; /* total expected to read/write */ static off_t infile_current; /* current read/write */ +#ifdef SIGINFO static void check_siginfo(void); +#else +#define check_siginfo() /* nothing */ +#endif static off_t cat_fd(unsigned char *, size_t, off_t *, int fd); static void prepend_gzip(char *, int *, char ***); static void handle_dir(char *); @@ -1217,18 +1223,22 @@ unlink_input(const char *file, const str unlink(file); } +#ifdef SIGINFO static void got_siginfo(int signo) { print_info = 1; } +#endif static void setup_signals(void) { +#ifdef SIGINFO signal(SIGINFO, got_siginfo); +#endif } static void @@ -1713,7 +1723,7 @@ file_uncompress(char *file, char *outfil return -1; } -#ifndef SMALL +#ifndef check_siginfo static void check_siginfo(void) {
CVS commit: src/usr.bin/gzip
Module Name:src Committed By: christos Date: Mon Apr 1 22:20:58 UTC 2024 Modified Files: src/usr.bin/gzip: gzip.c Log Message: Handle not having SIGINFO (Jan-Benedict Glaw) To generate a diff of this commit: cvs rdiff -u -r1.123 -r1.124 src/usr.bin/gzip/gzip.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/gzip
Module Name:src Committed By: christos Date: Mon Apr 1 02:21:39 UTC 2024 Modified Files: src/usr.bin/gzip: Makefile Log Message: make it work as a tool To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/usr.bin/gzip/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/gzip/Makefile diff -u src/usr.bin/gzip/Makefile:1.18 src/usr.bin/gzip/Makefile:1.19 --- src/usr.bin/gzip/Makefile:1.18 Wed Nov 13 06:12:24 2013 +++ src/usr.bin/gzip/Makefile Sun Mar 31 22:21:39 2024 @@ -1,10 +1,12 @@ -# $NetBSD: Makefile,v 1.18 2013/11/13 11:12:24 pettai Exp $ +# $NetBSD: Makefile,v 1.19 2024/04/01 02:21:39 christos Exp $ USE_FORT?= yes # data-driven bugs? PROG= gzip +SRCS+= gzip.c MAN= gzip.1 gzexe.1 zdiff.1 zforce.1 zgrep.1 zmore.1 znew.1 +.if !defined(HOSTPROG) DPADD= ${LIBZ} ${LIBBZ2} ${LIBLZMA} LDADD= -lz -lbz2 -llzma @@ -25,5 +27,6 @@ LINKS+= ${BINDIR}/gzip ${BINDIR}/gunzip ${BINDIR}/zgrep ${BINDIR}/zegrep \ ${BINDIR}/zgrep ${BINDIR}/zfgrep \ ${BINDIR}/zmore ${BINDIR}/zless +.endif .include
CVS commit: src/usr.bin/gzip
Module Name:src Committed By: christos Date: Mon Apr 1 02:21:39 UTC 2024 Modified Files: src/usr.bin/gzip: Makefile Log Message: make it work as a tool To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/usr.bin/gzip/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/gzip
Module Name:src Committed By: christos Date: Mon Apr 1 02:20:52 UTC 2024 Modified Files: src/usr.bin/gzip: gzip.c Log Message: - -n is the default on SMALL, so accept the flag silently. - conditionalize TIMESPEC_TO_TIMEVAL - add nbtool_config.h To generate a diff of this commit: cvs rdiff -u -r1.122 -r1.123 src/usr.bin/gzip/gzip.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/gzip/gzip.c diff -u src/usr.bin/gzip/gzip.c:1.122 src/usr.bin/gzip/gzip.c:1.123 --- src/usr.bin/gzip/gzip.c:1.122 Sat Feb 3 17:40:29 2024 +++ src/usr.bin/gzip/gzip.c Sun Mar 31 22:20:52 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: gzip.c,v 1.122 2024/02/03 22:40:29 mrg Exp $ */ +/* $NetBSD: gzip.c,v 1.123 2024/04/01 02:20:52 christos Exp $ */ /* * Copyright (c) 1997-2024 Matthew R. Green @@ -26,11 +26,15 @@ * SUCH DAMAGE. */ +#if HAVE_NBTOOL_CONFIG_H +#include "nbtool_config.h" +#endif + #include #ifndef lint __COPYRIGHT("@(#) Copyright (c) 1997-2024 Matthew R. Green. " "All rights reserved."); -__RCSID("$NetBSD: gzip.c,v 1.122 2024/02/03 22:40:29 mrg Exp $"); +__RCSID("$NetBSD: gzip.c,v 1.123 2024/04/01 02:20:52 christos Exp $"); #endif /* not lint */ /* @@ -337,7 +341,7 @@ main(int argc, char **argv) dflag = cflag = 1; #ifdef SMALL -#define OPT_LIST "123456789cdhlV" +#define OPT_LIST "123456789cdhlVn" #else #define OPT_LIST "123456789cdfhklNnqrS:tVv" #endif @@ -403,6 +407,9 @@ main(int argc, char **argv) case 'v': vflag = 1; break; +#else + case 'n': + break; #endif default: usage(); @@ -1113,6 +1120,7 @@ copymodes(int fd, const struct stat *sbp if (fchmod(fd, sb.st_mode) < 0) maybe_warn("couldn't fchmod: %s", file); +#ifdef TIMESPEC_TO_TIMEVAL TIMESPEC_TO_TIMEVAL([0], _atimespec); TIMESPEC_TO_TIMEVAL([1], _mtimespec); if (futimes(fd, times) < 0) @@ -1121,6 +1129,7 @@ copymodes(int fd, const struct stat *sbp /* finally, only try flags if they exist already */ if (sb.st_flags != 0 && fchflags(fd, sb.st_flags) < 0) maybe_warn("couldn't fchflags: %s", file); +#endif } #endif
CVS commit: src/usr.bin/gzip
Module Name:src Committed By: christos Date: Mon Apr 1 02:20:52 UTC 2024 Modified Files: src/usr.bin/gzip: gzip.c Log Message: - -n is the default on SMALL, so accept the flag silently. - conditionalize TIMESPEC_TO_TIMEVAL - add nbtool_config.h To generate a diff of this commit: cvs rdiff -u -r1.122 -r1.123 src/usr.bin/gzip/gzip.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/gzip
Module Name:src Committed By: mrg Date: Sat Feb 3 22:40:29 UTC 2024 Modified Files: src/usr.bin/gzip: gzip.c Log Message: bump copyright and version. To generate a diff of this commit: cvs rdiff -u -r1.121 -r1.122 src/usr.bin/gzip/gzip.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/gzip/gzip.c diff -u src/usr.bin/gzip/gzip.c:1.121 src/usr.bin/gzip/gzip.c:1.122 --- src/usr.bin/gzip/gzip.c:1.121 Mon Jan 15 17:35:48 2024 +++ src/usr.bin/gzip/gzip.c Sat Feb 3 22:40:29 2024 @@ -1,8 +1,7 @@ -/* $NetBSD: gzip.c,v 1.121 2024/01/15 17:35:48 christos Exp $ */ +/* $NetBSD: gzip.c,v 1.122 2024/02/03 22:40:29 mrg Exp $ */ /* - * Copyright (c) 1997, 1998, 2003, 2004, 2006, 2008, 2009, 2010, 2011, 2015, 2017 - *Matthew R. Green + * Copyright (c) 1997-2024 Matthew R. Green * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,9 +28,9 @@ #include #ifndef lint -__COPYRIGHT("@(#) Copyright (c) 1997, 1998, 2003, 2004, 2006, 2008,\ - 2009, 2010, 2011, 2015, 2017 Matthew R. Green. All rights reserved."); -__RCSID("$NetBSD: gzip.c,v 1.121 2024/01/15 17:35:48 christos Exp $"); +__COPYRIGHT("@(#) Copyright (c) 1997-2024 Matthew R. Green. " + "All rights reserved."); +__RCSID("$NetBSD: gzip.c,v 1.122 2024/02/03 22:40:29 mrg Exp $"); #endif /* not lint */ /* @@ -173,7 +172,7 @@ static suffixes_t suffixes[] = { #define NUM_SUFFIXES (sizeof suffixes / sizeof suffixes[0]) #define SUFFIX_MAXLEN 30 -static const char gzip_version[] = "NetBSD gzip 20170803"; +static const char gzip_version[] = "NetBSD gzip 20240203"; static int cflag; /* stdout mode */ static int dflag; /* decompress mode */
CVS commit: src/usr.bin/gzip
Module Name:src Committed By: mrg Date: Sat Feb 3 22:40:29 UTC 2024 Modified Files: src/usr.bin/gzip: gzip.c Log Message: bump copyright and version. To generate a diff of this commit: cvs rdiff -u -r1.121 -r1.122 src/usr.bin/gzip/gzip.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/gzip
Module Name:src Committed By: christos Date: Mon Jan 15 17:35:48 UTC 2024 Modified Files: src/usr.bin/gzip: gzip.c Log Message: PR/57858: Ricardo Branco: Print the full pathname on errors. from FreeBSD https://github.com/NetBSD/src/pull/25 To generate a diff of this commit: cvs rdiff -u -r1.120 -r1.121 src/usr.bin/gzip/gzip.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/gzip
Module Name:src Committed By: christos Date: Mon Jan 15 17:35:48 UTC 2024 Modified Files: src/usr.bin/gzip: gzip.c Log Message: PR/57858: Ricardo Branco: Print the full pathname on errors. from FreeBSD https://github.com/NetBSD/src/pull/25 To generate a diff of this commit: cvs rdiff -u -r1.120 -r1.121 src/usr.bin/gzip/gzip.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/gzip/gzip.c diff -u src/usr.bin/gzip/gzip.c:1.120 src/usr.bin/gzip/gzip.c:1.121 --- src/usr.bin/gzip/gzip.c:1.120 Sun Jan 14 13:12:59 2024 +++ src/usr.bin/gzip/gzip.c Mon Jan 15 12:35:48 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: gzip.c,v 1.120 2024/01/14 18:12:59 mrg Exp $ */ +/* $NetBSD: gzip.c,v 1.121 2024/01/15 17:35:48 christos Exp $ */ /* * Copyright (c) 1997, 1998, 2003, 2004, 2006, 2008, 2009, 2010, 2011, 2015, 2017 @@ -31,7 +31,7 @@ #ifndef lint __COPYRIGHT("@(#) Copyright (c) 1997, 1998, 2003, 2004, 2006, 2008,\ 2009, 2010, 2011, 2015, 2017 Matthew R. Green. All rights reserved."); -__RCSID("$NetBSD: gzip.c,v 1.120 2024/01/14 18:12:59 mrg Exp $"); +__RCSID("$NetBSD: gzip.c,v 1.121 2024/01/15 17:35:48 christos Exp $"); #endif /* not lint */ /* @@ -2037,7 +2037,7 @@ handle_dir(char *dir) path_argv[0] = dir; path_argv[1] = 0; - fts = fts_open(path_argv, FTS_PHYSICAL, NULL); + fts = fts_open(path_argv, FTS_PHYSICAL | FTS_NOCHDIR, NULL); if (fts == NULL) { warn("couldn't fts_open %s", dir); return; @@ -2055,7 +2055,7 @@ handle_dir(char *dir) maybe_warn("%s", entry->fts_path); continue; case FTS_F: - handle_file(entry->fts_name, entry->fts_statp); + handle_file(entry->fts_path, entry->fts_statp); } } (void)fts_close(fts);
CVS commit: src/usr.bin/gzip
Module Name:src Committed By: mrg Date: Sun Jan 14 18:12:59 UTC 2024 Modified Files: src/usr.bin/gzip: gzip.c Log Message: set file flags after setting other modes otherwise permission to set modes may be revoked by the flags. from PR#57855. thanks! XXX: pullup-all To generate a diff of this commit: cvs rdiff -u -r1.119 -r1.120 src/usr.bin/gzip/gzip.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/gzip/gzip.c diff -u src/usr.bin/gzip/gzip.c:1.119 src/usr.bin/gzip/gzip.c:1.120 --- src/usr.bin/gzip/gzip.c:1.119 Sat Jun 10 04:45:25 2023 +++ src/usr.bin/gzip/gzip.c Sun Jan 14 18:12:59 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: gzip.c,v 1.119 2023/06/10 04:45:25 simonb Exp $ */ +/* $NetBSD: gzip.c,v 1.120 2024/01/14 18:12:59 mrg Exp $ */ /* * Copyright (c) 1997, 1998, 2003, 2004, 2006, 2008, 2009, 2010, 2011, 2015, 2017 @@ -31,7 +31,7 @@ #ifndef lint __COPYRIGHT("@(#) Copyright (c) 1997, 1998, 2003, 2004, 2006, 2008,\ 2009, 2010, 2011, 2015, 2017 Matthew R. Green. All rights reserved."); -__RCSID("$NetBSD: gzip.c,v 1.119 2023/06/10 04:45:25 simonb Exp $"); +__RCSID("$NetBSD: gzip.c,v 1.120 2024/01/14 18:12:59 mrg Exp $"); #endif /* not lint */ /* @@ -1114,14 +1114,14 @@ copymodes(int fd, const struct stat *sbp if (fchmod(fd, sb.st_mode) < 0) maybe_warn("couldn't fchmod: %s", file); - /* only try flags if they exist already */ -if (sb.st_flags != 0 && fchflags(fd, sb.st_flags) < 0) - maybe_warn("couldn't fchflags: %s", file); - TIMESPEC_TO_TIMEVAL([0], _atimespec); TIMESPEC_TO_TIMEVAL([1], _mtimespec); if (futimes(fd, times) < 0) maybe_warn("couldn't utimes: %s", file); + + /* finally, only try flags if they exist already */ +if (sb.st_flags != 0 && fchflags(fd, sb.st_flags) < 0) + maybe_warn("couldn't fchflags: %s", file); } #endif
CVS commit: src/usr.bin/gzip
Module Name:src Committed By: mrg Date: Sun Jan 14 18:12:59 UTC 2024 Modified Files: src/usr.bin/gzip: gzip.c Log Message: set file flags after setting other modes otherwise permission to set modes may be revoked by the flags. from PR#57855. thanks! XXX: pullup-all To generate a diff of this commit: cvs rdiff -u -r1.119 -r1.120 src/usr.bin/gzip/gzip.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/gzip
Module Name:src Committed By: simonb Date: Sat Jun 10 04:45:25 UTC 2023 Modified Files: src/usr.bin/gzip: gzip.c unlz.c unpack.c Log Message: Pull git commit way-etc-20140221.tar.bz2 by Xin Li from FreeBSD: Remove unneeded checks for prelen. In order to determine the type of a compressed file, we have to read in the first four bytes which may also be important for decompression purposes, to do that we would pass the buffer that we have already read in, along with the size of it. Rename header1 to fourbytes to make that explicit, and remove all checks for prelen. To generate a diff of this commit: cvs rdiff -u -r1.118 -r1.119 src/usr.bin/gzip/gzip.c cvs rdiff -u -r1.7 -r1.8 src/usr.bin/gzip/unlz.c cvs rdiff -u -r1.3 -r1.4 src/usr.bin/gzip/unpack.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/gzip
Module Name:src Committed By: simonb Date: Sat Jun 10 04:45:25 UTC 2023 Modified Files: src/usr.bin/gzip: gzip.c unlz.c unpack.c Log Message: Pull git commit way-etc-20140221.tar.bz2 by Xin Li from FreeBSD: Remove unneeded checks for prelen. In order to determine the type of a compressed file, we have to read in the first four bytes which may also be important for decompression purposes, to do that we would pass the buffer that we have already read in, along with the size of it. Rename header1 to fourbytes to make that explicit, and remove all checks for prelen. To generate a diff of this commit: cvs rdiff -u -r1.118 -r1.119 src/usr.bin/gzip/gzip.c cvs rdiff -u -r1.7 -r1.8 src/usr.bin/gzip/unlz.c cvs rdiff -u -r1.3 -r1.4 src/usr.bin/gzip/unpack.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/gzip/gzip.c diff -u src/usr.bin/gzip/gzip.c:1.118 src/usr.bin/gzip/gzip.c:1.119 --- src/usr.bin/gzip/gzip.c:1.118 Sat Jan 22 14:00:45 2022 +++ src/usr.bin/gzip/gzip.c Sat Jun 10 04:45:25 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: gzip.c,v 1.118 2022/01/22 14:00:45 christos Exp $ */ +/* $NetBSD: gzip.c,v 1.119 2023/06/10 04:45:25 simonb Exp $ */ /* * Copyright (c) 1997, 1998, 2003, 2004, 2006, 2008, 2009, 2010, 2011, 2015, 2017 @@ -31,7 +31,7 @@ #ifndef lint __COPYRIGHT("@(#) Copyright (c) 1997, 1998, 2003, 2004, 2006, 2008,\ 2009, 2010, 2011, 2015, 2017 Matthew R. Green. All rights reserved."); -__RCSID("$NetBSD: gzip.c,v 1.118 2022/01/22 14:00:45 christos Exp $"); +__RCSID("$NetBSD: gzip.c,v 1.119 2023/06/10 04:45:25 simonb Exp $"); #endif /* not lint */ /* @@ -1400,7 +1400,7 @@ file_uncompress(char *file, char *outfil struct stat isb, osb; off_t size; ssize_t rbytes; - unsigned char header1[4]; + unsigned char fourbytes[4]; enum filetype method; int fd, ofd, zfd = -1; size_t in_size; @@ -1434,8 +1434,8 @@ file_uncompress(char *file, char *outfil goto lose; } - rbytes = read(fd, header1, sizeof header1); - if (rbytes != sizeof header1) { + rbytes = read(fd, fourbytes, sizeof fourbytes); + if (rbytes != sizeof fourbytes) { /* we don't want to fail here. */ #ifndef SMALL if (fflag) @@ -1449,7 +1449,7 @@ file_uncompress(char *file, char *outfil } infile_newdata(rbytes); - method = file_gettype(header1); + method = file_gettype(fourbytes); #ifndef SMALL if (fflag == 0 && method == FT_UNKNOWN) { maybe_warnx("%s: not in gzip format", file); @@ -1473,7 +1473,7 @@ file_uncompress(char *file, char *outfil infile_newdata(rv); timestamp = ts[3] << 24 | ts[2] << 16 | ts[1] << 8 | ts[0]; - if (header1[3] & ORIG_NAME) { + if (fourbytes[3] & ORIG_NAME) { rbytes = pread(fd, name, sizeof(name) - 1, GZIP_ORIGNAME); if (rbytes < 0) { maybe_warn("can't read %s", file); @@ -1787,7 +1787,7 @@ static void handle_stdin(void) { struct stat isb; - unsigned char header1[4]; + unsigned char fourbytes[4]; size_t in_size; off_t usize, gsize; enum filetype method; @@ -1818,16 +1818,16 @@ handle_stdin(void) goto out; } - bytes_read = read_retry(STDIN_FILENO, header1, sizeof header1); + bytes_read = read_retry(STDIN_FILENO, fourbytes, sizeof fourbytes); if (bytes_read == -1) { maybe_warn("can't read stdin"); goto out; - } else if (bytes_read != sizeof(header1)) { + } else if (bytes_read != sizeof(fourbytes)) { maybe_warnx("(stdin): unexpected end of file"); goto out; } - method = file_gettype(header1); + method = file_gettype(fourbytes); switch (method) { default: #ifndef SMALL @@ -1835,17 +1835,17 @@ handle_stdin(void) maybe_warnx("unknown compression format"); goto out; } - usize = cat_fd(header1, sizeof header1, , STDIN_FILENO); + usize = cat_fd(fourbytes, sizeof fourbytes, , STDIN_FILENO); break; #endif case FT_GZIP: usize = gz_uncompress(STDIN_FILENO, STDOUT_FILENO, - (char *)header1, sizeof header1, , "(stdin)"); + (char *)fourbytes, sizeof fourbytes, , "(stdin)"); break; #ifndef NO_BZIP2_SUPPORT case FT_BZIP2: usize = unbzip2(STDIN_FILENO, STDOUT_FILENO, -(char *)header1, sizeof header1, ); +(char *)fourbytes, sizeof fourbytes, ); break; #endif #ifndef NO_COMPRESS_SUPPORT @@ -1855,27 +1855,27 @@ handle_stdin(void) goto out; } - usize = zuncompress(in, stdout, (char *)header1, - sizeof header1, ); + usize = zuncompress(in, stdout, (char *)fourbytes, + sizeof fourbytes, ); fclose(in); break; #endif #ifndef NO_PACK_SUPPORT case FT_PACK: usize = unpack(STDIN_FILENO, STDOUT_FILENO, - (char *)header1, sizeof header1, ); + (char *)fourbytes, sizeof fourbytes, ); break; #endif #ifndef NO_XZ_SUPPORT case FT_XZ: usize = unxz(STDIN_FILENO, STDOUT_FILENO, - (char *)header1, sizeof header1, ); + (char *)fourbytes, sizeof fourbytes, ); break; #endif
CVS commit: src/usr.bin/gzip
Module Name:src Committed By: christos Date: Sat Jan 22 14:00:45 UTC 2022 Modified Files: src/usr.bin/gzip: gzip.c Log Message: make siginfo handler print to /dev/tty. To generate a diff of this commit: cvs rdiff -u -r1.117 -r1.118 src/usr.bin/gzip/gzip.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/gzip/gzip.c diff -u src/usr.bin/gzip/gzip.c:1.117 src/usr.bin/gzip/gzip.c:1.118 --- src/usr.bin/gzip/gzip.c:1.117 Thu Jun 24 03:16:49 2021 +++ src/usr.bin/gzip/gzip.c Sat Jan 22 09:00:45 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: gzip.c,v 1.117 2021/06/24 07:16:49 simonb Exp $ */ +/* $NetBSD: gzip.c,v 1.118 2022/01/22 14:00:45 christos Exp $ */ /* * Copyright (c) 1997, 1998, 2003, 2004, 2006, 2008, 2009, 2010, 2011, 2015, 2017 @@ -31,7 +31,7 @@ #ifndef lint __COPYRIGHT("@(#) Copyright (c) 1997, 1998, 2003, 2004, 2006, 2008,\ 2009, 2010, 2011, 2015, 2017 Matthew R. Green. All rights reserved."); -__RCSID("$NetBSD: gzip.c,v 1.117 2021/06/24 07:16:49 simonb Exp $"); +__RCSID("$NetBSD: gzip.c,v 1.118 2022/01/22 14:00:45 christos Exp $"); #endif /* not lint */ /* @@ -65,6 +65,7 @@ __RCSID("$NetBSD: gzip.c,v 1.117 2021/06 #include #include #include +#include #ifndef PRIdOFF #define PRIdOFF PRId64 @@ -1708,19 +1709,39 @@ file_uncompress(char *file, char *outfil static void check_siginfo(void) { + static int ttyfd = -2; + char buf[2048]; + int n; + if (print_info == 0) return; - if (infile) { - if (infile_total) { - int pcent = (int)((100.0 * infile_current) / infile_total); - - fprintf(stderr, "%s: done %llu/%llu bytes %d%%\n", -infile, (unsigned long long)infile_current, -(unsigned long long)infile_total, pcent); - } else - fprintf(stderr, "%s: done %llu bytes\n", -infile, (unsigned long long)infile_current); + + if (!infile) + goto out; + + if (ttyfd == -2) + ttyfd = open(_PATH_TTY, O_RDWR | O_CLOEXEC); + + if (ttyfd == -1) + goto out; + + if (infile_total) { + const double pcent = (100.0 * infile_current) / infile_total; + + n = snprintf(buf, sizeof(buf), + "%s: %s: done %ju/%ju bytes (%3.2f%%)\n", + getprogname(), infile, (uintmax_t)infile_current, + (uintmax_t)infile_total, pcent); + } else { + n = snprintf(buf, sizeof(buf), "%s: %s: done %ju bytes\n", + getprogname(), infile, (uintmax_t)infile_current); } + + if (n <= 0) + goto out; + + write(ttyfd, buf, (size_t)n); +out: print_info = 0; } @@ -1883,7 +1904,7 @@ handle_stdout(void) uint32_t mtime; int ret; - infile_set("(stdout)", 0); + infile_set("", 0); if (fflag == 0 && isatty(STDOUT_FILENO)) { maybe_warnx("standard output is a terminal -- ignoring"); @@ -1898,7 +1919,7 @@ handle_stdout(void) } if (S_ISREG(sb.st_mode)) { - infile_set("(stdout)", sb.st_size); + infile_set("", sb.st_size); mtime = (uint32_t)sb.st_mtime; } else { systime = time(NULL);
CVS commit: src/usr.bin/gzip
Module Name:src Committed By: christos Date: Sat Jan 22 14:00:45 UTC 2022 Modified Files: src/usr.bin/gzip: gzip.c Log Message: make siginfo handler print to /dev/tty. To generate a diff of this commit: cvs rdiff -u -r1.117 -r1.118 src/usr.bin/gzip/gzip.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/usr.bin/gzip
On 13.06.2018 00:54, Robert Elz wrote: > Date:Tue, 12 Jun 2018 19:52:43 +0200 > From:Kamil Rytarowski > Message-ID: <90519caf-289c-b4d3-7ebc-d14d4efc9...@gmx.com> > > | I will try to meet the expectations in commit messages for *San fixes. > > That would be good (and not just those, unless the board required it, which > I doubt is likely, there's no need for the "Sponsored by" stuff almost > anywhere, maybe just in those monthly reports you send). > OK! I've got few more reports and I will keep iterating over them and fixing appropriately. The next one on my list is grep(1) as it affects every user: http://www.netbsd.org/~kamil/mksanitizer-reports/0003-grep-_obstack_begin.txt For the context, UBSan is still able to catch defined unsigned overflow issues (with an additional command line argument) as these operations are rather rarely used deliberately in C. It can catch violation of compiler specific features like passing NULL to a function with specified nonnull arguments. signature.asc Description: OpenPGP digital signature
Re: CVS commit: src/usr.bin/gzip
Date:Tue, 12 Jun 2018 19:52:43 +0200 From:Kamil Rytarowski Message-ID: <90519caf-289c-b4d3-7ebc-d14d4efc9...@gmx.com> | I will try to meet the expectations in commit messages for *San fixes. That would be good (and not just those, unless the board required it, which I doubt is likely, there's no need for the "Sponsored by" stuff almost anywhere, maybe just in those monthly reports you send). | I will try to also dig down why some programs needs in bit mask the sign | bit in unsigned integer instead of quickly swapping the type to unsigned. It is probably important to verify that making the vars unsigned will not break anything (normally for vars using bit fields and masking it will not) as breaking working code in the name of avoiding technical unspecified behaviour is not really a good idea. Fixing it is a good idea provided that the fixed version works (which it will for the cases you have changed that I have looked at I believe) but it is important that it really be a fix. | There are just many reports so I expected to land patches quickly, just | please be aware that presenting more deep investigation in a commit | message will take longer. That isn't needed either - if a program is doing something that is undefined all the commit message needs to say is something like "Avoid unspecified behaviour, found by XXXsan" That's it. If someone wants to see what the unepcified behaviour is, then they can check what lines were changed, if they can't work out why that code was not correct, they can ask (but I dount that is going to happen often, most people here recognise what C requires in this area - even if it is a bit stupid (IMO) and might not really be required for posix systems which require that int types be 2's complement, unlike what C wants to be able to run on.) kre
Re: CVS commit: src/usr.bin/gzip
On 12.06.2018 15:52, Joerg Sonnenberger wrote: > On Tue, Jun 12, 2018 at 02:35:40PM +0200, Kamil Rytarowski wrote: >> On 12.06.2018 14:24, Joerg Sonnenberger wrote: >>> That's missing the point. A short description of why the specific >>> undefined behavior is seen is useful. Pasting random program output is >>> not. >>> >>> Joerg >>> >> >> Random program output might not be useful, but the one containing >> runtime message is.. and it was 1-liner + 1 line how to invoke it and 1 >> line of runtime error. I have more to come an I will keep documenting >> the runtime error messages. > > Are you trying hard to be obnoxious? The only useful part that you > quoted is the runtime error itself. The rest is either noise or doesn't > help with reproduction since it depends on external input. Nothing in > the commit message contains a real analysis of why this "reproducer" > triggers the problem. As such, it is pointless noise and shouldn't be > preserved for eternity. > > Joerg > I will try to meet the expectations in commit messages for *San fixes. I will try to also dig down why some programs needs in bit mask the sign bit in unsigned integer instead of quickly swapping the type to unsigned. There are just many reports so I expected to land patches quickly, just please be aware that presenting more deep investigation in a commit message will take longer. signature.asc Description: OpenPGP digital signature
Re: CVS commit: src/usr.bin/gzip
On Tue, Jun 12, 2018 at 02:35:40PM +0200, Kamil Rytarowski wrote: > On 12.06.2018 14:24, Joerg Sonnenberger wrote: > > That's missing the point. A short description of why the specific > > undefined behavior is seen is useful. Pasting random program output is > > not. > > > > Joerg > > > > Random program output might not be useful, but the one containing > runtime message is.. and it was 1-liner + 1 line how to invoke it and 1 > line of runtime error. I have more to come an I will keep documenting > the runtime error messages. Are you trying hard to be obnoxious? The only useful part that you quoted is the runtime error itself. The rest is either noise or doesn't help with reproduction since it depends on external input. Nothing in the commit message contains a real analysis of why this "reproducer" triggers the problem. As such, it is pointless noise and shouldn't be preserved for eternity. Joerg
Re: CVS commit: src/usr.bin/gzip
On 12.06.2018 14:24, Joerg Sonnenberger wrote: > On Tue, Jun 12, 2018 at 12:00:01PM +0200, Kamil Rytarowski wrote: >> On 12.06.2018 11:51, matthew green wrote: On 12.06.2018 10:28, Kamil Rytarowski wrote: > On 12.06.2018 09:04, Martin Husemann wrote: >> On Tue, Jun 12, 2018 at 05:47:35AM +0300, Valery Ushakov wrote: >>> To sum it up, out of 30+ lines of the commit message, the relevant >>> information is contained only in (part of) one line. >> >> FWIW, I fully agree with uwe here. >> >> Martin > > I find keeping reproducers for issues very useful. Keeping track of them > helps to check whether fixes are functional. > > Also introduction of refactoring without a note in the message is not > acceptable in my opinion. > > Thanks to the verbose message people have the whole context. To be clear, I will keep introducing fixes in the same form. I'm catching e.g. bugs in programs only in specific usage and input. If I will refactor something I will keep including it in messages too. >>> >>> that's a pity. >>> >>> i don't mind having a little more detail that uwe is talking >>> about, but i don't think we need nearly as much. it's worth >>> mentioning the sanitizer used as the finding-tool, but there >>> is no need to repeat the basic fix 3 times, or to reproduce >>> the code change itself. >>> >>> please reconsider and use a shorter form. >>> >> >> I will keep messages within 20 lines. > > That's missing the point. A short description of why the specific > undefined behavior is seen is useful. Pasting random program output is > not. > > Joerg > Random program output might not be useful, but the one containing runtime message is.. and it was 1-liner + 1 line how to invoke it and 1 line of runtime error. I have more to come an I will keep documenting the runtime error messages. signature.asc Description: OpenPGP digital signature
Re: CVS commit: src/usr.bin/gzip
On 12.06.2018 11:51, matthew green wrote: >> On 12.06.2018 10:28, Kamil Rytarowski wrote: >>> On 12.06.2018 09:04, Martin Husemann wrote: On Tue, Jun 12, 2018 at 05:47:35AM +0300, Valery Ushakov wrote: > To sum it up, out of 30+ lines of the commit message, the relevant > information is contained only in (part of) one line. FWIW, I fully agree with uwe here. Martin >>> >>> I find keeping reproducers for issues very useful. Keeping track of them >>> helps to check whether fixes are functional. >>> >>> Also introduction of refactoring without a note in the message is not >>> acceptable in my opinion. >>> >>> Thanks to the verbose message people have the whole context. >> >> To be clear, I will keep introducing fixes in the same form. I'm >> catching e.g. bugs in programs only in specific usage and input. If I >> will refactor something I will keep including it in messages too. > > that's a pity. > > i don't mind having a little more detail that uwe is talking > about, but i don't think we need nearly as much. it's worth > mentioning the sanitizer used as the finding-tool, but there > is no need to repeat the basic fix 3 times, or to reproduce > the code change itself. > > please reconsider and use a shorter form. > I will keep messages within 20 lines. signature.asc Description: OpenPGP digital signature
re: CVS commit: src/usr.bin/gzip
>On 12.06.2018 10:28, Kamil Rytarowski wrote: >> On 12.06.2018 09:04, Martin Husemann wrote: >>> On Tue, Jun 12, 2018 at 05:47:35AM +0300, Valery Ushakov wrote: To sum it up, out of 30+ lines of the commit message, the relevant information is contained only in (part of) one line. >>> >>> FWIW, I fully agree with uwe here. >>> >>> Martin >> >> I find keeping reproducers for issues very useful. Keeping track of them >> helps to check whether fixes are functional. >> >> Also introduction of refactoring without a note in the message is not >> acceptable in my opinion. >> >> Thanks to the verbose message people have the whole context. > >To be clear, I will keep introducing fixes in the same form. I'm >catching e.g. bugs in programs only in specific usage and input. If I >will refactor something I will keep including it in messages too. that's a pity. i don't mind having a little more detail that uwe is talking about, but i don't think we need nearly as much. it's worth mentioning the sanitizer used as the finding-tool, but there is no need to repeat the basic fix 3 times, or to reproduce the code change itself. please reconsider and use a shorter form. .mrg.
Re: CVS commit: src/usr.bin/gzip
On 12.06.2018 10:28, Kamil Rytarowski wrote: > On 12.06.2018 09:04, Martin Husemann wrote: >> On Tue, Jun 12, 2018 at 05:47:35AM +0300, Valery Ushakov wrote: >>> To sum it up, out of 30+ lines of the commit message, the relevant >>> information is contained only in (part of) one line. >> >> FWIW, I fully agree with uwe here. >> >> Martin >> > > I find keeping reproducers for issues very useful. Keeping track of them > helps to check whether fixes are functional. > > Also introduction of refactoring without a note in the message is not > acceptable in my opinion. > > Thanks to the verbose message people have the whole context. > To be clear, I will keep introducing fixes in the same form. I'm catching e.g. bugs in programs only in specific usage and input. If I will refactor something I will keep including it in messages too. signature.asc Description: OpenPGP digital signature
Re: CVS commit: src/usr.bin/gzip
On 12.06.2018 09:04, Martin Husemann wrote: > On Tue, Jun 12, 2018 at 05:47:35AM +0300, Valery Ushakov wrote: >> To sum it up, out of 30+ lines of the commit message, the relevant >> information is contained only in (part of) one line. > > FWIW, I fully agree with uwe here. > > Martin > I find keeping reproducers for issues very useful. Keeping track of them helps to check whether fixes are functional. Also introduction of refactoring without a note in the message is not acceptable in my opinion. Thanks to the verbose message people have the whole context. signature.asc Description: OpenPGP digital signature
Re: CVS commit: src/usr.bin/gzip
On Tue, Jun 12, 2018 at 05:47:35AM +0300, Valery Ushakov wrote: > To sum it up, out of 30+ lines of the commit message, the relevant > information is contained only in (part of) one line. FWIW, I fully agree with uwe here. Martin
Re: CVS commit: src/usr.bin/gzip
On Mon, Jun 11, 2018 at 21:59:19 -0400, John Hawkinson wrote: > Valery Ushakov wrote on Tue, 12 Jun 2018 > at 04:50:36 +0300 in <20180612015036.ge15...@pony.stderr.spb.ru>: > > > Please, can you keep your commit messages to the point? > > > > "Fix unportable left shift" > > > > is probably a good enough summary. You don't have to paste the test > > suite results and the actual diffs in free form as well. > > What is wrong with a long commit message, as long as it is > summarized clearly at the top, as was done here? I'd much rather > have a long explanation than only the summary. There's a fine line between an explanatory and an overly long commit message (as Bryan Cantrill put it in one interview, "there's a fine line between elegant and sleazy"). Also the communication context of a log message is the output of cvs log. The commit mail (i.e. the context of source-changes) may be a factor but only a secondary one. | Correct Undefined Behavior in gzip(1) This is being committed to gzip.c. You will read this commit message when reading the output of cvs log for gzip.c. I don't think it's useful to repeat in the commit message that this commit is to gzip. | Unportable left shift reported with MKSANITIZER=yes USE_SANITIZER=undefined: | | # progress -zf ./games.tgz tar -xp -C "./" -f - | /public/src.git/usr.bin/gzip/gzip.c:2126:33: runtime error: left shift of 251 by | 24 places cannot be represented in type 'int' | 100% |** | **| 44500 KiB 119.69 MiB/s00:00 ETA An example of incorrect behaviour of a program that is being fixed is informative. But the above is like fixing a missing semicolon and quoting compiler error in the commit message. E.g. # compile ofwboot/Locore.o /home/uwe/work/netbsd/build/tools/bin/powerpc--netbsd-gcc -Os -ffreestanding -msoft-float -fno-unwind-tables -fno-asynchronous-unwind-tables -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith-std=gnu99 -Werror -D_STANDALONE -DSUPPORT_DHCP -DSUPPORT_USTARFS -DHAVE_CHANGEDISK_HOOK --sysroot=/home/uwe/work/netbsd/build/distrib/macppc -I. -I/home/uwe/work/netbsd/ro/src/sys/arch/macppc/stand/ofwboot -I/home/uwe/work/netbsd/ro/src/sys/arch/macppc/stand/ofwboot/../../.. -I/home/uwe/work/netbsd/ro/src/sys/arch/macppc/stand/ofwboot/../../../.. -DRELOC=0xE0 -DRELOC_FLATFILE=0x -I/home/uwe/work/netbsd/ro/src/sys/arch/macppc/stand/ofwboot/../../../../lib/libkern/../../../common/lib/libc/quad -I/home/uwe/work/netbsd/ro/src/sys/arch/macppc/stand/ofwboot/../../../../lib/libkern/../../../common/lib/libc/string -I/home/uwe/work/netbsd/ro/src/sys/arch/macppc/stand/ofwboot/../../../../lib/libkern/../../../common/lib/libc/arch/powerpc/string -c/home/uwe/work/netbsd/ro/src/sys/arch/macppc/stand/ofwboot/Locore.c /home/uwe/work/netbsd/ro/src/sys/arch/macppc/stand/ofwboot/Locore.c: In function 'setup': /home/uwe/work/netbsd/ro/src/sys/arch/macppc/stand/ofwboot/Locore.c:659:1: error: expected ';' before '}' token } ^ Do you think that would be a reasonable part of a commit message? | Refactor the following code into something that is more clear | and fix signed integer shift, This is the third time the log tells us it's fixing a left shift, counting the first sentence of the above passage and the output from the sanitizer. | [...] by casting all buf[] elements to | (unsigned int): | | unsigned char buf[8]; | uint32_t usize; | [...] | else { | usize = buf[4] | buf[5] << 8 | | buf[6] << 16 | buf[7] << 24; | [...] | | New version: | | usize = buf[4]; | usize |= (unsigned int)buf[5] << 8; | usize |= (unsigned int)buf[6] << 16; | usize |= (unsigned int)buf[7] << 24; This just repeats the actual diff in free form. | Only the "<< 24" part needs explicit cast, but for consistency make the | integer promotion explicit and clear to a code reader. I'm on the fence for this one. I'd say it's redundant. It doesn't help that the actual change is sloppy as it casts to a different type than the result - usize is uint32_t, not unsigned int. | Sponsored by I'm not sure this is relevant either. To sum it up, out of 30+ lines of the commit message, the relevant information is contained only in (part of) one line. -uwe
Re: CVS commit: src/usr.bin/gzip
Valery Ushakov wrote on Tue, 12 Jun 2018 at 04:50:36 +0300 in <20180612015036.ge15...@pony.stderr.spb.ru>: > Please, can you keep your commit messages to the point? > > "Fix unportable left shift" > > is probably a good enough summary. You don't have to paste the test > suite results and the actual diffs in free form as well. What is wrong with a long commit message, as long as it is summarized clearly at the top, as was done here? I'd much rather have a long explanation than only the summary. --jhawk
Re: CVS commit: src/usr.bin/gzip
Please, can you keep your commit messages to the point? "Fix unportable left shift" is probably a good enough summary. You don't have to paste the test suite results and the actual diffs in free form as well. On Tue, Jun 12, 2018 at 00:42:17 +, Kamil Rytarowski wrote: > Log Message: > Correct Undefined Behavior in gzip(1) > > Unportable left shift reported with MKSANITIZER=yes USE_SANITIZER=undefined: > > # progress -zf ./games.tgz tar -xp -C "./" -f - > /public/src.git/usr.bin/gzip/gzip.c:2126:33: runtime error: left shift of 251 > by 24 places cannot be represented in type 'int' > 100% > || > 44500 KiB 119.69 MiB/s00:00 ETA > > Refactor the following code into something that is more clear > and fix signed integer shift, by casting all buf[] elements to > (unsigned int): > > unsigned char buf[8]; > uint32_t usize; > [...] > else { > usize = buf[4] | buf[5] << 8 | > buf[6] << 16 | buf[7] << 24; > [...] > > New version: > > usize = buf[4]; > usize |= (unsigned int)buf[5] << 8; > usize |= (unsigned int)buf[6] << 16; > usize |= (unsigned int)buf[7] << 24; > > Only the "<< 24" part needs explicit cast, but for consistency make the > integer promotion explicit and clear to a code reader. > > Sponsored by -uwe