2008-01-30 14:29:31 |
Aaron Toponce |
description |
SGID is not setting the correct exit code upon failure. For example, follow along below. This not only affects Ubuntu, but I assume Linux in general, as I've duplicated the bug on Debian and Red Hat, the two largest forked distros.
aaron@kratos:~$ mkdir ~/tmp
aaron@kratos:~$ ls -ld ~/tmp
drwxr-xr-x 2 aaron aaron 4096 2008-01-30 07:24 /home/aaron/tmp
aaron@kratos:~$ sudo chown .root ~/tmp
Password or swipe finger:
aaron@kratos:~$ ls -ld ~/tmp
drwxr-xr-x 2 aaron root 4096 2008-01-30 07:24 /home/aaron/tmp
aaron@kratos:~$ chmod g+s ~/tmp
aaron@kratos:~$ ls -ld ~/tmp
drwxr-xr-x 2 aaron root 4096 2008-01-30 07:24 /home/aaron/tmp
aaron@kratos:~$ chmod g+s ~/tmp
aaron@kratos:~$ echo $?
0
Obviously, it's not setting the SGID (drwxr-sr-x), as I am not a member of the 'root' group. This is expected behavior. However, it's also not sending a permission denied error to STDERR as I would expect. As we can see from the exit status, it is telling me, by returning a zero, that it has succeeded, which of course it hasn't. |
chmod is not setting the correct exit code upon SGID directory failure. For example, follow along below. This not only affects Ubuntu, but I assume Linux in general, as I've duplicated the bug on Debian and Red Hat, the two largest forked distros.
aaron@kratos:~$ mkdir ~/tmp
aaron@kratos:~$ ls -ld ~/tmp
drwxr-xr-x 2 aaron aaron 4096 2008-01-30 07:24 /home/aaron/tmp
aaron@kratos:~$ sudo chown .root ~/tmp
Password or swipe finger:
aaron@kratos:~$ ls -ld ~/tmp
drwxr-xr-x 2 aaron root 4096 2008-01-30 07:24 /home/aaron/tmp
aaron@kratos:~$ chmod g+s ~/tmp
aaron@kratos:~$ ls -ld ~/tmp
drwxr-xr-x 2 aaron root 4096 2008-01-30 07:24 /home/aaron/tmp
aaron@kratos:~$ chmod g+s ~/tmp
aaron@kratos:~$ echo $?
0
Obviously, it's not setting the SGID (drwxr-sr-x), as I am not a member of the 'root' group. This is expected behavior. However, it's also not sending a permission denied error to STDERR as I would expect. As we can see from the exit status, it is telling me, by returning a zero, that it has succeeded, which of course it hasn't. |
|