[Bug 804355] Re: jot random number generator broken in batch jobs
James Page
james.page at ubuntu.com
Fri Mar 16 12:13:24 UTC 2012
Thanks for taking the time to prepare this patch.
Some feedback on the update:
1) debian/changelog
athena-jot (9.0-5yandex0) oneiric; urgency=low
a) oneiric development has close since its now been released - your fix
needs to target precise.
b) 9.0-5yandex0 works but is not inline with the way the version should
be incremented - 9.0-5ubuntu1 would be appropriate.
* Use arc4random number generation instead of time based
You should add (LP: #804355) to the changelog entry - that way this bug
would be closed when the package is accepted into the archive.
2) patching
This is quite an older package and pre-dates some of the newer package
format options; it would be nice to switch this package over to
source/format 3.0 and provide the fixes as a patch rather than changing
the upstream source code directly.
See http://wiki.debian.org/Projects/DebSrc3.0
Thanks for you work so far!
Cheers
James
--
You received this bug notification because you are a member of Ubuntu
Sponsors Team, which is subscribed to the bug report.
https://bugs.launchpad.net/bugs/804355
Title:
jot random number generator broken in batch jobs
Status in “athena-jot” package in Ubuntu:
New
Bug description:
jot -r generates same random numbers within one second time so it's
unusable in batch jobs like shell scripts.
There is code for initializing "random" seed:
s = (randomize ? time(0) : STEP_DEF);
/*... snip ....*/
srand((int) s);
Here is an example of this behavior:
rbtz at rbtz-desktop:~$ date +%s; jot -r 1 0 10000000
1309455778
9981995
rbtz at rbtz-desktop:~$ date +%s; jot -r 1 0 10000000
1309455779
2355993
rbtz at rbtz-desktop:~$ date +%s; jot -r 1 0 10000000
1309455779
2355993
rbtz at rbtz-desktop:~$ date +%s; jot -r 1 0 10000000
1309455779
2355993
rbtz at rbtz-desktop:~$ date +%s; jot -r 1 0 10000000
1309455780
3745306
rbtz at rbtz-desktop:~$ date +%s; jot -r 1 0 10000000
1309455780
3745306
As fast fix pid can be added to seed
srandom((int) s ^ (getpid()<<4));
As good fix arc4random or similar mechanism can be used.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/athena-jot/+bug/804355/+subscriptions
More information about the Ubuntu-sponsors
mailing list