[R-SIG-Mac] Blank help window

Duncan Murdoch murdoch@dunc@n @ending from gm@il@com
Fri Oct 19 00:30:03 CEST 2018


On 18/10/2018 5:09 PM, Ben Tupper wrote:
> Hi,
> 
> In a fresh R.app session
> 
>  > debug(get("aqua.browser", envir = as.environment("tools:RGUI")))
>  > help('help')
> starting httpd help server ... done
> debugging in: browser(if (encodeIfNeeded) URLencode(url) else url)
> debug: {
>      x <- gsub("http://127.0.0.1", "http://localhost", x, fixed = TRUE)
>      .Call("aqua.custom.print", "help-files", x)
>      invisible(x)
> }
> Browse[2]> n
> debug: x <- gsub("http://127.0.0.1", "http://localhost", x, fixed = TRUE)
> Browse[2]> n
> debug: .Call("aqua.custom.print", "help-files", x)
> Browse[2]> browseURL(x)
> 
> 
> opens the external browser 
> http://localhost:28450/library/utils/html/help.html
> 
> but the browser says...
> 
> "Hmm. We’re having trouble finding that site.
> We can’t connect to the server at localhost.
> If that address is correct, here are three other things you can try:
> 
>      Try again later.
>      Check your network connection.
>      If you are connected but behind a firewall, check that Firefox has 
> permission to access the Web."
> 
> 
> And...
> 
> Browse[2]> c
> exiting from: browser(if (encodeIfNeeded) URLencode(url) else url)
> 
> ... opens the blank help window.

That's the issue then.  Your system doesn't support "localhost", and 
R.app assumes it will.

I don't know enough about MacOS to guess a cause or a remedy, but that's 
what you need to fix.

Duncan Murdoch

