Re: Let set-file-mode change sticky bit? Lassi Kortela 08 Aug 2019 17:50 UTC

> As a matter of policy, and a simple interface, should we allow
> set-file-mode to set anything other than the permission bits?

If our procedure does chmod(path, (mode & PERMBITS)) then it clears any
sticky and setuid/setgid bits on each call. So we'd have to first do
stat(path, &st) and then chmod(path, ((mode & PERMBITS) | (st.st_mode &
~PERMBITS))); That introduces a race condition between stat() and chmod().

I also don't think there's a problem in allowing users to set those
bits. For the most part they shouldn't but there are some cases in Unix
where those bits need to be used for compatibility with other software
that expects them. Maybe not any cases that concern Scheme programs, but
adding this and the potential race condition together, plus the fact
that Unix users expect chmod() to set all bits, I'd bet on the side of
simplicity.