A path containing a single quote, e.g. Jonah's includes, results in messed up shell syntax. Affects include_paths_stanc3_args(), not direct stanc calls since those pass the paths unquoted.
d <- file.path(tempdir(), "Jonah's includes")
dir.create(d)
cmdstan_model("model.stan", include_paths = d)
Additional context
When I asked Claude about this bug after I ran into it, it made these extra comments, which seem relevant.
Two things a fix needs to handle:
shQuote() on the comma-separated value fixes the shell layer only. The value is
passed as STANCFLAGS += ... and expanded by Make first, so a path containing $
breaks before any shell sees it.
- On Windows the Make shell is conditional —
SHELL = sh.exe is set only when sh
is on PATH — so shQuote() would need an explicit type = "sh" rather than R's
platform default.
For the space-only case shQuote(type = "sh") produces exactly the current output,
so the common path is unchanged by such a fix.
A path containing a single quote, e.g.
Jonah's includes, results in messed up shell syntax. Affectsinclude_paths_stanc3_args(), not direct stanc calls since those pass the paths unquoted.Additional context
When I asked Claude about this bug after I ran into it, it made these extra comments, which seem relevant.
Two things a fix needs to handle:
shQuote()on the comma-separated value fixes the shell layer only. The value ispassed as
STANCFLAGS += ...and expanded by Make first, so a path containing$breaks before any shell sees it.
SHELL = sh.exeis set only whenshis on PATH — so
shQuote()would need an explicittype = "sh"rather than R'splatform default.
For the space-only case
shQuote(type = "sh")produces exactly the current output,so the common path is unchanged by such a fix.