> 
> 
> Finally, following up on Marc's suggestion that I invoke R without 
> --vanilla...
> 
> ben using gale ~ $ diff R-app-options R-options
> 81c81
> < <bytecode: 0x7fd0b1fcbbc0>
> ---
>  > <bytecode: 0x7fb46a177890>
> 108,110d107
> < $help_type
> < [1] "html"
> <
> 184,185c181,182
> <                             CRAN
> < "http://cran.utstat.utoronto.ca"
> ---
>  >     CRAN
>  > "@CRAN@"
> 247c244
> < [1] 168
> ---
>  > [1] 80
> 
> 
> 
> 
> 
> 
> 
>> On Oct 18, 2018, at 4:49 PM, Duncan Murdoch <murdoch.duncan using gmail.com 
>> <mailto:murdoch.duncan using gmail.com>> wrote:
>>
>> On 18/10/2018 8:50 AM, Ben Tupper wrote:
>>> I also have no firewall running on the platform.  I do have 
>>> anti-virus/malware and have turned it off.  The help window still 
>>> renders with a blank page and there is no text captured with a 
>>> copy-paste.
>>> I tried debug() as Duncan suggested and get the following in a fresh 
>>> R.app session...
>>
>> Okay, that wasn't as informative as I had hoped.  Could you try the 
>> following:
>>
>> debug(get("aqua.browser", envir = as.environment("tools:RGUI")))
>>
>> then ask for help on something.  You should stop in the debugger 
>> seeing something like
>>
>> debugging in: browser(if (encodeIfNeeded) URLencode(url) else url)
>> debug: {
>>    x <- gsub("http://127.0.0.1 <http://127.0.0.1/>", "http://localhost 
>> <http://localhost/>", x, fixed = TRUE)
>>    .Call("aqua.custom.print", "help-files", x)
>>    invisible(x)
>> }
>>
>> At the prompt, type "n" (without the quotes, followed by return) 
>> twice, until you are at the .Call line.  Then type
>>
>> browseURL(x)
>>
>> This should open your external browser.  It will either show a blank 
>> page, or the help page:  that will indicate whether the problem is in 
>> the internal browser or in the server.
>>
>> Then go back to R.app, and type "c".  This should open the same help 
>> page in the internal browser.  It might show a blank page, or the 
>> regular help page:  either one would tell us something.
>>
>> Duncan Murdoch
>>
>>>> debug(utils:::print.help_files_with_topic)
>>>> help("help")
>>> debugging in: print.help_files_with_topic(x)
>>> debug: {
>>>     browser <- getOption("browser")
>>>     topic <- attr(x, "topic")
>>>     type <- attr(x, "type")
>>>     if (.Platform$GUI == "AQUA" && type == "html")
>>>         browser <- get("aqua.browser", envir = 
>>> as.environment("tools:RGUI"))
>>>     paths <- as.character(x)
>>>     if (!length(paths)) {
>>>         writeLines(c(gettextf("No documentation for %s in specified 
>>> packages and libraries:",
>>>             sQuote(topic)), gettextf("you could try %s", 
>>> sQuote(paste0("??",
>>>             topic)))))
>>>         return(invisible(x))
>>>     }
>>>     port <- if (type == "html")
>>>         tools::startDynamicHelp(NA)
>>>     else NULL
>>>     if (attr(x, "tried_all_packages")) {
>>>         paths <- unique(dirname(dirname(paths)))
>>>         msg <- gettextf("Help for topic %s is not in any loaded 
>>> package but can be found in the following packages:",
>>>             sQuote(topic))
>>>         if (type == "html" && port > 0L) {
>>>             path <- file.path(tempdir(), ".R/doc/html")
>>>             dir.create(path, recursive = TRUE, showWarnings = FALSE)
>>>             out <- paste0("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 
>>> 4.01 Transitional//EN\">\n",
>>>                 "<html><head><title>R: help</title>\n", "<meta 
>>> http-equiv=\"Content-Type\" content=\"text/html; charset=\"UTF-8\">\n",
>>>                 "<link rel=\"stylesheet\" type=\"text/css\" 
>>> href=\"/doc/html/R.css\">\n",
>>>                 "</head><body>\n\n<hr>\n")
>>>             out <- c(out, "<p>", msg, "</p><br>")
>>>             out <- c(out, "<table width=\"100%\" summary=\"R Package 
>>> list\">\n",
>>>                 "<tr align=\"left\" valign=\"top\">\n", "<td 
>>> width=\"25%\">Package</td><td>Library</td></tr>\n")
>>>             pkgs <- basename(paths)
>>>             links <- paste0("<a href=\"http://127.0.0.1:", port,
>>>                 "/library/", pkgs, "/help/", topic, "\">", pkgs,
>>>                 "</a>")
>>>             out <- c(out, paste0("<tr align=\"left\" valign=\"top\">\n",
>>>                 "<td>", links, "</td><td>", dirname(paths), 
>>> "</td></tr>\n"))
>>>             out <- c(out, "</table>\n</p>\n<hr>\n</body></html>")
>>>             writeLines(out, file.path(path, "all.available.html"))
>>>             browseURL(paste0("http://127.0.0.1:", port, 
>>> "/doc/html/all.available.html"),
>>>                 browser)
>>>         }
>>>         else {
>>>             writeLines(c(strwrap(msg), "", paste0("  ", 
>>> formatDL(c(gettext("Package"),
>>>                 basename(paths)), c(gettext("Library"), dirname(paths)),
>>>                 indent = 22))))
>>>         }
>>>     }
>>>     else {
>>>         if (length(paths) > 1L) {
>>>             if (type == "html" && port > 0L) {
>>>                 browseURL(paste0("http://127.0.0.1:", port, 
>>> "/library/NULL/help/",
>>>                   URLencode(topic, reserved = TRUE)), browser)
>>>                 return(invisible(x))
>>>             }
>>>             file <- paths[1L]
>>>             p <- paths
>>>             msg <- gettextf("Help on topic %s was found in the 
>>> following packages:",
>>>                 sQuote(topic))
>>>             paths <- dirname(dirname(paths))
>>>             txt <- formatDL(c("Package", basename(paths)), c("Library",
>>>                 dirname(paths)), indent = 22L)
>>>             writeLines(c(strwrap(msg), "", paste0("  ", txt),
>>>                 ""))
>>>             if (interactive()) {
>>>                 fp <- file.path(paths, "Meta", "Rd.rds")
>>>                 tp <- basename(p)
>>>                 titles <- tp
>>>                 if (type == "html" || type == "latex")
>>>                   tp <- tools::file_path_sans_ext(tp)
>>>                 for (i in seq_along(fp)) {
>>>                   tmp <- try(readRDS(fp[i]))
>>>                   titles[i] <- if (inherits(tmp, "try-error"))
>>>                     "unknown title"
>>>                   else tmp[tools::file_path_sans_ext(tmp$File) ==
>>>                     tp[i], "Title"]
>>>                 }
>>>                 txt <- paste0(titles, " {", basename(paths),
>>>                   "}")
>>>                 res <- menu(txt, title = gettext("Choose one"),
>>>                   graphics = getOption("menu.graphics"))
>>>                 if (res > 0)
>>>                   file <- p[res]
>>>             }
>>>             else {
>>>                 writeLines(gettext("\nUsing the first match ..."))
>>>             }
>>>         }
>>>         else file <- paths
>>>         if (type == "html") {
>>>             if (port > 0L) {
>>>                 path <- dirname(file)
>>>                 dirpath <- dirname(path)
>>>                 pkgname <- basename(dirpath)
>>>                 browseURL(paste0("http://127.0.0.1:", port, "/library/",
>>>                   pkgname, "/html/", basename(file), ".html"),
>>>                   browser)
>>>             }
>>>             else {
>>>                 warning("HTML help is unavailable", call. = FALSE)
>>>                 att <- attributes(x)
>>>                 xx <- sub("/html/([^/]*)\\.html$", "/help/\\1",
>>>                   x)
>>>                 attributes(xx) <- att
>>>                 attr(xx, "type") <- "text"
>>>                 print(xx)
>>>             }
>>>         }
>>>         else if (type == "text") {
>>>             pkgname <- basename(dirname(dirname(file)))
>>>             temp <- tools::Rd2txt(.getHelpFile(file), out = 
>>> tempfile("Rtxt"),
>>>                 package = pkgname)
>>>             file.show(temp, title = gettextf("R Help on %s",
>>>                 sQuote(topic)), delete.file = TRUE)
>>>         }
>>>         else if (type %in% "pdf") {
>>>             path <- dirname(file)
>>>             dirpath <- dirname(path)
>>>             texinputs <- file.path(dirpath, "help", "figures")
>>>             tf2 <- tempfile("Rlatex")
>>>             tools::Rd2latex(.getHelpFile(file), out = tf2)
>>>             .show_help_on_topic_offline(tf2, topic, type, texinputs)
>>>             unlink(tf2)
>>>         }
>>>     }
>>>     invisible(x)
>>> }
>>> Browse[2]> c
>>> ... at which point the blank help window pops.
>>>
>>>> On Oct 18, 2018, at 6:29 AM, zListserv <zlistserv using gmail.com 
>>>> <mailto:zlistserv using gmail.com>> wrote:
>>>>
>>>>
>>>>> On 2018-10-17, at 22:29, Marc Schwartz <marc_schwartz using me.com 
>>>>> <mailto:marc_schwartz using me.com>> wrote:
>>>>>
>>>>> Ok, strange. I figured that there was some conflict/corruption in 
>>>>> place with R.app that was not immediately clear.
>>>>>
>>>>> Peter raised the possibility of a firewall issue, but I am curious 
>>>>> as to why that would affect the use of help in R.app, but not via 
>>>>> other environments, like the Mac Terminal app. Theoretically, it 
>>>>> should be via similar protocols and ports in each setting, unless 
>>>>> there is something specific that R.app does to the OS environment 
>>>>> when running, that would inhibit the dynamic generation of the HTML 
>>>>> pages. But if so, why just for the two of you?
>>>>>
>>>>> It seems like the server is starting up ok, but the help pages are 
>>>>> not being generated by Rd2HTML() in R.app.
>>>>>
>>>>> However, it sparked a thought in my head, which is always risky, 
>>>>> and that is, do you guys have any anti-virus/malware software 
>>>>> running? I may be grasping at straws here, but such applications 
>>>>> have been known to cause all kinds of flaky behaviors, that are not 
>>>>> immediately evident nor associated with them.
>>>>
>>>> No firewall; no anti-virus or other malware software
>>>>
>>>>>
>>>>> One other thought. When you get the blank HTML page, presumably 
>>>>> white background, drag the cursor around the page to try to 
>>>>> highlight text, as if the text was also white, thus not showing 
>>>>> against the white background. Another straw....
>>>>
>>>> Nope.  Blank is blank.  No invisible text detected.
>>>>
>>>>>
>>>>> Regards,
>>>>>
>>>>> Marc
>>>>> <snip>
>>>>
>>> Ben Tupper
>>> Bigelow Laboratory for Ocean Sciences
>>> 60 Bigelow Drive, P.O. Box 380
>>> East Boothbay, Maine 04544
>>> http://www.bigelow.org
>>> Ecological Forecasting: https://eco.bigelow.org/
>>> [[alternative HTML version deleted]]
>>> _______________________________________________
>>> R-SIG-Mac mailing list
>>> R-SIG-Mac using r-project.org <mailto:R-SIG-Mac using r-project.org>
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
> 
> Ben Tupper
> Bigelow Laboratory for Ocean Sciences
> 60 Bigelow Drive, P.O. Box 380
> East Boothbay, Maine 04544
> http://www.bigelow.org
> 
> Ecological Forecasting: https://eco.bigelow.org/
> 
> 
> 
> 
>



More information about the R-SIG-Mac mailing list