[PATCH]: chmod - do inform about using different mode than requested wit
From:
Ondřej Vašík
Subject:
[PATCH]: chmod - do inform about using different mode than requested with SGID/SUID/sticky bits without permissions to change them
Date:
Fri, 24 Oct 2008 17:41:40 +0200
Hello,
as reported in
https://bugs.launchpad.net/ubuntu/+source/coreutils/+bug/187315 by Aaron
Toponce , chmod could display confusing messages when used for
SGID/SUID/sticky bits without permissions to change them.
e.g. with non-root sudoers user following scenario
mkdir tmp;sudo chown .root tmp;ls -ld tmp;chmod -v 2755 tmp;ls -ld tmp;
would lead to:
drwxrwxr-x 2 Reset root 4096 24. říj 17.33 tmp
mode of `tmp' changed to 2755 (rwxr-sr-x)
drwxr-xr-x 2 Reset root 4096 24. říj 17.33 tmp
So user is informed that sticky bit was set even if it was not.
After my patch output will be:
drwxrwxr-x 2 Reset root 4096 24. říj 17.35 tmp
can't change mode of `tmp' to 2755 (rwxr-sr-x), using 0755 (rwxr-xr-x)
mode of `tmp' changed to 0755 (rwxr-xr-x)
drwxr-xr-x 2 Reset root 4096 24. říj 17.35 tmp
That should reduce user's confusion and clarify what's really done by
chmod command.
Greetings,
Ondřej Vašík