Re: [PATCH] doc: clarify the cp --reflink NEWS

2009-08-14 Thread Jim Meyering
Pádraig Brady wrote:
>>From 3214858c9b53dcd8d2ef47473427fcd29dc56a7d Mon Sep 17 00:00:00 2001
> From: =?utf-8?q?P=C3=A1draig=20Brady?= 
> Date: Thu, 13 Aug 2009 17:25:09 +0100
> Subject: [PATCH] doc: clarify the cp --reflink NEWS
>
> * NEWS: Remove the description associated with the removed
> experimental code which unconditionally tried to reflink() on copy.
> Also clarify where --reflink works exactly.

Thanks!




Re: copyright years: mass-update every January 1

2009-08-14 Thread Jim Meyering
Joel E. Denny wrote:
> On Thu, 13 Aug 2009, Eric Blake wrote:
...
>> According to Akim Demaille on 8/13/2009 1:59 AM:
>> >> -   Copyright (C) 89, 90, 91, 1995-2006, 2008-2009 Free Software
>> >> -   Foundation, Inc.
>> >> +   Copyright (C) 89, 90, 91, 1995-2006, 2008-2009 Free Software
>> >> Foundation, Inc.
>> >
>> > While at it, why not standardize everything to 4 digits (I don't think
>> > we need to address the Y10k issues yet :), and to introduce intervals
>> > where applicable?  Is there some legal thingy that forbids it?  It might
>> > help making some lines smaller.
>>
>> Yes - see this post:
>> http://lists.gnu.org/archive/html/bug-gnulib/2009-08/msg00184.html
>>
>> I'm not personally opposed to compressed years, but if you want the tool
>> to output compressed years instead of longhand, it should be an option
>> (and more importantly, we should also fix the tool to allow longhand years
>> for maintainers that want longhand).
>
> Below are some patches to implement that.
...
> +2009-08-14  Joel E. Denny  
> +
> + update-copyright: convert 2-digit to 4-digit years
> + * build-aux/update-copyright: Implement and document.
> + * tests/test-update-copyright.sh: Update.
...
> + update-copyright: much ado about intervals
> + * build-aux/update-copyright: Implement and document
> + UPDATE_COPYRIGHT_USE_INTERVALS to control expansion and collapse
> + of copyright year intervals.
> + Also, document UPDATE_COPYRIGHT_YEAR.
> + * tests/test-update-copyright.sh: Test it.

Thanks for all of that.
Pushed.




Re: [RFC] fallocate utility

2009-08-14 Thread Pádraig Brady
Karel Zak wrote:
> On Fri, Jul 31, 2009 at 09:27:57PM +0100, Pádraig Brady wrote:
>> I was thinking the new fallocate util would have the
>> same options as the existing truncate util.
>> I.E. -n or -o would not be needed or supportable in all situations.
>> If you think that users would need those, then I suggest
>> adding the linux specific fallocate util to util-linux-ng,
>> and we'll add the more generic `truncate --allocate`
>> (or separate command) to coreutils.
> 
>  So.. what is our final conclusion? The Linux specific fallocate(1) in
>  util-linux-ng, right? Everyone agrees?

If others agree that a util is required to expose
the linux specific fallocate() functionality, in
addition to a more generic util to allocate space
that would fallocate() if available, then yes it
should go in util-linux-ng.

cheers,
Pádraig.




Re: [RFC] fallocate utility

2009-08-14 Thread Karel Zak
On Fri, Jul 31, 2009 at 09:27:57PM +0100, Pádraig Brady wrote:
> I was thinking the new fallocate util would have the
> same options as the existing truncate util.
> I.E. -n or -o would not be needed or supportable in all situations.
> If you think that users would need those, then I suggest
> adding the linux specific fallocate util to util-linux-ng,
> and we'll add the more generic `truncate --allocate`
> (or separate command) to coreutils.

 So.. what is our final conclusion? The Linux specific fallocate(1) in
 util-linux-ng, right? Everyone agrees?

Karel

-- 
 Karel Zak  




Re: no feedback on snapshot? coreutils-7.5 coming soon

2009-08-14 Thread Jim Meyering
Pádraig Brady wrote:
> I was wondering about printing the warning,
> and was wary about now silently not preserving symlink times.
> I.E. being silently inconsistent. I guess it's better
> to be quiet in this case? That also means I can
> reinstate the mv/part-symlink test on systems without utimensat().
> Updated patch attached.

I too had my doubts initially, but then noticed that rsync is also
silent about this.

I pushed your change with a few small log/comment tweaks.
Thanks again!

