Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build_site() fails when two .Rd mans have the same \aliases #74

Closed
netique opened this issue Dec 27, 2020 · 2 comments · Fixed by r-lib/pkgdown#1645
Closed

build_site() fails when two .Rd mans have the same \aliases #74

netique opened this issue Dec 27, 2020 · 2 comments · Fixed by r-lib/pkgdown#1645
Labels
bug an unexpected problem or unintended behavior

Comments

@netique
Copy link

netique commented Dec 27, 2020

I have a package, where one function has the same name as the package, which is a case quite often, in my view. The package-level .Rd was built with usethis::use_package_doc(). When I call pkgdown::build_site(new_process = FALSE), following error occurs:

Error in vapply(.x, .f, ..., FUN.VALUE = character(1), USE.NAMES = FALSE) : 
  values must be length 1,
 but FUN(X[[2]]) result is length 2
In addition: Warning messages:
1: In if (rdname == "reexports") { :
  the condition has length > 1 and only the first element will be used
2: In if (rdname == cur_rdname) { :
  the condition has length > 1 and only the first element will be used

Traceback:

href_topic_local(topic)
href_topic(fun_name, pkg)
href_expr(expr[[1]])
autolink_url(text)
FUN(X[[i]], ...)
vapply(.x, .f, ..., FUN.VALUE = character(1), USE.NAMES = FALSE)
map_chr(text, fun, ...)
tweak_children(x, xpath_inline, autolink, replace = "contents")
downlit::downlit_html_node(xml)
markdown(src_path)
build_home_index(pkg, quiet = quiet)
build_home(pkg, override = override, preview = FALSE)
build_site_local(pkg = pkg, examples = examples, run_dont_run = run_dont_run,
pkgdown::build_site(new_process = FALSE)

In the innermost call, there are two elements in rdnames: "package" and "package-package" (from usethis::use_package_doc()). This is the issue. A clash of two aliases in .Rd.

@netique netique changed the title build_home_index fails when two .Rd mans have the same \aliases build_site() fails when two .Rd mans have the same \aliases Dec 27, 2020
@hadley hadley transferred this issue from r-lib/pkgdown Dec 27, 2020
@HenrikBengtsson
Copy link

Just ran into this one as well; I've _R_CHECK_LENGTH_1_LOGIC2_=verbose so I get:

 --- value of length: 2 type: logical ---
[1] FALSE FALSE
 --- function from context --- 
function (topic) 
{
    rdname <- find_rdname(NULL, topic)
    if (is.null(rdname)) {
        loc <- find_rdname_attached(topic)
        if (is.null(loc)) {
            return(NA_character_)
        }
        else {
            return(href_topic_remote(topic, loc$package))
        }
    }
    if (rdname == "reexports") {
        return(href_topic_reexported(topic, getOption("downlit.package")))
    }
    cur_rdname <- getOption("downlit.rdname", "")
    if (rdname == cur_rdname) {
        return(NA_character_)
    }
    if (cur_rdname != "") {
        paste0(rdname, ".html")
    }
    else {
        paste0(getOption("downlit.topic_path"), rdname, ".html")
    }
}
<bytecode: 0x5642d97bad70>
<environment: namespace:downlit>
 --- function search by body ---
Function href_topic_local in namespace downlit has this body.
 ----------- END OF FAILURE REPORT -------------- 
Error in if (rdname == "reexports") { : the condition has length > 1

@hadley
Copy link
Member

hadley commented Apr 27, 2021

Would've been helpful to know which packages this occured in.

hadley added a commit to r-lib/pkgdown that referenced this issue Apr 27, 2021
@hadley hadley added the bug an unexpected problem or unintended behavior label Apr 27, 2021
hadley added a commit to r-lib/pkgdown that referenced this issue Apr 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants