-
Notifications
You must be signed in to change notification settings - Fork 83
Description
On MacOS, plotting anything (base, grid, etc) and then invoking the OS "Print" dialog with the xml2 package loaded causes R to emit an error and all following GD operations to fail.
It emits this error on macos via R in a shell or in emacs/ess. It does not emit the error on macos in RStudio (does not use quartz()), nor anywhere on linux. I have not verified Windows, though I suspect not since it uses x11() and not quartz().
library(xml2)
plot(1)
### switch to the graphics window, try to print with Cmd-P or File>Print
# Error: Start tag expected, '<' not found [4]If we plot first, load xml2, then go back to the window, the result is the same. If I load xml2 and then detach("package:xml2"), it fails in the same way.
Once it has failed, that graphics window becomes unresponsive (mac's spinning rainbow-wheel). I can dev.close() it and dev.list() is now empty, but the window remains. No new graphics devices can be opened, so in essence this R process's graphics days are done. Starting a new R process works fine.
If I load xml2 and then detach("package:xml2", unload=TRUE) and invoke the Print dialog,
Selection:
*** caught bus error ***
address 0x104a3a0c0, cause 'invalid alignment'
Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspaceI tried this with the three packages imported by xml2 individually and combined, and it did not trigger an error. This leads me to believe that it is either in xml2 itself or somehow in the linking with libxml2.
I've confirmed it does this on macos 15.5, R-4.4.3, xml2_1.3.8, one two separate MBPs; another R-SIG-Mac user verified it on macOS Sonoma 14.7.6, R 4.5.1 RC (unknown xml2 version).
This came up recently on R-SIG-Mac (https://stat.ethz.ch/pipermail/r-sig-mac/2025-July/015229.html), and one user helped narrow it down so far to xml2.