From aa6a5547b387edef8db12345b97af9c35d9571df Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Thu, 4 Jan 2007 14:55:42 +0100 Subject: Ensure that "group --version" always prints the current year. * src/groups.sh (version): Use @CURRENT_YEAR@, rather than 2006. * src/Makefile.am (.sh): Also substitute for @CURRENT_YEAR@. Suggestion from Eric Blake. --- ChangeLog | 5 +++++ src/Makefile.am | 4 ++-- src/groups.sh | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 50d56dae5..ac3be263d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2007-01-04 Jim Meyering + Ensure that "group --version" always prints the current year. + * src/groups.sh (version): Use @CURRENT_YEAR@, rather than 2006. + * src/Makefile.am (.sh): Also substitute for @CURRENT_YEAR@. + Suggestion from Eric Blake. + When decoding, always allow newlines in input, with almost no performance impact. * src/base64.c (do_decode): Initialize decode context. diff --git a/src/Makefile.am b/src/Makefile.am index 8c39ee02f..ddd13efd4 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,7 +1,6 @@ ## Process this file with automake to produce Makefile.in -*-Makefile-*- -## Copyright (C) 1990, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -## 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +## Copyright (C) 1990, 1991, 1993-2007 Free Software Foundation, Inc. ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -120,6 +119,7 @@ SUFFIXES = .sh rm -f $@ $@-t sed \ -e 's!@''bindir''@!$(bindir)!' \ + -e 's/@''CURRENT_YEAR'@/`date +%Y`/ \ -e 's/@''GNU_PACKAGE''@/$(GNU_PACKAGE)/' \ -e 's/@''PACKAGE_BUGREPORT''@/$(PACKAGE_BUGREPORT)/' \ -e 's/@''VERSION''@/$(VERSION)/' $< > $@-t diff --git a/src/groups.sh b/src/groups.sh index 86343fcfc..f416fdb97 100755 --- a/src/groups.sh +++ b/src/groups.sh @@ -1,6 +1,6 @@ #!/bin/sh # groups -- print the groups a user is in -# Copyright (C) 1991, 1997, 2000, 2002, 2004, 2006 Free Software Foundation, Inc. +# Copyright (C) 1991, 1997, 2000, 2002, 2004-2007 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -32,7 +32,7 @@ Same as id -Gn. If no USERNAME, use current process. Report bugs to <@PACKAGE_BUGREPORT@>." version='groups (@GNU_PACKAGE@) @VERSION@ -Copyright (C) 2006 Free Software Foundation, Inc. +Copyright (C) @CURRENT_YEAR@ Free Software Foundation, Inc. This is free software. You may redistribute copies of it under the terms of the GNU General Public License . There is NO WARRANTY, to the extent permitted by law. -- cgit v1.2.3-70-g09d2 From 11bcfcc72aafed790b7e262c98b864ff9d8ed706 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Thu, 4 Jan 2007 15:34:29 +0100 Subject: Use the release year, not the current year. * src/groups.sh (version): Use a better name: @RELEASE_YEAR@. * src/Makefile.am (RELEASE_YEAR): Define it. (.sh): Use it. Thanks to a prod from Eric Blake. --- ChangeLog | 6 ++++++ src/Makefile.am | 7 ++++++- src/groups.sh | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index ac3be263d..4fb6c5239 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2007-01-04 Jim Meyering + Use the release year, not the current year. + * src/groups.sh (version): Use a better name: @RELEASE_YEAR@. + * src/Makefile.am (RELEASE_YEAR): Define it. + (.sh): Use it. + Thanks to a prod from Eric Blake. + Ensure that "group --version" always prints the current year. * src/groups.sh (version): Use @CURRENT_YEAR@, rather than 2006. * src/Makefile.am (.sh): Also substitute for @CURRENT_YEAR@. diff --git a/src/Makefile.am b/src/Makefile.am index ddd13efd4..7aa504b36 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -115,11 +115,16 @@ $(PROGRAMS): ../lib/libcoreutils.a SUFFIXES = .sh +# Get the release year from ../lib/version-etc.c. +RELEASE_YEAR = \ + `sed -n '/.*COPYRIGHT_YEAR = \([0-9][0-9][0-9][0-9]\) };/s//\1/p' \ + $(top_srcdir)/lib/version-etc.c` + .sh: rm -f $@ $@-t sed \ -e 's!@''bindir''@!$(bindir)!' \ - -e 's/@''CURRENT_YEAR'@/`date +%Y`/ \ + -e 's/@''RELEASE_YEAR'@/$(RELEASE_YEAR)/ \ -e 's/@''GNU_PACKAGE''@/$(GNU_PACKAGE)/' \ -e 's/@''PACKAGE_BUGREPORT''@/$(PACKAGE_BUGREPORT)/' \ -e 's/@''VERSION''@/$(VERSION)/' $< > $@-t diff --git a/src/groups.sh b/src/groups.sh index f416fdb97..dd32c63c5 100755 --- a/src/groups.sh +++ b/src/groups.sh @@ -32,7 +32,7 @@ Same as id -Gn. If no USERNAME, use current process. Report bugs to <@PACKAGE_BUGREPORT@>." version='groups (@GNU_PACKAGE@) @VERSION@ -Copyright (C) @CURRENT_YEAR@ Free Software Foundation, Inc. +Copyright (C) @RELEASE_YEAR@ Free Software Foundation, Inc. This is free software. You may redistribute copies of it under the terms of the GNU General Public License . There is NO WARRANTY, to the extent permitted by law. -- cgit v1.2.3-70-g09d2 From 4082e3be7cf8c17bf7d8e086798b5f78ba7ea45f Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Fri, 5 Jan 2007 09:52:10 +0100 Subject: * src/dircolors.hin: Add a TERM directive for cons25. --- ChangeLog | 4 ++++ src/dircolors.hin | 1 + 2 files changed, 5 insertions(+) diff --git a/ChangeLog b/ChangeLog index 4fb6c5239..14ab6512d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-01-05 Mike Frysinger + + * src/dircolors.hin: Add a TERM directive for cons25. + 2007-01-04 Jim Meyering Use the release year, not the current year. diff --git a/src/dircolors.hin b/src/dircolors.hin index c13bd4ab9..8d550d194 100644 --- a/src/dircolors.hin +++ b/src/dircolors.hin @@ -23,6 +23,7 @@ TERM con80x30 TERM con80x43 TERM con80x50 TERM con80x60 +TERM cons25 TERM console TERM cygwin TERM dtterm -- cgit v1.2.3-70-g09d2 From ab58de37e6e01b22acc49f72b109b6e910f5190a Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Fri, 5 Jan 2007 12:30:51 +0100 Subject: Avoid a used-uninitialized bug for invalid input, i.e., when the size of the input, not counting newlines, is 1 % 4. * gl/lib/base64.c (base64_decode): Don't hard-code inlen==4. It may be smaller when flushing. --- ChangeLog | 7 +++++++ gl/lib/base64.c | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 14ab6512d..9c4eb97f2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-01-05 Jim Meyering + + Avoid a used-uninitialized bug for invalid input, i.e., when the size + of the input, not counting newlines, is 1 % 4. + * gl/lib/base64.c (base64_decode): Don't hard-code inlen==4. + It may be smaller when flushing. + 2007-01-05 Mike Frysinger * src/dircolors.hin: Add a TERM directive for cons25. diff --git a/gl/lib/base64.c b/gl/lib/base64.c index ba7322a26..a438d0fd1 100644 --- a/gl/lib/base64.c +++ b/gl/lib/base64.c @@ -506,7 +506,7 @@ base64_decode (struct base64_decode_context *ctx, inlen = 0; break; } - if (!decode_4 (non_nl, 4, &out, &outleft)) + if (!decode_4 (non_nl, inlen, &out, &outleft)) break; inlen = in_end - in; -- cgit v1.2.3-70-g09d2 From 37bcc2770788d8fd9fd8cda3413a27dd131d9e22 Mon Sep 17 00:00:00 2001 From: "G.P. Halkes" Date: Sat, 6 Jan 2007 09:49:47 +0100 Subject: * src/fmt.c (copy_rest): Correct prefix handling. Don't elide a line with the prefix followed by only white space. (get_line): Move EOF-check to loop-termination condition. * tests/fmt/basic (pfx-1): Adjust test to expect desired result. (pfx-2): Remove test; its premise was contrary to the documentation. --- ChangeLog | 8 ++++++++ src/fmt.c | 11 ++++++----- tests/fmt/basic | 20 ++++---------------- 3 files changed, 18 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9c4eb97f2..7fcccc15d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-01-06 G.P. Halkes + + * src/fmt.c (copy_rest): Correct prefix handling. + Don't elide a line with the prefix followed by only white space. + (get_line): Move EOF-check to loop-termination condition. + * tests/fmt/basic (pfx-1): Adjust test to expect desired result. + (pfx-2): Remove test; its premise was contrary to the documentation. + 2007-01-05 Jim Meyering Avoid a used-uninitialized bug for invalid input, i.e., when the size diff --git a/src/fmt.c b/src/fmt.c index 9a6c1c0fd..5ccc8c44a 100644 --- a/src/fmt.c +++ b/src/fmt.c @@ -607,12 +607,15 @@ copy_rest (FILE *f, int c) const char *s; out_column = 0; - if (in_column > next_prefix_indent && c != '\n' && c != EOF) + if (in_column > next_prefix_indent || (c != '\n' && c != EOF)) { put_space (next_prefix_indent); for (s = prefix; out_column != in_column && *s; out_column++) putchar (*s++); - put_space (in_column - out_column); + if (c != EOF && c != '\n') + put_space (in_column - out_column); + if (c == EOF && in_column >= next_prefix_indent + prefix_length) + putchar ('\n'); } while (c != '\n' && c != EOF) { @@ -688,10 +691,8 @@ get_line (FILE *f, int c) flush_paragraph (); } word_limit++; - if (c == EOF) - return EOF; } - while (c != '\n'); + while (c != '\n' && c != EOF); return get_prefix (f); } diff --git a/tests/fmt/basic b/tests/fmt/basic index 77682f103..04938b860 100755 --- a/tests/fmt/basic +++ b/tests/fmt/basic @@ -2,7 +2,7 @@ # -*- perl -*- # Basic tests for "fmt". -# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Free Software +# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software # Foundation, Inc. # This program is free software; you can redistribute it and/or modify @@ -60,23 +60,11 @@ my @Tests = . " is the first\noption; use -w N instead\n" . "Try `fmt --help' for more information.\n" }, {EXIT => 1}], - # With --prefix=P, Do not remove leading on lines without the prefix. + # With --prefix=P, do not remove leading space on lines without the prefix. ['pfx-1', qw (-p '>'), {IN=> " 1\n 2\n\t3\n\t\t4\n> quoted\n> text\n"}, - # This is the buggy output (leading white space removed), - # from coreutils-5.93. - {OUT=> "1\n2\n3\n4\n> quoted text\n"}], - # FIXME: this is the desired output - # {OUT=> " 1\n 2\n\t3\n\t\t4\n> quoted text\n"}], - - # Like the above, but when two adjacent, non-prefixed lines have - # the same indentation, ensure that they are formatted. - ['pfx-2', qw (-p '>'), - {IN=> " 1\n 2\n\t3\n\t4\n"}, - {OUT=> "1\n2\n3\n4\n"}], - # FIXME: this is the desired output - # {OUT=> " 1 2\n\t3 4\n"}], - ); + {OUT=> " 1\n 2\n\t3\n\t\t4\n> quoted text\n"}], +); my $save_temps = $ENV{DEBUG}; my $verbose = $ENV{VERBOSE}; -- cgit v1.2.3-70-g09d2 From bce110cdd584f52f91bd83ba17078e63d8b89841 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sat, 6 Jan 2007 10:42:17 +0100 Subject: * tests/fmt/basic (pfx-only, pfx-of-pfx): New tests, based on examples from G.P. Halkes in . --- ChangeLog | 6 ++++++ tests/fmt/basic | 12 ++++++++++++ 2 files changed, 18 insertions(+) diff --git a/ChangeLog b/ChangeLog index 7fcccc15d..2ac01ae57 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-01-06 Jim Meyering + + * tests/fmt/basic (pfx-only, pfx-of-pfx): New tests, + based on examples from G.P. Halkes in + . + 2007-01-06 G.P. Halkes * src/fmt.c (copy_rest): Correct prefix handling. diff --git a/tests/fmt/basic b/tests/fmt/basic index 04938b860..66abe1305 100755 --- a/tests/fmt/basic +++ b/tests/fmt/basic @@ -64,6 +64,18 @@ my @Tests = ['pfx-1', qw (-p '>'), {IN=> " 1\n 2\n\t3\n\t\t4\n> quoted\n> text\n"}, {OUT=> " 1\n 2\n\t3\n\t\t4\n> quoted text\n"}], + + # Don't remove prefix from a prefix-only line. + ['pfx-only', qw (-p '>'), + {IN=> ">\n"}, + {OUT=> ">\n"}], + + # With a multi-byte prefix, say, "foo", don't empty a line that + # starts with a strict prefix (e.g. "fo") of that prefix. + # With fmt from coreutils-6.7, it would mistakenly output an empty line. + ['pfx-of-pfx', qw (-p 'foo'), + {IN=> "fo\n"}, + {OUT=> "fo\n"}], ); my $save_temps = $ENV{DEBUG}; -- cgit v1.2.3-70-g09d2 From dad7d86d57d2a6351ba1a395109760dce8977a91 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sun, 7 Jan 2007 18:38:56 +0100 Subject: * tests/sample-test: Update copyright date to 2007. * Makefile.maint (copyright-check): Also check the copyright date in tests/sample-test. --- ChangeLog | 6 ++++++ Makefile.maint | 9 ++++++++- tests/sample-test | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2ac01ae57..d4e766ed3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-01-07 Jim Meyering + + * tests/sample-test: Update copyright date to 2007. + * Makefile.maint (copyright-check): Also check the copyright date + in tests/sample-test. + 2007-01-06 Jim Meyering * tests/fmt/basic (pfx-only, pfx-of-pfx): New tests, diff --git a/Makefile.maint b/Makefile.maint index c33d9d235..9baafa3d8 100644 --- a/Makefile.maint +++ b/Makefile.maint @@ -2,7 +2,7 @@ # This Makefile fragment is shared between the coreutils, # CPPI, Bison, and Autoconf. -## Copyright (C) 2001-2006 Free Software Foundation, Inc. +## Copyright (C) 2001-2007 Free Software Foundation, Inc. ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -449,6 +449,7 @@ writable-files: test "$$fail" && exit 1 || : v_etc_file = lib/version-etc.c +sample-test = tests/sample-test # Make sure that the copyright date in $(v_etc_file) is up to date. copyright-check: @if test -f $(v_etc_file); then \ @@ -457,6 +458,12 @@ copyright-check: || { echo 'out of date copyright in $(v_etc_file); update it' 1>&2; \ exit 1; }; \ fi + @if test -f $(sample-test); then \ + grep '# Copyright (C) '$$(date +%Y)' Free' $(sample-test) \ + >/dev/null \ + || { echo 'out of date copyright in $(sample-test); update it' 1>&2; \ + exit 1; }; \ + fi # Sanity checks with the repository. diff --git a/tests/sample-test b/tests/sample-test index f4b459ce2..87e16ff31 100644 --- a/tests/sample-test +++ b/tests/sample-test @@ -1,7 +1,7 @@ #!/bin/sh # FIXME -# Copyright (C) 2006 Free Software Foundation, Inc. +# Copyright (C) 2007 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by -- cgit v1.2.3-70-g09d2