Skip to content

Handling of interactive No to clean_doc question #186

@RossBoylan

Description

@RossBoylan

The meaning of a No response to the interactive prompt is unclear, even after selecting it. Furthermore, the ensuing behavior is surprising and unhelpful.

Sample

This is from a vanilla R session (not RStudio):

> devtools::build()
Running bootstrap.R...
# ...
Building the package will delete...
  'C:/Users/rdboylan/Documents/BP/pimex/inst/doc'
Are you sure?

1: Yes
2: No

Selection: 2
-- R CMD  ---------------------------------------------------------------------------------------
no("wd") || is_string(wd) is not TRUE
eval(substitute(expr), data, enclos = parent.frame())
TRUE
NULL
NULL
30180
1716004002
0

Problems

  1. Are you sure? probably means "do you want to delete inst/doc?", but it could mean "do you want to continue with the build?" It's ambiguous. For the pedantic, there is a 3rd interpretation: "say whether or not you are sure that this tool deletes the directory".
  2. The material following Selection: 2 has no obvious meaning or significance. In particular, it doesn't resolve the question of whether the deletion or the whole build was aborted.
  3. It seems that selecting 2, aka No actually did abort the build, since no tarball resulted. It would be more helpful if it left the directory in place and continued with the build.

Desired Behavior

  • Selecting No leaves inst/doc and proceeds with the build.
  • Selecting No does not produce the meaningless output shown above.
  • The question clearly indicates what behavior will result from a Yes or No response, and that matches what happens.

"leaves inst/doc" above simply means the deletion of the directory is skipped; it is not intended to mean no new material such as vignettes will be placed in inst/doc.

Code

https://github.com/r-lib/pkgbuild/blob/90f017b337ae23006b10fd8a5db1040ddf5fd401/R/build.R#L251C1-L256C10 seems to be the relevant code. If option 2 is selected then return() is executed. My expectation, and I think the intention, is that it simply exits from the block beginning at

if (build_vignettes && (is.null(clean_doc) || isTRUE(clean_doc))) {
and proceeds. But the remaining steps are in body of the same function and the return simply skips them.

Context

R 4.4.0
pkgbuild 1.4.4
devtools 2.4.5
MS Windows amd64

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behaviortidy-dev-day 🤓Tidyverse Developer Day

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions