Skip to content

Commit 72509bb

Browse files
committed
fix(ci): Stamp the roxygen2 version with a backreference, not an octal escape
The version stamp wrote the replacement as "\1". R parses that as the octal escape for \001, not as a regex backreference, so DESCRIPTION ended up with a malformed version and R CMD INSTALL aborted with "Malformed package version". Every job that installs roxygen2 through this action failed there. The replacement is now "\\1", verified to stamp 8.1.0.9000 to 8.1.0.9100. The post-install guard asserted only the .9100 suffix, and the corrupt "\001.9100" satisfies that too, which is why the bug survived the check meant to catch it. The guard now asserts the whole x.y.z.9100 shape, and passes inherits = FALSE to exists(). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WWhverMTZZKgEpUuTK117m
1 parent 4676d38 commit 72509bb

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

‎.github/workflows/roxygen2-fork/action.yml‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ runs:
8686
Rscript -e '
8787
d <- read.dcf("DESCRIPTION")
8888
v <- d[1, "Version"]
89-
d[1, "Version"] <- sub("^([0-9]+[.][0-9]+[.][0-9]+).*$", "\1.9100", v)
89+
d[1, "Version"] <- sub("^([0-9]+[.][0-9]+[.][0-9]+).*$", "\\1.9100", v)
9090
write.dcf(d, "DESCRIPTION", keep.white = colnames(d))
9191
cat("stamped", v, "->", read.dcf("DESCRIPTION")[1, "Version"], "\n")
9292
'
@@ -96,9 +96,12 @@ runs:
9696
# Fail here rather than three steps later with a puzzling man/ diff.
9797
Rscript -e '
9898
v <- as.character(packageVersion("roxygen2"))
99-
patched <- exists("mdxml_keep_sentence_spacing", envir = asNamespace("roxygen2"))
99+
patched <- exists("mdxml_keep_sentence_spacing", envir = asNamespace("roxygen2"), inherits = FALSE)
100100
cat("roxygen2", v, "patched:", patched, "\n")
101-
if (!grepl("[.]9100$", v) || !patched) {
101+
# Assert the whole shape, not just the suffix: a malformed stamp such as
102+
# "\001.9100" also ends in .9100, which is how the escaping bug in this
103+
# very expression went unnoticed until CI refused to install the result.
104+
if (!grepl("^[0-9]+[.][0-9]+[.][0-9]+[.]9100$", v) || !patched) {
102105
stop("roxygen2 was not installed from the fork branch.", call. = FALSE)
103106
}
104107
'

0 commit comments

Comments
 (0)