Random number generator is not seeded, leading to known paths

Bug #1297690 reported by Adam Collard
This bug affects 3 people
Affects Status Importance Assigned to Milestone

Bug Description

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

We can see here


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