Bug 17479 - R CMD check doesn't allow \Sexpr to generate top level Rd sections
Summary: R CMD check doesn't allow \Sexpr to generate top level Rd sections
Status: CLOSED FIXED
Alias: None
Product: R
Classification: Unclassified
Component: Misc (show other bugs)
Version: R-devel (trunk)
Hardware: Other Other
: P5 minor
Assignee: R-core
URL:
Depends on:
Blocks:
 
Reported: 2018-09-26 12:28 UTC by Duncan Murdoch
Modified: 2018-09-28 15:33 UTC (History)
1 user (show)

See Also:


Attachments
Test package to illustrate the bug (50.72 KB, application/x-gzip)
2018-09-26 12:28 UTC, Duncan Murdoch
Details
Patch to fix both parts of the bug (3.43 KB, patch)
2018-09-28 12:13 UTC, Duncan Murdoch
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Duncan Murdoch 2018-09-26 12:28:03 UTC
Created attachment 2373 [details]
Test package to illustrate the bug

This bug was reported on R-devel on July 12 by Gábor Csárdi.

If an Rd file has a \Sexpr{} to generate a section, the help file is built properly, but R CMD check complains about it.  For example, the attached package contains

    \Sexpr[stage=install,results=rd]{"\\\\examples{foo()}"}

and this generates the check warning:

    prepare_Rd: foo.Rd:23: Section \Sexpr is unrecognized and will be dropped

In the summer I prepared a patch to fix this, but the patch is insufficient to prevent a separate issue, where the CRAN incoming checks generate an internal warning

    * checking CRAN incoming feasibility ...Warning: /Users/murdoch/stuff/R/testpkg.Rcheck/00_pkg_src/testpkg/man/foo.Rd:23: Section \Sexpr is unrecognized and will be dropped


I'll see if I can improve the patch.
Comment 1 Duncan Murdoch 2018-09-28 12:13:49 UTC
Created attachment 2375 [details]
Patch to fix both parts of the bug

I believe the attached patch fixes both problems.  The issue was that \Sexpr isn't a legal section macro, but it should have been replaced before this test was done.  The original code only processed "build" stage macros.  Since the one in the test package was an "install" stage macro, it was left in place.

This patch had to add a new argument to tools::Rd_db, with the default set to the old hardcoded value.
Comment 2 Martin Maechler 2018-09-28 15:33:53 UTC
Thank you very much, Duncan!

The patch looks nice - adding optional arguments with back compatible defaults is something often useful in the tools package, indeed.

I'm also adding and  testing a (partial) regression check, using a version of your testpkg attachment.

And have committed all as  svn rev 75378,  for now to R-devel only.