Random number generator is not seeded, leading to known paths

Bug #1297690 reported by Adam Collard
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
gocheck
New
Undecided
Unassigned

Bug Description

gocheck uses temporary directories to run tests in, but these temporary directories are made with known, predictable names.

We can see here

http://bazaar.launchpad.net/~niemeyer/gocheck/trunk/view/head:/gocheck.go#L125

that newPath uses rand.Int() without first seeding the RNG. Meaning I'll always have tests run in /tmp/gocheck-5577006791947779410.

I don't think cryptographically secure random numbers are needed so something as simple as rand.Seed(time.Nanoseconds()) would probably do the job.

Tags: landscape
tags: added: landscape
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Our CI is hitting this more frequently. We get directory name collisions in /tmp.

Revision history for this message
Adam Collard (adam-collard) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers