[Rd] Strange error in R CMD check --timings

Duncan Murdoch murdoch@dunc@n @end|ng |rom gm@||@com
Sun Jul 2 20:44:34 CEST 2023


On 02/07/2023 2:34 p.m., Sebastian Meyer wrote:
> Am 02.07.23 um 18:01 schrieb Duncan Murdoch:
>> This SO post: https://stackoverflow.com/q/76583828 describes a strange R
>> CMD check error.  Depending on the contents of a comment in one of the
>> examples sections of a help page, an error like this could be triggered:
>>
>>      > base::assign(".dptime", (proc.time() - get(".ptime", pos =
>> "CheckExEnv")), pos = "CheckExEnv")
>>      > base::cat("read_net", base::get(".format_ptime", pos =
>> 'CheckExEnv')(get(".dptime", pos = "CheckExEnv")), "\n",
>> file=base::get(".ExTimings", pos = 'CheckExEnv'), append=TRUE, sep="\t")
>>      > ### * <FOOTER>
>>      > ###
>>      > cleanEx()
>>      > options(digits = 7L)
>>      > base::cat("Time elapsed: ", proc.time() - base::g
>>      + Error: unexpected end of input
>>      Execution halted
>>
>> The code without the offending comment is available here:
>>
>>      https://github.com/rob-ward-psych/iac
>>
>> at revision c2f3529.  To add the offending comment, change line 318 of
>> R/iac_networks.R to
>>
>>      #' # Ken is a burglar in the Sharks, what is retrieved from his name
>>
>> and run roxygen on the package, so the long comment ends up in the
>> examples section of man/read_net.Rd instead of the empty comment that is
>> there on Github.
>>
>> At first it appeared to require devtools::check(), but in fact the error
>> comes from R CMD check --timings .  One thing that may be related is
>> that an earlier example had this code:
>>
>>      file.edit(iac_example("what_where.yaml"))
> 
> I could reproduce the check error on Ubuntu for some settings of EDITOR.
> 
> - For EDITOR="nano", the output below file.edit() in iac-Ex.Rout showed
> content from the first few lines of the yaml file and then
> Too many errors from stdin
> 
> - For EDITOR="vi", iac-Ex.Rout showed
> Vim: Warning: Output is not to a terminal
> Vim: Warning: Input is not from a terminal
> Press ENTER or type command to continue
> ... some content from the yaml file ...
> Vim: Error reading input, exiting...
> 
> OTOH,
> EDITOR="nonexistent" resulted in a successful check run with file.edit()
> output
> sh: 1: nonexistent: not found
> Warning: error in running command
> 
> whereas EDITOR="emacs" would open the GUI while "* checking examples
> ...", waiting for me to finish editing.
> 
> I agree that the package should conditionalize a [file.]edit() example
> on the R session being interactive(). I'm wondering, however, whether R
> CMD check should itself generally set the "editor" option to a read-only
> variant, e.g., a function that just calls file.show() with a warning
> when it runs the (massaged) examples. For related reasons, I guess, it
> already sets the "pager" option on Windows to "console". Alternatively,
> if the massaged "editor" option called stop() (similar to T and F
> producing errors), such examples would really need to be conditioned on
> interactive().

Given how variable the results are, I think the last option (calling 
file.edit() non-interactively should be an error) would be my choice.

Duncan Murdoch

> 
> 	Sebastian Meyer
> 
>>
>> If that line is skipped (by conditioning on interactive()), the error
>> goes away.  But this might be unrelated, since deleting that comment
>> also makes the error go away.
>>
>> Duncan Murdoch
>>
>> ______________________________________________
>> R-devel using r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list