Hello folks,
I’ve run into an interesting issue with one of the commands exposed by the new dmd snap (sudo snap install --classic --channel=edge dmd).
Besides the dmd compiler for the D programming language, this also exposes a command rdmd which provides a friendly build-and-run wrapper for D programs: it essentially allows one to use D programs as if they were in a scripting language (the compile times are very fast…).
rdmd essentially does some magic to work out what dmd compiler flags and source files are needed for the build (in addition to the file it’s been passed), then execs dmd itself on those source files.
This was working fine in earlier tests, but now I’m getting an error:
$ dmd.rdmd hello.d
Failed to flush stdout: Permission denied
Failed: ["dmd", "-v", "-o-", "hello.d", "-I."]
Since this wasn’t happening before, and the built package hasn’t changed (just been freshly reinstalled), I suspect this is down to a snapd and/or core snap update, possibly with changes to apparmor rules?
One option that I considered was that there might be some changes that create confusion about which dmd to execute: /snap/bin/dmd (probably what’s wanted) or the $SNAP/bin/dmd inside the snap package itself. However, changing the name of the inside-the-snap binary doesn’t resolve the problem (I just did a fresh build-and-install with it tweaked), so my suspicion is that it’s apparmor that is at fault.
Any thoughts on what is going wrong and how to address this?
Thanks & best wishes,
-- Joe