After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 738231 - libxml2 calls srand(time(0))
libxml2 calls srand(time(0))
Status: RESOLVED NOTABUG
Product: libxml2
Classification: Platform
Component: general
git master
Other All
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2014-10-09 13:28 UTC by Albert Zeyer
Modified: 2014-10-09 15:17 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Albert Zeyer 2014-10-09 13:28:17 UTC
It does that on the first xmlDictCreate() call.

That will of course overwrite my own random seed, which I have set earlier via srand(). It was kind of annoying to debug a bigger framework, to find out why the random seed init did not seem to work anymore on a new Ubuntu version.

I think that libxml2 should not call srand() at all and it should leave the random seed initialization to the user.
Comment 1 Daniel Veillard 2014-10-09 15:17:20 UTC
That was set for security reasons. Initialize libxml2 first then.
That's a perfectly legal call to be made from a library. You should
not expect that nobody else calls srand(), and the man page nowhere
states that using srand multiple tim should be avoided,

  sorry, but no it's needed

Daniel