>From f0a1f0df2295aaed418f201bbec67df120e1ac17 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= 
Date: Thu, 13 Aug 2009 10:39:10 +0100
Subject: [PATCH] cp,mv: fix issues with preserving timestamps of copied symlinks

* src/copy.c (copy_internal): On systems without utimensat don't
use utimens on a symlink, as that would dereference the symlink.
* tests/cp/abuse: To work around possible attribute preservation
failures breaking the test, use cp -dR rather than cp -a.
---
 src/copy.c |   19 +++
 tests/cp/abuse |2 +-
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/src/copy.c b/src/copy.c
index bed90c4..bf9230b 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -118,18 +118,18 @@ static bool owner_failure_ok (struct cp_options const *x);
 static char const *top_level_src_name;
 static char const *top_level_dst_name;

-/* Wrap utimensat-with-AT_FDCWD and utimens, to keep these
-   cpp directives out of the main code.  */
+/* Set the timestamp of symlink, FILE, to TIMESPEC.
+   If this system lacks support for that, simply return 0.  */
 static inline int
-utimensat_if_possible (char const *file, struct timespec const *timespec)
+utimens_symlink (char const *file, struct timespec const *timespec)
 {
-  return
 #if HAVE_UTIMENSAT
-utimensat (AT_FDCWD, file, timespec, AT_SYMLINK_NOFOLLOW)
+  return utimensat (AT_FDCWD, file, timespec, AT_SYMLINK_NOFOLLOW);
 #else
-utimens (file, timespec)
+  /* Don't set errno=ENOTSUP here as we don't want
+ to output an error message for this case.  */
+  return 0;
 #endif
-;
 }

 /* Perform the O(1) btrfs clone operation, if possible.
@@ -2117,7 +2117,10 @@ copy_internal (char const *src_name, char const 
*dst_name,
   timespec[0] = get_stat_atime (&src_sb);
   timespec[1] = get_stat_mtime (&src_sb);

-  if (utimensat_if_possible (dst_name, timespec) != 0)
+  if ((dest_is_symlink
+  ? utimens_symlink (dst_name, timespec)
+  : utimens (dst_name, timespec))
+ != 0)
{
  error (0, errno, _("preserving times for %s"), quote (dst_name));
  if (x->require_preserve)
diff --git a/tests/cp/abuse b/tests/cp/abuse
index 285c531..e9086b8 100755
--- a/tests/cp/abuse
+++ b/tests/cp/abuse
@@ -37,7 +37,7 @@ for i in dangling-dest existing-dest; do
   test $i = existing-dest && echo i > t
   test $i = dangling-dest && rm -f t

-  cp -a a/1 b/1 c 2> out && fail=1
+  cp -dR a/1 b/1 c 2> out && fail=1

   compare out exp || fail=1

--
1.6.4.357.gfd68c




[PATCH] build: use gnulib's getopt-gnu module (getopt is now deprecated)

2009-08-14 Thread Jim Meyering
There have been a few interesting changes in gnulib recently,
so I've gone ahead and adapted to use the new-named getopt-gnu
module and to pull in all the latest:

>From ea5b7124b44a52da4a5be4c7c42a37d65025c621 Mon Sep 17 00:00:00 2001
From: Jim Meyering 
Date: Thu, 13 Aug 2009 08:37:37 +0200
Subject: [PATCH] build: use gnulib's getopt-gnu module (getopt is now 
deprecated)

* bootstrap.conf (gnulib_modules): Gnulib's getopt module is now
deprecated; use the new, preferred name, getopt-gnu.
* gnulib: Update to latest.
---
 bootstrap.conf |2 +-
 gnulib |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/bootstrap.conf b/bootstrap.conf
index b6623f6..991e5bd 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -102,7 +102,7 @@ gnulib_modules="
   getline
   getloadavg
   getndelim2
-  getopt
+  getopt-gnu
   getpagesize
   getpass-gnu
   gettext
diff --git a/gnulib b/gnulib
index d93c1f1..2f5181b 16
--- a/gnulib
+++ b/gnulib
@@ -1 +1 @@
-Subproject commit d93c1f1b00e1dea78b919c7fb7b6ddebecfcf3a5
+Subproject commit 2f5181b1a247323cb2a4a4c6165997674866bb20
--
1.6.4.357.gfd68c




Re: no feedback on snapshot? coreutils-7.5 coming soon

2009-08-14 Thread Eric Blake
Jim Meyering  meyering.net> writes:

> 
> AFAIK, I am the only one who has built the latest snapshot:
> 
> http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/17604
> 
> Though it's been only two days.
> 
> Unless I hear of new bug reports or portability problems soon,
> expect coreutils-7.5 to be released in the next few days.

On cygwin, 'make' completes, but 'make check' issues a warning (and fails if I 
also add -Werror to CFLAGS):

ccache gcc -std=gnu99   -gdwarf-2 -Wall -Werror  -Wl,--as-needed -o stdbuf.exe 
stdbuf.o libver.a ../lib/libcoreutils.a /usr/local/lib/libintl.dll.a -liconv -
L/usr/local/lib ../lib/libcoreutils.a -liconv 
diff progs-makefile progs-readme && rm -rf progs-readme progs-makefile
ccache gcc -std=gnu99  -I. -I../lib  -I../lib -I/usr/local/include -fPIC   -
gdwarf-2 -Wall -Werror -MT libstdbuf_so-libstdbuf.o -MD -MP -
MF .deps/libstdbuf_so-libstdbuf.Tpo -c -o libstdbuf_so-libstdbuf.o `test -
f 'libstdbuf.c' || echo './'`libstdbuf.c
libstdbuf.c:1: warning: -fPIC ignored for target (all code is position 
independent)

And even if I don't turn on -Werror, 'make check' dies further on:

  CCLD   libstdbuf.so.exe
libstdbuf_so-libstdbuf.o: In function `apply_mode':
/home/eblake/coreutils/src/libstdbuf.c:108: undefined reference to 
`_libintl_gettext'
/home/eblake/coreutils/src/libstdbuf.c:116: undefined reference to 
`_libintl_gettext'
/home/eblake/coreutils/src/libstdbuf.c:124: undefined reference to 
`_libintl_gettext'

(wow - it really seems like this should be creating libstdbuf.dll or even 
cygstdbuf.dll, per cygwin naming conventions; not libstdbuf.so.exe).

I'm not sure whether libstdbuf will even work for cygwin (as it is not ELF); 
and part of me is afraid that we would have to use libtool to get this to work 
portably.  Maybe it is easiest to just figure out how to disable stdbuf from 
even being attempted, let along tested, on cygwin, until I can find more time 
to investigate it further?

I'm now running 'make -k check', and will try to spot any obvious problems.  I 
already have some effort for porting things like freopen O_BINARY issues over 
to cygwin that I have not yet pushed upstream.  But I maintain my stance that, 
as in the past, I don't want you to feel obligated to hold up the release 
process just to cater to cygwin.

-- 
Eric Blake






Re: no feedback on snapshot? coreutils-7.5 coming soon

2009-08-14 Thread Jim Meyering
Eric Blake wrote:
> Jim Meyering  meyering.net> writes:
>> AFAIK, I am the only one who has built the latest snapshot:
>>
>> http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/17604
>>
>> Though it's been only two days.
>>
>> Unless I hear of new bug reports or portability problems soon,
>> expect coreutils-7.5 to be released in the next few days.
>
> On cygwin, 'make' completes, but 'make check' issues a warning (and fails if I
> also add -Werror to CFLAGS):
>
> ccache gcc -std=gnu99   -gdwarf-2 -Wall -Werror  -Wl,--as-needed -o stdbuf.exe
> stdbuf.o libver.a ../lib/libcoreutils.a /usr/local/lib/libintl.dll.a -liconv -
> L/usr/local/lib ../lib/libcoreutils.a -liconv
> diff progs-makefile progs-readme && rm -rf progs-readme progs-makefile
> ccache gcc -std=gnu99  -I. -I../lib  -I../lib -I/usr/local/include -fPIC   -
> gdwarf-2 -Wall -Werror -MT libstdbuf_so-libstdbuf.o -MD -MP -
> MF .deps/libstdbuf_so-libstdbuf.Tpo -c -o libstdbuf_so-libstdbuf.o `test -
> f 'libstdbuf.c' || echo './'`libstdbuf.c
> libstdbuf.c:1: warning: -fPIC ignored for target (all code is position
> independent)
>
> And even if I don't turn on -Werror, 'make check' dies further on:
>
>   CCLD   libstdbuf.so.exe
> libstdbuf_so-libstdbuf.o: In function `apply_mode':
> /home/eblake/coreutils/src/libstdbuf.c:108: undefined reference to
> `_libintl_gettext'
> /home/eblake/coreutils/src/libstdbuf.c:116: undefined reference to
> `_libintl_gettext'
> /home/eblake/coreutils/src/libstdbuf.c:124: undefined reference to
> `_libintl_gettext'
>
> (wow - it really seems like this should be creating libstdbuf.dll or even
> cygstdbuf.dll, per cygwin naming conventions; not libstdbuf.so.exe).
>
> I'm not sure whether libstdbuf will even work for cygwin (as it is not ELF);

Thanks for the feedback!

In that case, the configure-time check for is-an-ELF-system
must be failing on cygwin:

# Limit stdbuf to ELF systems with GCC
optional_pkglib_progs=
AC_MSG_CHECKING([whether this is an ELF system])
AC_EGREP_CPP([yes], [#if __ELF__
yes
#endif], [elf_sys=yes], [elf_sys=no])
AC_MSG_RESULT([$elf_sys])
if test "$elf_sys" = "yes" && \
   test "$GCC" = "yes"; then
  gl_ADD_PROG([optional_bin_progs], [stdbuf])
  gl_ADD_PROG([optional_pkglib_progs], [libstdbuf.so])
fi

> and part of me is afraid that we would have to use libtool to get this to work

Right.  we want to avoid that.

> portably.  Maybe it is easiest to just figure out how to disable stdbuf from
> even being attempted, let along tested, on cygwin, until I can find more time
> to investigate it further?
>
> I'm now running 'make -k check', and will try to spot any obvious problems.  I
> already have some effort for porting things like freopen O_BINARY issues over
> to cygwin that I have not yet pushed upstream.  But I maintain my stance that,
> as in the past, I don't want you to feel obligated to hold up the release
> process just to cater to cygwin.

Thanks.




Re: no feedback on snapshot? coreutils-7.5 coming soon

2009-08-14 Thread Eric Blake
Jim Meyering  meyering.net> writes:

> In that case, the configure-time check for is-an-ELF-system
> must be failing on cygwin:

No:

configure:43745: checking whether this is an ELF system
configure:43761: result: no

But there might be some missing holes where 'make check' tries to build stdbuf 
without regards to the result of the configure results.

> >
> > I'm now running 'make -k check', and will try to spot any obvious problems.

So far, I'm seeing a suspicious failure:

tests/misc/factor.log:
factor (GNU coreutils) 7.4.121-ea5b7
...
z...
factor: test z: stderr mismatch, comparing z.E (actual) and z.1 (expected)
*** z.E Fri Aug 14 10:36:48 2009
--- z.1 Fri Aug 14 10:36:48 2009
***
*** 1,2 
! factor: unknown option -- 1
  Try `factor --help' for more information.
--- 1,2 
! factor: invalid option -- 1
  Try `factor --help' for more information.
cont...

I'm not sure whether that might be related to the getopt vs. getopt-gnu change 
though (I've been building incrementally, and may have picked up some state 
where cygwin's getopt snuck into usage for a while; I'm going to repeat with a 
pristine bootstrap to see if the problem still persists).

The test is still running.  Meanwhile, there are a number of failures probably 
due to the fact that cygwin Admin users can read and delete files that are 
otherwise unreadable from POSIX permission standpoint (such as rm/rm1).  But 
this is no different than in the past; I've been meaning to find time to write 
some sort of test filter that checks for superuser privileges to skip these 
sorts of tests, and I can also try and figure out how to repeat the testsuite 
run under a different user without Admin rights.  Again, don't hold up the 
release waiting for me (I've had a lot on my plate lately on other fronts, and 
I maintain the cygwin port of coreutils so whatever doesn't make it upstream 
will still make it by the time I complete the cygwin packaging).

-- 
Eric Blake






Re: no feedback on snapshot? coreutils-7.5 coming soon

2009-08-14 Thread Jim Meyering
Eric Blake wrote:

> Jim Meyering  meyering.net> writes:
>
>> In that case, the configure-time check for is-an-ELF-system
>> must be failing on cygwin:
>
> No:
>
> configure:43745: checking whether this is an ELF system
> configure:43761: result: no
>
> But there might be some missing holes where 'make check' tries to build stdbuf
> without regards to the result of the configure results.

Then I suspect a portability problem, because if I simulate
failure of that configure-time test, "make" does not try to
build stdbuf or libstdbuf* on gnu/linux.

If you can see (looking at src/Makefile) why it's trying to build
stdbuf, we should be able to deduce where the problem lies.
Portability of gl_ADD_PROG, perhaps...

>> >
>> > I'm now running 'make -k check', and will try to spot any obvious problems.
>
> So far, I'm seeing a suspicious failure:
>
> tests/misc/factor.log:
> factor (GNU coreutils) 7.4.121-ea5b7
> ...
> z...
> factor: test z: stderr mismatch, comparing z.E (actual) and z.1 (expected)
> *** z.E Fri Aug 14 10:36:48 2009
> --- z.1 Fri Aug 14 10:36:48 2009
> ***
> *** 1,2 
> ! factor: unknown option -- 1
>   Try `factor --help' for more information.
> --- 1,2 
> ! factor: invalid option -- 1
>   Try `factor --help' for more information.
> cont...

Thanks for investigating!




Re: no feedback on snapshot? coreutils-7.5 coming soon

2009-08-14 Thread Eric Blake
Eric Blake  byu.net> writes:

> The test is still running.

misc/stdbuf hangs (cygwin still has some fifo issues that might be at play, but 
more importantly, dd appears to be stuck trying to write to a fifo that never 
gets filled because stdbuf isn't working).  I had to kill two different dd 
processes to get the testsuite to resume.

Another suspicious failure:

tests/misc/test-pwd.log
/home/eblake/coreutils/src/pwd.exe: error while loading shared libraries: ?: 
cannot open shared object file: No such file or directory
pwd-long:  does not contain old CWD

It looks like the test removes PATH from the environment; but this has the 
unfortunate side effect of crippling cygwin, which requires both /bin and 
Windows directories to be in PATH at all times for .dlls to be found and usable 
in running an executable, even when you don't otherwise use the PATH for the 
programs that you are invoking.  In other words, you should be doing something 
similar to 'command −p getconf PATH' to determine the bare minimum PATH rather 
than nuking it altogether; unfortunately, command -p getconf PATH is probably 
not portable.

-- 
Eric Blake







Re: no feedback on snapshot? coreutils-7.5 coming soon

2009-08-14 Thread Jim Meyering
Eric Blake wrote:

> Eric Blake  byu.net> writes:
>
>> The test is still running.
>
> misc/stdbuf hangs (cygwin still has some fifo issues that might be at play, 
> but

That should not run if stdbuf is not built.

Here's a patch:

>From 6c077c1633e31c36d17253ee7c946b47791dfd8e Mon Sep 17 00:00:00 2001
From: Jim Meyering 
Date: Wed, 12 Aug 2009 23:05:17 +0200
Subject: [PATCH] * src/remove.c (rm_fts): Handle --one-file-system.

---
 src/remove.c |   14 ++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/src/remove.c b/src/remove.c
index 80be530..ea9e78c 100644
--- a/src/remove.c
+++ b/src/remove.c
@@ -519,6 +519,20 @@ rm_fts (FTS *fts, FTSENT *ent, struct rm_options const *x)
 case FTS_NSOK: /* e.g., dangling symlink */
 case FTS_DEFAULT:  /* none of the above */
   ;
+  /* With --one-file-system, do not attempt to remove a mount point.
+fts' FTS_XDEV ensures that we don't process any entries under
+the mount point.  */
+  if (ent->fts_info == FTS_DP
+ && x->one_file_system
+ && FTS_ROOTLEVEL < ent->fts_level
+ && ent->fts_statp->st_ino != fts->fts_dev)
+   {
+ mark_parent_dirs (ent);
+ error (0, 0, _("skipping %s, since it's on a different device"),
+quote (ent->fts_path));
+ return RM_ERROR;
+   }
+
   bool is_dir = ent->fts_info == FTS_DP || ent->fts_info == FTS_DNR;
   s = prompt (fts, ent, is_dir, x, PA_REMOVE_DIR, NULL);
   if (s != RM_OK)
--
1.6.4.357.gfd68c

> more importantly, dd appears to be stuck trying to write to a fifo that never
> gets filled because stdbuf isn't working).  I had to kill two different dd
> processes to get the testsuite to resume.
>
> Another suspicious failure:
>
> tests/misc/test-pwd.log
> /home/eblake/coreutils/src/pwd.exe: error while loading shared libraries: ?:
> cannot open shared object file: No such file or directory
> pwd-long:  does not contain old CWD
>
> It looks like the test removes PATH from the environment; but this has the
> unfortunate side effect of crippling cygwin, which requires both /bin and
> Windows directories to be in PATH at all times for .dlls to be found and 
> usable
> in running an executable, even when you don't otherwise use the PATH for the
> programs that you are invoking.  In other words, you should be doing something
> similar to 'command −p getconf PATH' to determine the bare minimum PATH rather
> than nuking it altogether; unfortunately, command -p getconf PATH is probably
> not portable.

If you'd like to write a cygwin-specific patch, to work around
that, or even to skip the test, that'd be fine.
No pressure, of course.




Re: no feedback on snapshot? coreutils-7.5 coming soon

2009-08-14 Thread Eric Blake
Eric Blake  byu.net> writes:

> > The test is still running.

The final list of failures on cygwin 1.7 (I'll need to investigate further, and 
still want to rerun this under pristine conditions.  I'm not even going to 
bother running this under cygwin 1.5.x):

FAIL: misc/invalid-opt
FAIL: rm/cycle
FAIL: chmod/no-x
FAIL: rm/isatty
FAIL: rm/fail-eacces
FAIL: rm/fail-eperm
FAIL: rm/inaccessible
FAIL: rm/rm1
FAIL: rm/rm2
FAIL: rm/rm3
FAIL: rm/unread2
FAIL: rm/unreadable
FAIL: chgrp/no-x
FAIL: misc/ls-misc
FAIL: misc/factor
FAIL: misc/paste
FAIL: misc/printf
FAIL: misc/pwd-long
FAIL: misc/shred-remove
FAIL: misc/sort-compress
FAIL: misc/stdbuf
FAIL: cp/existing-perm-race
FAIL: cp/fail-perm
FAIL: dd/direct
FAIL: du/inacc-dest
FAIL: du/inacc-dir
FAIL: du/no-x
FAIL: install/basic-1
FAIL: ls/stat-failed
FAIL: mkdir/p-3
FAIL: mv/hard-3
FAIL: mv/i-2
FAIL: mv/i-3
FAIL: mv/perm-1
FAIL: mv/trailing-slash
FAIL: readlink/can-e
FAIL: readlink/can-f
FAIL: readlink/can-m

All 381 tests passed


Hmm.  There appears to be some sort of bug in how parallel-tests is calculating 
success, since this claimed that all tests passed even though there are failing 
and skipped logs.  I don't know if the bug is in automake or in coreutils.

-- 
Eric Blake






Re: copyright years: mass-update every January 1

2009-08-14 Thread Joel E. Denny
On Fri, 14 Aug 2009, Jim Meyering wrote:

> > Below are some patches to implement that.
> ...
> > +2009-08-14  Joel E. Denny  
> > +
> > +   update-copyright: convert 2-digit to 4-digit years
> > +   * build-aux/update-copyright: Implement and document.
> > +   * tests/test-update-copyright.sh: Update.
> ...
> > +   update-copyright: much ado about intervals
> > +   * build-aux/update-copyright: Implement and document
> > +   UPDATE_COPYRIGHT_USE_INTERVALS to control expansion and collapse
> > +   of copyright year intervals.
> > +   Also, document UPDATE_COPYRIGHT_YEAR.
> > +   * tests/test-update-copyright.sh: Test it.
> 
> Thanks for all of that.
> Pushed.

Thanks.  Here's a patch to help those who don't want to wait until January 
to reformat.

>From 39a10be68cc3f2a46b97db97123ed0217192c917 Mon Sep 17 00:00:00 2001
From: Joel E. Denny 
Date: Fri, 14 Aug 2009 13:12:54 -0400
Subject: [PATCH] update-copyright: implement forced reformatting

