Bizarre behavior of stanc_builder with include files
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 1.1k
- Forks
- 266
- Avg merge
- 2h 56m
- Merged PRs (30d)
- 1
Description
Summary:
If I #include ssm.stan and the isystem path does not exist, stanc_builder hangs indefinitely using up 100% CPU.
Description:
If I run
stanc_builder("foo.stan", isystem="/nonexistent/path/")
then, instead of getting an error, stanc_builder hangs indefinitely using 100% CPU.
Here is the file foo.stan, renamed so that github will let me upload it:
foo.stan.txt
Now for the bizarre part: If I change the line
#include ssm.stan
in foo.stan to use any other file name, I get the expected error message instead of it hanging.
This problem does not occur with stanc, but instead I get a different problem: even if the include path is correct and the include file exists, I get the error message
could not find include file: #include ssm.stan
Error in stanc("foo.stan", isystem = "/nonexistent/path/") :
failed to parse Stan model 'foo' due to the above error.
I get this error regardless of the name of the include file.
(BTW, I can find nothing in the documentation page for stanc/stanc_builder that tells me how these two functions differ, other than having different defaults, and stanc having some additional possibilities for specifying the model code.)
RStan Version:
2.17.3
R Version:
R version 3.4.3 (2017-11-30)
Operating System:
Mac OS X 10.13.3
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the report with foo.stan, the #include ssm.stan line, and stanc_builder("foo.stan", isystem="/nonexistent/path/"); compare it with stanc and with another include filename. Trace include-path handling from the stanc_builder and stanc entry points, then verify that missing paths produce an error without hanging and that valid include paths still work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100