r-lib / pkgbuild

Find tools needed to build R packages
https://pkgbuild.r-lib.org
Other
66 stars 35 forks source link

compile_dll() sets the .Random.seed #185

Closed MichaelChirico closed 7 months ago

MichaelChirico commented 7 months ago

Copied from https://github.com/r-lib/pkgload/issues/272

In R --vanilla

ls(all=TRUE)
# character(0)

# any (?) package with src/ code, I've tried roxygen2, Rcpp, and data.table
#   but _not_ on lint, which doesn't have src/ code
pkgload::load_all()

ls(all=TRUE)
# [1] ".Random.seed"

Is that intended/unavoidable behavior? It may harm reproducibility. OTOH, I can't think of a place where this causes an issue, it's just something I noticed when tinkering around on another problem. So don't feel obligated to devote too much effort to this.

MichaelChirico commented 7 months ago

Traced down to how {processx} behaves and filed an issue there:

https://github.com/r-lib/processx/issues/386

Given the root cause, it may be up to {pkgbuild} to decide whether this behavior is working as intended & possibly document it, or else be careful to restore state on exit.

MichaelChirico commented 7 months ago

downstream fixed, nothing to do here