* build-aux/update-copyright: Implement and document
UPDATE_COPYRIGHT_FORCE.
* tests/test-update-copyright.sh: Test it.
---
 ChangeLog  |7 +++
 build-aux/update-copyright |   40 ++--
 tests/test-update-copyright.sh |   22 +++---
 3 files changed, 44 insertions(+), 25 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3c0089b..eaa5549 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-08-14  Joel E. Denny  
+
+   update-copyright: implement forced reformatting
+   * build-aux/update-copyright: Implement and document
+   UPDATE_COPYRIGHT_FORCE.
+   * tests/test-update-copyright.sh: Test it.
+
 2009-08-14  Eric Blake  
and Bruno Haible  
 
diff --git a/build-aux/update-copyright b/build-aux/update-copyright
index d8445fe..bd0dda5 100755
--- a/build-aux/update-copyright
+++ b/build-aux/update-copyright
@@ -1,7 +1,7 @@
 #!/usr/bin/perl -0777 -pi
 # Update an FSF copyright year list to include the current year.
 
-my $VERSION = '2009-08-14.05:03'; # UTC
+my $VERSION = '2009-08-14.18:56'; # UTC
 
 # Copyright (C) 2009 Free Software Foundation, Inc.
 #
@@ -25,12 +25,17 @@ my $VERSION = '2009-08-14.05:03'; # UTC
 # use the update-copyright target rule in maint.mk from gnulib's
 # maintainer-makefile module.
 #
-# Iff an FSF copyright statement is discovered in a file and the final
+# Iff an FSF copyright statement is recognized in a file and the final
 # year is not the current year, then the statement is updated for the
-# new year, 2-digit years are converted to 4-digit years by prepending
-# "19", and the statement is reformatted to fit within 72 columns.  A
-# warning is printed for every file for which no FSF copyright statement
-# is discovered.
+# new year and it is reformatted to:
+#
+#   1. Fit within 72 columns.
+#   2. Convert 2-digit years to 4-digit years by prepending "19".
+#   3. Expand copyright year intervals.  (See "Environment variables"
+#  below.)
+#
+# A warning is printed for every file for which no FSF copyright
+# statement is recognized.
 #
 # Each file's FSF copyright statement must be formated correctly in
 # order to be recognized.  For example, each of these is fine:
