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

withr::with_language behaviour between Ubuntu 20.04/22.04 and 24.04 #277

Closed
froggleston opened this issue Jan 14, 2025 · 1 comment
Closed

Comments

@froggleston
Copy link

froggleston commented Jan 14, 2025

Hi there,

Please forgive me if this is a known issue or there is a simple reason for this that I haven't seen due to my R naivety!

When running the examples from the withr::with_language documentation across the three recent Ubuntu LTS versions, I see different behaviour.

24.04 fails to translate, whereas the earlier versions work correctly.

These are clean local Windows Subsystem for Linux (WSL) distributions with minimal R and package installations for the environments I need to test (see sessionInfos - for example my pandoc versions are different between the two, but this doesn't seem to affect the reported issue).

I was taken down this route by our GitHub Actions starting to fail on 24.04, but not on 22.04: https://github.com/carpentries/sandpaper/actions/runs/12758402271

Ubuntu 20.04/22.04 (behaviour is consistent across these two):

> withr::with_language("en", try(mean[[1]]))
Error in mean[[1]] : object of type 'closure' is not subsettable
> withr::with_language("fr", try(mean[[1]]))
Error in mean[[1]] : objet de type 'closure' non indiçable
20.04 session info
Session info ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 setting  value
 version  R version 4.4.2 (2024-10-31)
 os       Ubuntu 20.04.6 LTS
 system   x86_64, linux-gnu
 ui       X11
 language (EN)
 collate  C.UTF-8
 ctype    C.UTF-8
 tz       Europe/London
 date     2025-01-14
 pandoc   3.2.1 @ /usr/bin/ (via rmarkdown)

─ Packages ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 !  package     * version    date (UTC) lib source
    askpass       1.2.1      2024-10-04 [1] RSPM (R 4.4.0)
    assertthat    0.2.1      2019-03-21 [1] RSPM (R 4.4.0)
    brio          1.1.5      2024-04-24 [1] RSPM (R 4.4.0)
    cachem        1.1.0      2024-05-16 [1] RSPM (R 4.4.0)
    callr         3.7.6      2024-03-25 [1] RSPM (R 4.4.0)
    cli           3.6.3      2024-06-21 [1] RSPM (R 4.4.0)
    clipr         0.8.0      2022-02-22 [1] RSPM (R 4.4.0)
    commonmark    1.9.2      2024-10-04 [1] RSPM (R 4.4.0)
    credentials   2.0.2      2024-10-04 [1] RSPM (R 4.4.0)
    desc          1.4.3      2023-12-10 [1] RSPM (R 4.4.0)
    details       0.3.0      2022-03-27 [1] RSPM (R 4.4.0)
    devtools    * 2.4.5      2022-10-11 [1] RSPM (R 4.4.0)
    digest        0.6.37     2024-08-19 [1] CRAN (R 4.4.1)
    ellipsis      0.3.2      2021-04-29 [1] RSPM (R 4.4.0)
    evaluate      1.0.1      2024-10-10 [1] RSPM (R 4.4.0)
    fastmap       1.2.0      2024-05-15 [1] RSPM (R 4.4.0)
    fs            1.6.5      2024-10-30 [1] RSPM (R 4.4.0)
    gert          2.1.4      2024-10-14 [1] RSPM (R 4.4.0)
    gh            1.4.1      2024-03-28 [1] RSPM (R 4.4.0)
    glue          1.8.0      2024-09-30 [1] RSPM (R 4.4.0)
    htmltools     0.5.8.1    2024-04-04 [1] RSPM (R 4.4.0)
    htmlwidgets   1.6.4      2023-12-06 [1] RSPM (R 4.4.0)
    httpuv        1.6.15     2024-03-26 [1] RSPM (R 4.4.0)
    httr          1.4.7      2023-08-15 [1] RSPM (R 4.4.0)
    jsonlite      1.8.9      2024-09-20 [1] RSPM (R 4.4.0)
    knitr         1.49       2024-11-08 [1] RSPM (R 4.4.0)
    later         1.4.1      2024-11-27 [1] RSPM (R 4.4.0)
    lifecycle     1.0.4      2023-11-07 [1] RSPM (R 4.4.0)
    magrittr      2.0.3      2022-03-30 [1] RSPM (R 4.4.0)
    memoise       2.0.1      2021-11-26 [1] RSPM (R 4.4.0)
    mime          0.12       2021-09-28 [1] RSPM (R 4.4.0)
    miniUI        0.1.1.1    2018-05-18 [1] RSPM (R 4.4.0)
    openssl       2.3.1      2025-01-09 [1] CRAN (R 4.4.1)
    pegboard      0.7.7      2025-01-14 [1] https://carpentries.r-universe.dev (R 4.4.2)
    pillar        1.10.1     2025-01-07 [1] RSPM (R 4.4.0)
    pkgbuild      1.4.4      2024-03-17 [1] RSPM (R 4.4.0)
    pkgconfig     2.0.3      2019-09-22 [1] RSPM (R 4.4.0)
    pkgdown       2.1.1      2024-09-17 [1] RSPM (R 4.4.0)
    pkgload       1.4.0      2024-06-28 [1] RSPM (R 4.4.0)
    png           0.1-8      2022-11-29 [1] CRAN (R 4.4.1)
    processx      3.8.5      2025-01-08 [1] RSPM (R 4.4.0)
    profvis       0.3.8      2023-05-02 [1] RSPM (R 4.4.0)
    promises      1.3.2      2024-11-28 [1] RSPM (R 4.4.0)
    ps            1.8.1      2024-10-28 [1] RSPM (R 4.4.0)
    purrr         1.0.2      2023-08-10 [1] RSPM (R 4.4.0)
    R6            2.5.1      2021-08-19 [1] RSPM (R 4.4.0)
    Rcpp          1.0.13-1   2024-11-02 [1] RSPM (R 4.4.0)
    remotes       2.5.0      2024-03-17 [1] RSPM (R 4.4.0)
    renv          1.0.11     2024-10-12 [1] RSPM (R 4.4.0)
    rlang         1.1.4      2024-06-04 [1] RSPM (R 4.4.0)
    rmarkdown     2.29       2024-11-04 [1] RSPM (R 4.4.0)
    rprojroot     2.0.4      2023-11-05 [1] RSPM (R 4.4.0)
    rstudioapi    0.17.1     2024-10-22 [1] RSPM (R 4.4.0)
 VP sandpaper   * 0.16.11    2025-01-14 [?] https://carpentries.r-universe.dev (R 4.4.2) (on disk 0.16.10)
    servr         0.32       2024-10-04 [1] RSPM (R 4.4.0)
    sessioninfo   1.2.2      2021-12-06 [1] RSPM (R 4.4.0)
    shiny         1.10.0     2024-12-14 [1] RSPM (R 4.4.0)
    stringi       1.8.4      2024-05-06 [1] RSPM (R 4.4.0)
    stringr       1.5.1      2023-11-14 [1] RSPM (R 4.4.0)
    sys           3.4.3      2024-10-04 [1] RSPM (R 4.4.0)
    testthat    * 3.2.1.1    2024-04-14 [1] RSPM (R 4.4.0)
    tibble        3.2.1      2023-03-20 [1] RSPM (R 4.4.0)
    tinkr         0.2.0.9001 2025-01-14 [1] https://carpentries.r-universe.dev (R 4.4.2)
    urlchecker    1.0.1      2021-11-30 [1] RSPM (R 4.4.0)
    usethis     * 3.1.0      2024-11-26 [1] RSPM (R 4.4.0)
    vctrs         0.6.5      2023-12-01 [1] RSPM (R 4.4.0)
    whisker       0.4.1      2022-12-05 [1] RSPM (R 4.4.0)
    withr         3.0.2      2024-10-28 [1] RSPM (R 4.4.0)
    xfun          0.50       2025-01-07 [1] RSPM (R 4.4.0)
    xml2          1.3.6      2023-12-04 [1] RSPM (R 4.4.0)
    xtable        1.8-4      2019-04-21 [1] RSPM (R 4.4.0)
    yaml          2.3.10     2024-07-26 [1] RSPM (R 4.4.0)

 [1] /home/froggleston/R/x86_64-pc-linux-gnu-library/4.4
 [2] /usr/local/lib/R/site-library
 [3] /usr/lib/R/site-library
 [4] /usr/lib/R/library

 V ── Loaded and on-disk version mismatch.
 P ── Loaded and on-disk path mismatch.

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Ubuntu 24.04:

> withr::with_language("en", try(mean[[1]]))
Error in mean[[1]] : object of type 'closure' is not subsettable
> withr::with_language("fr", try(mean[[1]]))
Error in mean[[1]] : object of type 'closure' is not subsettable
24.04 session info
Session info ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 setting  value
 version  R version 4.4.2 (2024-10-31)
 os       Ubuntu 24.04.1 LTS
 system   x86_64, linux-gnu
 ui       X11
 language fr
 collate  C.UTF-8
 ctype    C.UTF-8
 tz       Europe/London
 date     2025-01-14
 pandoc   3.1.3 @ /usr/bin/ (via rmarkdown)

─ Packages ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 ! package     * version      date (UTC) lib source
   askpass       1.2.1        2024-10-04 [1] RSPM (R 4.4.0)
   assertthat    0.2.1        2019-03-21 [1] RSPM (R 4.4.0)
   brio          1.1.5        2024-04-24 [1] RSPM (R 4.4.0)
   cachem        1.1.0        2024-05-16 [1] RSPM (R 4.4.0)
   callr         3.7.6        2024-03-25 [1] RSPM (R 4.4.0)
   cli           3.6.3        2024-06-21 [1] RSPM (R 4.4.0)
   clipr         0.8.0        2022-02-22 [1] RSPM (R 4.4.0)
   commonmark    1.9.2        2024-10-04 [1] RSPM (R 4.4.0)
   credentials   2.0.2        2024-10-04 [1] RSPM (R 4.4.0)
   desc          1.4.3        2023-12-10 [1] RSPM (R 4.4.0)
   details       0.3.0        2022-03-27 [1] RSPM (R 4.4.0)
   devtools      2.4.5        2022-10-11 [1] RSPM (R 4.4.0)
   digest        0.6.37       2024-08-19 [1] RSPM (R 4.4.0)
   ellipsis      0.3.2        2021-04-29 [1] RSPM (R 4.4.0)
   evaluate      1.0.3        2025-01-10 [1] RSPM (R 4.4.0)
   fastmap       1.2.0        2024-05-15 [1] RSPM (R 4.4.0)
   fs            1.6.5        2024-10-30 [1] RSPM (R 4.4.0)
   gert          2.1.4        2024-10-14 [1] RSPM (R 4.4.0)
   gh            1.4.1        2024-03-28 [1] RSPM (R 4.4.0)
   glue          1.8.0        2024-09-30 [1] RSPM (R 4.4.0)
   htmltools     0.5.8.1      2024-04-04 [1] RSPM (R 4.4.0)
   htmlwidgets   1.6.4        2023-12-06 [1] RSPM (R 4.4.0)
   httpuv        1.6.15       2025-01-14 [1] https://carpentries.r-universe.dev (R 4.4.2)
   httr          1.4.7        2023-08-15 [1] RSPM (R 4.4.0)
   jsonlite      1.8.9        2024-09-20 [1] RSPM (R 4.4.0)
   knitr         1.49         2024-11-08 [1] RSPM (R 4.4.0)
   later         1.4.1        2024-11-27 [1] RSPM (R 4.4.0)
   lifecycle     1.0.4        2023-11-07 [1] RSPM (R 4.4.0)
   magrittr      2.0.3        2022-03-30 [1] RSPM (R 4.4.0)
   memoise       2.0.1        2021-11-26 [1] RSPM (R 4.4.0)
   mime          0.12         2021-09-28 [1] RSPM (R 4.4.0)
   miniUI        0.1.1.1      2018-05-18 [1] RSPM (R 4.4.0)
   openssl       2.3.1        2025-01-09 [1] RSPM (R 4.4.0)
   pegboard      0.7.7        2025-01-14 [1] Github (carpentries/pegboard@bad0be1)
   pillar        1.10.1       2025-01-07 [1] RSPM (R 4.4.0)
   pkgbuild      1.4.5        2024-10-28 [1] RSPM (R 4.4.0)
   pkgconfig     2.0.3        2019-09-22 [1] RSPM (R 4.4.0)
   pkgdown       2.1.1        2024-09-17 [1] RSPM (R 4.4.0)
   pkgload       1.4.0        2024-06-28 [1] RSPM (R 4.4.0)
   png           0.1-8        2022-11-29 [1] RSPM (R 4.4.0)
   processx      3.8.5        2025-01-08 [1] RSPM (R 4.4.0)
   profvis       0.4.0        2024-09-20 [1] RSPM (R 4.4.0)
   promises      1.3.2        2024-11-28 [1] RSPM (R 4.4.0)
   ps            1.8.1        2024-10-28 [1] RSPM (R 4.4.0)
   purrr         1.0.2        2023-08-10 [1] RSPM (R 4.4.0)
   R6            2.5.1        2021-08-19 [1] RSPM (R 4.4.0)
   Rcpp          1.0.14       2025-01-12 [1] RSPM (R 4.4.0)
   remotes       2.5.0        2024-03-17 [1] RSPM (R 4.4.0)
   renv          1.0.11       2024-10-12 [1] RSPM (R 4.4.0)
   rlang         1.1.4        2024-06-04 [1] RSPM (R 4.4.0)
   rmarkdown     2.29         2024-11-04 [1] RSPM (R 4.4.0)
   rprojroot     2.0.4        2023-11-05 [1] RSPM (R 4.4.0)
   rstudioapi    0.17.1       2024-10-22 [1] RSPM (R 4.4.0)
 P sandpaper   * 0.16.10.9000 2025-01-14 [?] load_all()
   servr         0.32         2024-10-04 [1] RSPM (R 4.4.0)
   sessioninfo   1.2.2        2021-12-06 [1] RSPM (R 4.4.0)
   shiny         1.10.0       2024-12-14 [1] RSPM (R 4.4.0)
   sys           3.4.3        2024-10-04 [1] RSPM (R 4.4.0)
   testthat    * 3.2.3        2025-01-13 [1] RSPM (R 4.4.0)
   tibble        3.2.1        2023-03-20 [1] RSPM (R 4.4.0)
   tinkr         0.2.0.9001   2025-01-14 [1] Github (ropensci/tinkr@9dc038a)
   urlchecker    1.0.1        2021-11-30 [1] RSPM (R 4.4.0)
   usethis       3.1.0        2024-11-26 [1] RSPM (R 4.4.0)
   vctrs         0.6.5        2023-12-01 [1] RSPM (R 4.4.0)
   whisker       0.4.1        2022-12-05 [1] RSPM (R 4.4.0)
   withr         3.0.2        2024-10-28 [1] RSPM (R 4.4.0)
   xfun          0.50         2025-01-07 [1] RSPM (R 4.4.0)
   xml2          1.3.6        2025-01-14 [1] https://carpentries.r-universe.dev (R 4.4.2)
   xtable        1.8-4        2019-04-21 [1] RSPM (R 4.4.0)
   yaml          2.3.10       2024-07-26 [1] RSPM (R 4.4.0)

 [1] /home/froggleston/R/x86_64-pc-linux-gnu-library/4.4
 [2] /usr/local/lib/R/site-library
 [3] /usr/lib/R/site-library
 [4] /usr/lib/R/library

 P ── Loaded and on-disk path mismatch.

───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Even though the language is correctly set to fr to test withr::with_language, the output from these functions remains in English.

I'm happy to provide dpkg lists too if required. Many thanks in advance!

@froggleston
Copy link
Author

This issue helped solve this for me: #236

My LANG setting on both systems is LANG=C.UTF-8. On Ubuntu 20/22, this works as expected and translations occur. On Ubuntu 24, the issue above is present. I presume this is down to how withr behaviour changed with respect to the "C" LANG handling.

Setting the locale with sudo dpkg-reconfigure locale to a specific locale, e.g. en_GB.UTF-8 results in the withr tests no longer being skipped due to LANG=C and the output is correct when using withr::with_language

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant