Repository navigation
Closed
Description
Hi,
I wanted to upgrade the repr package in Debian. Unfortunately there are some admittedly strange issues where diff creates some differences that do not really look like different strings. The test suite output starts with
══ Failed tests ════════════════════════════════════════════════════════════════
── Failure ('test_escaping.r:49'): LaTeX escaping in matrices works ────────────
repr_latex(matrix(c("[", "{", "%", "#"), 2, 2, TRUE)) (`actual`) not identical to "A matrix: 2 × 2 of type chr\n\\begin{tabular}{ll}\n\t {[} & \\{\\\\\n\t \\% & \\#\\\\\n\\end{tabular}\n" (`expected`).
lines(actual) | lines(expected)
[1] "A matrix: 2 x 2 of type chr" - "A matrix: 2 × 2 of type chr" [1]
[2] "\\begin{tabular}{ll}" | "\\begin{tabular}{ll}" [2]
[3] "\t {[} & \\{\\\\" | "\t {[} & \\{\\\\" [3]
[4] "\t \\% & \\#\\\\" | "\t \\% & \\#\\\\" [4]
── Failure ('test_escaping.r:56'): LaTeX escaping in matrices works ────────────
repr_latex(...) (`actual`) not identical to "A matrix: 2 × 2 of type chr\n\\begin{tabular}{r|ll}\n & \\% & \\textbar{}\\\\\n\\hline\n\t\\$ & {]} & \\}\\\\\n\t\\# & \\& & \\_\\\\\n\\end{tabular}\n" (`expected`).
lines(actual) | lines(expected)
[1] "A matrix: 2 x 2 of type chr" - "A matrix: 2 × 2 of type chr" [1]
[2] "\\begin{tabular}{r|ll}" | "\\begin{tabular}{r|ll}" [2]
[3] " & \\% & \\textbar{}\\\\" | " & \\% & \\textbar{}\\\\" [3]
[4] "\\hline" | "\\hline" [4]
── Failure ('test_escaping.r:68'): HTML escaping in matrices works ─────────────
repr_html(matrix(c("[", "{", "%", "#"), 2, 2, TRUE)) (`actual`) not identical to "<table class=\"dataframe\">\n<caption>A matrix: 2 × 2 of type chr</caption>\n<tbody>\n\t<tr><td>[</td><td>{</td></tr>\n\t<tr><td>%</td><td>#</td></tr>\n</tbody>\n</table>\n" (`expected`).
lines(actual)[1:5] vs lines(expected)[1:5]
"<table class=\"dataframe\">"
- "<caption>A matrix: 2 x 2 of type chr</caption>"
+ "<caption>A matrix: 2 × 2 of type chr</caption>"
"<tbody>"
"\t<tr><td>[</td><td>{</td></tr>"
"\t<tr><td>%</td><td>#</td></tr>"
Feel free to find the full build log in the Debian CI.
Kind regards, Andreas.
Metadata
Metadata
Assignees
Labels
No labels
Activity
aitap commentedon Jan 22, 2023
I don't have a solution, but the "expected" strings contain
×, U+00D7 MULTIPLICATION SIGN, while the "actual" strings containx, U+0078 LATIN SMALL LETTER X.tillea commentedon Jan 22, 2023
aitap commentedon Jan 22, 2023
tillea commentedon Jan 22, 2023
We explicitly set
LC_ALL=C.UTF-8for the test . If I setLC_ALL=en_US.UTF-8the issue becomes at least obvious:I failed with setting
LC_ALL=en_US.ISO-8859-1. How is your exact locale setting?I'd recommend you'd adapt to UTF-8 which is somehow a widely accepted default.
Kind regards, Andreas.
aitap commentedon Jan 22, 2023
flying-sheep commentedon Jan 22, 2023
I think what might be happening here is that the package level code here is executed at build time (R packages are compiled to bytecode when building them from source)
Therefore we might be able to improve things by caching the characters at package initialization instead of on package build time.
Please check if the debian CI can handle with the version of this package from #160
flying-sheep commentedon Jan 22, 2023
Please report here if the problem persists, although I don’t think there’s anything that can be done on the repr side
tillea commentedon Jan 26, 2023
flying-sheep commentedon Jan 26, 2023
I’ll do that once and publish v1.1.6. If you still run into problems there, we’ll have to collaborate in another way, without me pushing speculative fixes, since the CRAN maintainers don’t like frequent updates like that.