Add shuf, better random number generation, and fix sort -R in
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 8 Aug 2006 22:28:00 +0000 (22:28 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 8 Aug 2006 22:28:00 +0000 (22:28 +0000)
funny locales.

ChangeLog
doc/ChangeLog
lib/ChangeLog
m4/ChangeLog

index f3ce490..c191e6b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,48 @@
+2006-08-08  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Add a command 'shuf', and modify shred and sort to use the new
+       random number generator library of 'shuf'.
+
+       * AUTHORS: Add shuf.
+       * README: Likewise.
+       * NEWS: Likewise.  Mention new --random-source option for shred
+       and sort.  Move "sort +1 -2" notice to the appropriate section,
+       and clarify its role with respect to POSIXLY_CORRECT.
+       * man/.cvsignore: Add shuf.1.
+       * man/Makefile.am (dist_man_MANS): Add shuf.1.
+       (shuf.1): New dependency.
+       * man/shuf.x: New file.
+       * src/Makefile.am (bin_PROGRAMS): Add shuf.
+       (EXTRA_DIST): Remove rand-isaac.c.
+       (shuf_LDADD): New macro.
+       * src/rand-isaac.c: Remove, moving most of its contents to
+       lib/rand-isaac.c.
+       * src/shuf.c: New file.
+       * src/shred.c: Use new random-number interface rather than rand-isaac.c.
+       Don't include rand-isaac.c; include randint.h and randread.h instead.
+       (RANDOM_SOURCE_OPTION): New enum.
+       (long_opts, usage, main): New option --random-source.
+       * src/sort.c: Likewise.
+       * src/shred.c (struct irand_state, irand_init, irand32, irand_mod): Remove.
+       All callers changed to use randint interface.
+       (fillrand): Remove.  All callers changed to use randread interface.
+       (dopass): Remove dependency on ISAAC buffer size.
+       (genpattern): Don't wipe the random state here.
+       (randint_source): New static var.
+       (clear_random_data): New function.
+       (main): Allocate random source, and arrange to wipe it on exit.
+       * src/sort.c: Include md5.h, randread.h, xmemxfrm.h.
+       (longopts, usage, main): Remove undocumented --seed option;
+       it's now replaced by --random-source.
+       (rand_state, get_hash): Remove.
+       (randread_source): New static var.
+       (random_state, cmp_hashes, compare_random): New functions; they guarantee
+       no collisions in the random hash function.
+       (keycompare): Use compare_random for -R; don't fall back on comparing
+       via memcoll, since compare_random does the right thing.
+       * tests/misc/Makefile.am (TESTS): Add shuf.
+       * tests/misc/shuf: New file.
+
 2006-07-29  Paul Eggert  <eggert@cs.ucla.edu>
 
        * src/copy.c (set_author): Preserve the st_author field via the
index 7ed09fb..3f0f26a 100644 (file)
@@ -1,3 +1,10 @@
+2006-08-08  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * coreutils.texi (shuf invocation, Random sources): New sections.
+       (Operating on sorted files): Add shuf.
+       (sort invocation, shred invocation): New option --random-source.
+       (sort invocation): Fix typo: -R -> -r.
+
 2006-07-28  Paul Eggert  <eggert@cs.ucla.edu>
 
        * coreutils.texi (install invocation, mkdir invocation):
index f9a59d8..62d1ee3 100644 (file)
@@ -1,3 +1,11 @@
+2006-08-08  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * Makefile.am (libcoreutils_a_SOURCES): Add xmemxfrm.c, xmemxfrm.h.
+       * memxfrm.c, memxfrm.h, randint.c, randint.h, randperm.c, randperm.h: New files.
+       * randread.c, randread.h, xmemxfrm.c, xmemxfrm.h: New files.
+       * rand-isaac.h: New file.
+       * rand-isaac.c: New file, mostly taken from ../src/rand-isaac.c.
+
 2006-07-28  Paul Eggert  <eggert@cs.ucla.edu>
 
        * modechange.c (mode_compile): Numeric modes now affect setuid and
index 12f84d0..97c9666 100644 (file)
@@ -1,3 +1,21 @@
+2006-08-08  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * memxfrm.m4, randint.m4, randperm.m4, randread.m4: New files.
+
+       * prereq.m4 (gl_PREREQ): Require gl_MEMXFRM, gl_RANDINT, gl_RANDPERM,
+       gl_RANDREAD.
+
+       * restrict.m4: Remove, since we no longer need gl_RESTRICT.
+       * getaddrinfo.m4 (gl_PREREQ_GETADDRINFO): Use AC_C_RESTRICT, not
+       gl_C_RESTRICT, since we assume recent Autoconf.
+       * regex.m4 (gl_PREREQ_REGEX): Likewise.
+       * time_r.m4 (gl_TIME_R): Likewise.
+
+2006-08-06  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * restrict.m4: Remove, now that we assume Autoconf 2.58 or later.
+       All uses of gl_C_RESTRICT changed to AC_C_RESTRICT.
+
 2006-07-22  Paul Eggert  <eggert@cs.ucla.edu>
 
        * close-stream.m4: New file.