[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#794583: ocaml: Allow setting arbitrary RNG seed in ocamlopt



Le 04/08/2015 18:41, Valentin Lorentz a écrit :
> While working on the “reproducible builds” effort [1], we have noticed
> that ocamlopt relies on temporary files whose names are generated
> randomly and are part of the output files' symbols.

ocamlc relies on temporary files as well. In general, whatever is done
for ocamlopt should be done for ocamlc as well.

> Therefore, we need a way to make these names determinist. For instance,
> reading an environment variable in the main function of ocamlopt
> (driver/optmain.ml) and calling “Random.seed 0” if it is set would be
> perfect.
> Using OCAMLPARAM (driver/compenv.ml) would work as well.

The generation of temporary file names uses its own RNG (cf.
stdlib/filename.ml), that would be the place to change its initialization.

I am a bit worried to have predictable names for files that end up in
/tmp, though. For building packages, it should be fine I guess. I have
to think more about it.

Cheers,

-- 
Stéphane


Reply to: