Email list hosting service & mailing list manager

Let set-file-mode change sticky bit? hga@xxxxxx (08 Aug 2019 17:26 UTC)
Re: Let set-file-mode change sticky bit? John Cowan (08 Aug 2019 17:49 UTC)
Re: Let set-file-mode change sticky bit? Lassi Kortela (08 Aug 2019 17:51 UTC)
Re: Let set-file-mode change sticky bit? John Cowan (08 Aug 2019 17:58 UTC)
Re: Let set-file-mode change sticky bit? hga@xxxxxx (08 Aug 2019 18:14 UTC)

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.