@@ -91,16 +96,21 @@ my $VERSION = '2009-08-14.05:03'; # UTC
 #   6. Blank lines, even if preceded by the prefix, do not appear
 #  within the FSF copyright statement.
 #   7. Each copyright year is 2 or 4 digits, and years are separated by
-#  commas or dashes.  Whitespace may occur after commas.
+#  commas or dashes.  Whitespace may appear after commas.
 #
 # Environment variables:
 #
-#   1. If UPDATE_COPYRIGHT_USE_INTERVALS=1, every series of consecutive
-#  copyright years (such as 90, 1991, 1992-2007, 2008) in an updated
-#  FSF copyright statement is collapsed to a single interval (such
-#  as 1990-2008).  If unset or set to 0, all existing copyright year
-#  intervals are expanded.
-#   2. For testing purposes, you can set the assumed current year in
+#   1. If UPDATE_COPYRIGHT_FORCE=1, a recognized FSF copyright statement
+#  is reformatted even if it does not need updating for the new
+#  year.  If unset or set to 0, only updated FSF copyright
+#  statements are reformatted.
+#   2. If UPDATE_COPYRIGHT_USE_INTERVALS=1, every series of consecutive
+#  copyright years (such as 90, 1991, 1992-2007, 2008) in a
+#  reformatted FSF copyright statement is collapsed to a single
+#  interval (such as 1990-2008).  If unset or set to 0, all existing
+#  copyright year intervals in a reformatted FSF copyright statement
+#  are expanded instead.
+#   3. For testing purposes, you can set the assumed current year in
 #  UPDATE_COPYRIGHT_YEAR.
 
 use strict;
@@ -172,7 +182,9 @@ if (defined $stmt_re)
   {
 # Update the year.
 $stmt =~ s/$final_year_orig/$final_year, $this_year/;
-
+  }
+if ($final_year != $this_year || $ENV{'UPDATE_COPYRIGHT_FORCE'})
+  {
 # Normali

Re: copyright years: mass-update every January 1

2009-08-14 Thread Jim Meyering
Joel E. Denny wrote:
> On Fri, 14 Aug 2009, Jim Meyering wrote:
>> > Below are some patches to implement that.
>> ...
>> > +2009-08-14  Joel E. Denny  
>> > +
>> > +  update-copyright: convert 2-digit to 4-digit years
>> > +  * build-aux/update-copyright: Implement and document.
>> > +  * tests/test-update-copyright.sh: Update.
>> ...
>> > +  update-copyright: much ado about intervals
>> > +  * build-aux/update-copyright: Implement and document
>> > +  UPDATE_COPYRIGHT_USE_INTERVALS to control expansion and collapse
>> > +  of copyright year intervals.
>> > +  Also, document UPDATE_COPYRIGHT_YEAR.
>> > +  * tests/test-update-copyright.sh: Test it.
>>
>> Thanks for all of that.
>> Pushed.
>
> Thanks.  Here's a patch to help those who don't want to wait until January
> to reformat.

Heh ;-)

Good addition.  Pushed.




Re: copyright years: mass-update every January 1

2009-08-14 Thread Joel E. Denny
On Fri, 14 Aug 2009, Jim Meyering wrote:

> > Thanks.  Here's a patch to help those who don't want to wait until January
> > to reformat.
> 
> Heh ;-)

I'm not sure you're excited enough.  :-)

> Good addition.  Pushed.

Thanks.

I just realized I don't know how to configure update-copyright permanently 
for a project.  The following patch gives me a way.

>From cf17e05d931eb3e7d995650eb01c354533c61886 Mon Sep 17 00:00:00 2001
From: Joel E. Denny 
Date: Fri, 14 Aug 2009 15:26:20 -0400
Subject: [PATCH] maint.mk: support update-copyright-env

* top/maint.mk (update-copyright-env): Define place-holder.
(update-copyright): Expand $(update-copyright-env) before
invoking update-copyright.
---
 ChangeLog|7 +++
 top/maint.mk |6 +-
 2 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index eaa5549..10490eb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2009-08-14  Joel E. Denny  
 
