carpentries-incubator / julia-novice

A lesson exploring the Julia language
https://carpentries-incubator.github.io/julia-novice
Other
16 stars 23 forks source link

Building the site segfaults #79

Closed BeastyBlacksmith closed 2 weeks ago

BeastyBlacksmith commented 6 months ago

And that without any changes AFAICT. E.g. https://github.com/carpentries-incubator/julia-novice/actions/runs/9262066206

@zkamvar do you have an idea why that happens ?

zkamvar commented 6 months ago

I'm happy to provide some help, but @froggleston and @tobyhodges are the correct contacts. I believe this is a new problem with R 4.4.0 😞

The issue is coming from https://github.com/carpentries-incubator/julia-novice/blob/a4be2067f4ed7b4a2c758be17872de3d82d6dd50/episodes/06_Interfacing_conditions.md?plain=1#L142-L146

Where there is a unicode symbol × in the code block where it's causing the parse() function in R to trip over itself. In fact, it's strange because it's only that symbol and the division symbol that I can find to cause the segfault.

I believe a solution is to add the autolink function to {sandpaper}'s list of shims so that it always returns NA_character_, as this function is not terribly important to rendering contents.

  *** caught segfault ***
  address (nil), cause 'memory not mapped'

  Traceback:
   1: parse(con, keep.source = TRUE, encoding = "UTF-8", srcfile = srcfile)
   2: doTryCatch(return(expr), name, parentenv, handler)
   3: tryCatchOne(expr, names, parentenv, handlers[[1L]])
   4: tryCatchList(expr, classes, parentenv, handlers)
   5: tryCatch(parse(con, keep.source = TRUE, encoding = "UTF-8", srcfile = srcfile),     error = function(e) NULL)
   6: safe_parse(text)
   7: autolink_url(text)
   8: FUN(X[[i]], ...)
   9: vapply(.x, .f, ..., FUN.VALUE = character(1), USE.NAMES = FALSE)
  10: map_chr(text, fun, ...)
  11: tweak_children(x, xpath_inline, autolink, replace = "contents")
  12: downlit::downlit_html_node(html)
  13: tweak_page(html, name, pkg = pkg)
  14: pkgdown::render_page(pkg, template, data = global_data$instructor$get(),     depth = 1L, path = this_page, quiet = quiet)
  15: build_html(template = "chapter", pkg = pkg, nodes = nodes, global_data = page_globals,     path_md = path_md, quiet = quiet)
  16: build_episode_html(path_md = abs_md[i], path_src = abs_src[i],     page_back = location["back"], page_forward = location["forward"],     page_progress = progress, date = db$date[i], pkg = pkg, quiet = quiet)
  17: build_site(path = path, quiet = FALSE, preview = FALSE)
  18: force(code)
  19: withr::with_dir(path, {    need_markdown_sources <- nrow(get_built_db()) == 0L    if (need_markdown_sources) {        del_md <- git_worktree_setup(path, built, branch = md,             remote = remote)        on.exit(eval(del_md), add = TRUE)    }    del_site <- git_worktree_setup(path, html, branch = branch,         remote = remote)    on.exit(eval(del_site), add = TRUE)    if (reset) {        ci_group("Reset Site")        git_clean_everything(html)        cli::cat_line("::endgroup::")    }    ci_group("Build Lesson Website")    build_site(path = path, quiet = FALSE, preview = FALSE)    cli::cat_line("::endgroup::")    ci_group("Commit Lesson Website")    github_worktree_commit(html, message_source("site deploy",         md, dir = built), remote, branch)    cli::cat_line("::endgroup::")})
  20: ci_build_site(path, branch = site_branch, md = md_branch, remote = remote,     reset = reset)
  21: sandpaper:::ci_deploy(reset = reset)
  An irrecoverable exception occurred. R is aborting now ...
  Error: Process completed with exit code 139.
tobyhodges commented 6 months ago

This issue is related to https://github.com/carpentries/sandpaper/issues/589, which is in the process of being fixed upstream (in the downlit package). I think/hope thsi means we do not need to apply any fix in the Workbench itself.