Subject: UFS chmod weirdness
To: None <current-users@NetBSD.ORG>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: current-users
Date: 12/21/1996 17:44:02
In /sys/ufs/ufs/ufs_vnops.c, I find

static int
ufs_chmod(vp, mode, cred, p)
[...]
{
[...]
        if (cred->cr_uid) {
                if (vp->v_type != VDIR && (mode & S_ISTXT))
                        return (EFTYPE);
[...]
        }
[...]
}

This appears to be intended to prevent non-root from setting sticky
bits (except on directories).  However, it has the side effect that
given a file owned by non-root with its sticky bit set, then even its
owner cannot chmod that file without (irrevocably) clearing the sticky
bit.

Is it supposed to work this way?  It produces some very odd-looking
failure messages from chmod(1).

					der Mouse

			       mouse@rodents.montreal.qc.ca
		     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B