+   maint.mk: support update-copyright-env
+   * top/maint.mk (update-copyright-env): Define place-holder.
+   (update-copyright): Expand $(update-copyright-env) before
+   invoking update-copyright.
+
+2009-08-14  Joel E. Denny  
+
update-copyright: implement forced reformatting
* build-aux/update-copyright: Implement and document
UPDATE_COPYRIGHT_FORCE.
diff --git a/top/maint.mk b/top/maint.mk
index a4ce064..5d7c45e 100644
--- a/top/maint.mk
+++ b/top/maint.mk
@@ -776,6 +776,10 @@ indent:
 # define it in cfg.mk and set this variable to its name.
 update-copyright-local ?=
 
+# If you want to set UPDATE_COPYRIGHT_* environment variables,
+# put the assignments in this variable.
+update-copyright-env ?=
+
 # Run this rule once per year (usually early in January)
 # to update all FSF copyright year lists in your project.
 update-copyright-exclude-regexp ?= (^|/)COPYING$$
@@ -783,4 +787,4 @@ update-copyright-exclude-regexp ?= (^|/)COPYING$$
 update-copyright: $(update-copyright-local)
grep -l -w Copyright $$($(VC_LIST_EXCEPT))  \
  | grep -v -E '$(update-copyright-exclude-regexp)' \
- | xargs $(build_aux)/$@
+ | $(update-copyright-env) xargs $(build_aux)/$@
-- 
1.5.4.3





Re: copyright years: mass-update every January 1

2009-08-14 Thread Jim Meyering
Joel E. Denny wrote:
> I just realized I don't know how to configure update-copyright permanently
> for a project.  The following patch gives me a way.

Pushed.  I'll certainly be using that.




Linus' sha1 is much faster!

2009-08-14 Thread Pádraig Brady
I've noticed before that coreutils hashing utils
were a little behind in performance, but was prompted
to look at it again when I noticed the recently
updated sha1 implementation in git:
http://git.kernel.org/?p=git/git.git;a=history;f=block-sha1;h=d3121f7;hb=pu

Testing that with the attached program which I wrote
in a couple of mins to try and match sha1sum's system calls
shows that it's around 33% faster, as shown below:

$ gcc $(rpm -q --qf="%{OPTFLAGS}\n" coreutils) linus-sha1.c sha1.c -o linus-sha1

$ time ./linus-sha1 300MB_file
df1e19e245fee4f53087b50ef953ca2c8d1644d7  300MB_file
real0m2.742s
user0m2.516s
sys 0m0.206s

$ time ~/git/coreutils/src/sha1sum 300MB_file
df1e19e245fee4f53087b50ef953ca2c8d1644d7  300MB_file

real0m4.166s
user0m3.846s
sys 0m0.298s

So, could we use that code in coreutils?
Think of all the dead fish it would save.

I've also attached a trivial block-sha1 patch which doesn't
affect performance, but does suppress a signed unsigned
comparison warning which occurs with -Wextra for example.

cheers,
Pádraig.
/* gcc -O2 -Wall linus-sha1.c sha1.c -o linus-sha1 */
#include 
#include 
#include "sha1.h"

int main(int argc, char** argv)
{
if (argc != 2) return 1;
const char* filename = argv[1];
FILE *fp = fopen (filename, "r");
if (!fp) return 1;

#define BS 4096 /* match coreutils */

blk_SHA_CTX ctx;
blk_SHA1_Init(&ctx);
size_t nr;
char buf[BS];
while ((nr=fread_unlocked(buf, 1, sizeof(buf), fp)))
blk_SHA1_Update(&ctx, buf, nr);
unsigned char hash[20];
blk_SHA1_Final(hash, &ctx);
int i;
for (i=0; i>From fa75e818836f763357ff9b7bbde3327e1aabbe47 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?P=C3=A1draig=20Brady?= 
Date: Sat, 15 Aug 2009 00:17:30 +0100
Subject: [PATCH] block-sha1: suppress signed unsigned comparison warning

* block-sha1/sha1.c: Use unsigned ints as the values
will never go negative.
---
 block-sha1/sha1.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/block-sha1/sha1.c b/block-sha1/sha1.c
index d3121f7..be763d8 100644
--- a/block-sha1/sha1.c
+++ b/block-sha1/sha1.c
@@ -231,13 +231,13 @@ void blk_SHA1_Init(blk_SHA_CTX *ctx)
 
 void blk_SHA1_Update(blk_SHA_CTX *ctx, const void *data, unsigned long len)
 {
-	int lenW = ctx->size & 63;
+	unsigned int lenW = ctx->size & 63;
 
 	ctx->size += len;
 
 	/* Read the data into W and process blocks as they get full */
 	if (lenW) {
-		int left = 64 - lenW;
+		unsigned int left = 64 - lenW;
 		if (len < left)
 			left = len;
 		memcpy(lenW + (char *)ctx->W, data, left);
-- 
1.6.2.5