Fix include paths with spaces and resolve them at model creation - #1226
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1226 +/- ##
==========================================
+ Coverage 91.88% 91.92% +0.04%
==========================================
Files 15 15
Lines 6244 6267 +23
==========================================
+ Hits 5737 5761 +24
+ Misses 507 506 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The expected value comes from withr::local_tempdir(), which uses backslashes on Windows and can contain a doubled slash on macOS, while $include_paths() comes from dirname(). Repair both sides before comparing.
Include paths were stored exactly as supplied and resolved to absolute paths
only when stanc was called, so resolution depended on the working directory at
that later point. A model created from a relative stan_file stored "." as its
inferred include path, and assert_dir_exists(".") can never fail, so a change
of working directory either produced a confusing stanc error or silently
resolved #include directives against a same-named file in the new directory.
Paths are now resolved where they are stored, using a shared resolve_path()
helper that also replaces the equivalent inline expressions for stan_file_ and
exe_file_. $include_paths() returns absolute paths.
The existing tests cover an inferred relative path and explicit paths that are already absolute, so the explicit and $compile() resolution points had no test that would fail if their paths were left unresolved.
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Submission Checklist
Summary
Fixes #820: include directories containing spaces
Fixes #1229: Paths are now resolved where they are stored, via a shared
resolve_path()helper that is also used forstan_file_andexe_file_, which were already stored absolute.Copyright and Licensing
Please list the copyright holder for the work you are submitting
(this will be you or your assignee, such as a university or company):
Jonah Gabry
By submitting this pull request, the copyright holder is agreeing to
license the submitted work under the following licenses: