From: Paul Eggert Date: Tue, 8 Aug 2006 22:28:00 +0000 (+0000) Subject: Add shuf, better random number generation, and fix sort -R in X-Git-Tag: COREUTILS-6_0~55 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dc640594264aca6329f473557acd6e0cada46e1b;p=platform%2Fupstream%2Fcoreutils.git Add shuf, better random number generation, and fix sort -R in funny locales. --- diff --git a/ChangeLog b/ChangeLog index f3ce490..c191e6b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,48 @@ +2006-08-08 Paul Eggert + + 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 * src/copy.c (set_author): Preserve the st_author field via the diff --git a/doc/ChangeLog b/doc/ChangeLog index 7ed09fb..3f0f26a 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,10 @@ +2006-08-08 Paul Eggert + + * 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 * coreutils.texi (install invocation, mkdir invocation): diff --git a/lib/ChangeLog b/lib/ChangeLog index f9a59d8..62d1ee3 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,11 @@ +2006-08-08 Paul Eggert + + * 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 * modechange.c (mode_compile): Numeric modes now affect setuid and diff --git a/m4/ChangeLog b/m4/ChangeLog index 12f84d0..97c9666 100644 --- a/m4/ChangeLog +++ b/m4/ChangeLog @@ -1,3 +1,21 @@ +2006-08-08 Paul Eggert + + * 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 + + * 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 * close-stream.m4: New file.