From: John Cowan <email@example.com>
Date: Thursday, August 08, 2019 12:58 PM
If our procedure does chmod(path, (mode & PERMBITS)) then it clears any
sticky and setuid/setgid bits on each call.
You should not, under any circumstances, change the file permissions without knowing what the values of the other three bits should be (typically all zero). I am completely fine, if you call it with #x777 or #x600 or whatever, to clear the other three. So let's just call chmod passing the argument directly (chmod already masks off the file-type bits) and leave it at that.
That's exactly what I'm doing with Chibi Scheme, handing the supplied bits unmolested to chmod, and soon fchmod now that I've nailed down ports <-> file descriptors.
By the way, I meant to say *don't* change the procedure name. I was brain farting that it was currently set-permission-bits.
Instead, I changed the bits argument and description to refer to mode bits from permission bits.