ls now aligns output correctly in the presence of abbreviated month
names from the locale database that have differing widths.
+** Changes in behavior
+
+ shred, sort, shuf: now use an internal pseudorandom generator by default.
+ This is mainly noticable in shred where the 3 random passes it does by
+ default should proceed at the speed of the disk. Previously /dev/urandom
+ was used if available, which is relatively slow on GNU/Linux systems.
+
* Noteworthy changes in release 7.2 (2009-03-31) [stable]
** New features
Steve Ward planet36@gmail.com
Steven G. Johnson stevenj@alum.mit.edu
Steven Mocking ufo@quicknet.nl
+Steven Schveighoffer schveiguy@yahoo.com
Steven P Watson steven@magelico.net
Stuart Kemp skemp@peter.bmc.com
Stuart Shelton stuart@shelton.me
-R} must choose a hash function at random, and it needs random data to
make this selection.
-Normally these commands use the device file @file{/dev/urandom} as the
+By default these commands use an internal pseudorandom generator
+initialized by a small amount of entropy, but can be directed to use
+an external source with the @option{--random-source=@var{file}} option.
+An error is reported if @var{file} does not contain enough bytes.
+
+For example, the device file @file{/dev/urandom} could be used as the
source of random data. Typically, this device gathers environmental
noise from device drivers and other sources into an entropy pool, and
uses the pool to generate random bits. If the pool is short of data,
the device reuses the internal pool to produce more bits, using a
-cryptographically secure pseudorandom number generator.
+cryptographically secure pseudorandom number generator. But be aware
+that this device is not designed for bulk random data generation
+and is relatively slow.
@file{/dev/urandom} suffices for most practical uses, but applications
requiring high-value or long-term protection of private data may
@file{/dev/arandom}. The set of available sources depends on your
operating system.
-To use such a source, specify the @option{--random-source=@var{file}}
-option, e.g., @samp{shuf --random-source=/dev/random}. The contents
-of @var{file} should be as random as possible. An error is reported
-if @var{file} does not contain enough bytes to randomize the input
-adequately.
-
To reproduce the results of an earlier invocation of a command, you
can save some random data into a file and then use that file as the
random source in earlier and later invocations of the command.
-Some old-fashioned or stripped-down operating systems lack support for
-@command{/dev/urandom}. On these systems commands like @command{shuf}
-by default fall back on an internal pseudorandom generator initialized
-by a small amount of entropy.
-
@node Target directory
@section Target directory
# define ALIGNED_POINTER(ptr, type) ((size_t) (ptr) % alignof (type) == 0)
#endif
-#ifndef DEFAULT_RANDOM_FILE
-# define DEFAULT_RANDOM_FILE "/dev/urandom"
-#endif
-
/* The maximum buffer size used for reads of random data. Using the
value 2 * ISAAC_BYTES makes this the largest power of two that
would not otherwise cause struct randread_source to grow. */
/* A source of random data for generating random buffers. */
struct randread_source
{
- /* Stream to read random bytes from. If null, the behavior is
- undefined; the current implementation uses ISAAC in this case,
- but this is for old-fashioned implementations that lack
- /dev/urandom and callers should not rely on this. */
+ /* Stream to read random bytes from. If null, the current
+ implementation uses an internal PRNG (ISAAC). */
FILE *source;
/* Function to call, and its argument, if there is an input error or
return simple_new (NULL, NULL);
else
{
- char const *file_name = (name ? name : DEFAULT_RANDOM_FILE);
- FILE *source = fopen_safer (file_name, "rb");
+ FILE *source = NULL;
struct randread_source *s;
- if (! source)
- {
- if (name)
- return NULL;
- file_name = NULL;
- }
+ if (name)
+ if (! (source = fopen_safer (name, "rb")))
+ return NULL;
- s = simple_new (source, file_name);
+ s = simple_new (source, name);
if (source)
setvbuf (source, s->buf.c, _IOFBF, MIN (sizeof s->buf.c, bytes_bound));
printf (_("\
-f, --force change permissions to allow writing if necessary\n\
-n, --iterations=N overwrite N times instead of the default (%d)\n\
- --random-source=FILE get random bytes from FILE (default /dev/urandom)\n\
+ --random-source=FILE get random bytes from FILE\n\
-s, --size=N shred this many bytes (suffixes like K, M, G accepted)\n\
"), DEFAULT_PASSES);
fputs (_("\
-i, --input-range=LO-HI treat each number LO through HI as an input line\n\
-n, --head-count=COUNT output at most COUNT lines\n\
-o, --output=FILE write result to FILE instead of standard output\n\
- --random-source=FILE get random bytes from FILE (default /dev/urandom)\n\
+ --random-source=FILE get random bytes from FILE\n\
-z, --zero-terminated end lines with 0 byte, not newline\n\
"), stdout);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (_("\
-n, --numeric-sort compare according to string numerical value\n\
-R, --random-sort sort by random hash of keys\n\
- --random-source=FILE get random bytes from FILE (default /dev/urandom)\n\
+ --random-source=FILE get random bytes from FILE\n\
-r, --reverse reverse the result of comparisons\n\
"), stdout);
fputs (_("\