Skip to content

Commit 2362ab2

Browse files
committed
Document why the stored options carry no user header
The resolver strips both header spellings from cpp_options and only $compile() reinserts the selected one, so precompile_cpp_options_ never carries a header. That is deliberate but not self-evident: storing it there would store a WSL-safe path, which the next $compile() would then select as its user_header, and that is a host path by design because file.exists() on a WSL-safe path fails under WSLv1. Also records in NEWS that a dry run no longer sets $cpp_options(), alongside the existing note about $hpp_file().
1 parent e780856 commit 2362ab2

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

NEWS.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ pre-compiled Stan model" on a model that had compiled itself. (#1235)
5858
* A failed compilation no longer moves `$exe_file()` or replaces the generated
5959
C++ used by `$hpp_file()` and `fit$init_model_methods()`. Previously a failure
6060
at the C++ stage left the old executable paired with model methods generated
61-
from the new program. A `dry_run = TRUE` compilation likewise no longer moves
62-
`$hpp_file()`, which previously pointed at a temporary file it never wrote.
63-
(#1235)
61+
from the new program. A `dry_run = TRUE` compilation likewise no longer records
62+
`$cpp_options()` or moves `$hpp_file()`, which previously pointed at a temporary
63+
file it never wrote. (#1235)
6464
* `$compile()` now errors if the newly compiled executable cannot be installed,
6565
restoring the previous executable. Previously the replacement was unchecked, so
6666
a failure could silently leave the model with no executable at all. (#1235)

R/model.R

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,12 @@ CmdStanModel <- R6::R6Class(
282282
# once; warning here as well would double up.
283283
warn_user_header_conflict(resolved_header$conflict)
284284
}
285+
# Deliberately without the header: the resolver strips both spellings
286+
# and only $compile() reinserts the selected one. Storing it here would
287+
# mean storing a WSL-safe path, which the next $compile() would pick up
288+
# as its host-path `user_header` and fail to find on WSLv1 -- the hazard
289+
# the comment at the resolver call in $compile() describes. user_header_
290+
# below is the single source instead.
285291
private$precompile_cpp_options_ <- resolved_header$cpp_options
286292
# Prepopulating this also keeps the first $compile() from seeing a
287293
# change of header and rebuilding an already-current executable.

0 commit comments

Comments
 (0)