Pádraig Brady wrote:
> Pádraig Brady wrote:
>> So in summary I would do:
>>
>> 1. by default always use internal PRNG seeded with getpid()
>> 2. if --random-source specified read all random data from there
>>
>> Note 2 will allow one to specify /dev/zero if desired.
>> We could seed our PRNG with /dev/urandom if available, but
>> that complication is not necessary I think for this problem.
>
> Simple patch attached to do as above.
> Note I've left `sort -R` and `shuf` reading /dev/urandom as before.
>
> This shows the speedup on my system with default options:
>
> $ shred -v -n3 t
> shred: t: pass 1/3 (random)...
> shred: t: pass 1/3 (random)...8.3MiB/1000MiB 0%
> shred: t: pass 1/3 (random)...17MiB/1000MiB 1%
> shred: t: pass 1/3 (random)...32MiB/1000MiB 3%
> ...
>
> $ time ./shred -v t
> ./shred: t: pass 1/3 (random)...
> ./shred: t: pass 1/3 (random)...116MiB/1000MiB 11%
> ./shred: t: pass 1/3 (random)...216MiB/1000MiB 21%
> ./shred: t: pass 1/3 (random)...340MiB/1000MiB 34%
> ...
>
> cheers,
> Pádraig.
>>From 005277ea7c645ae2bc1d0e88b1681b55c44348af Mon Sep 17 00:00:00 2001
> From: =?utf-8?q?P=C3=A1draig=20Brady?= <[email protected]>
> Date: Mon, 6 Apr 2009 08:42:15 +0100
> Subject: [PATCH] shred: speed up random passes by not using /dev/urandom

Thanks for doing that.
At first glance, you got it all.
Except maybe the texinfo documentation...
Yep.  There's a mention of shred in the "Random sources" section.
So now we'd have to say how shred's --random-source works
and that its default is different from those of shuf and sort...

Have you considered keeping the semantics of --random-source
the same for all three programs?

Things that ease the documentation burden by keeping inter-tool
differences to a minimum are usually also good from usability
and maintainability perspectives.


_______________________________________________
Bug-coreutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to