Post by omega on Jan 6, 2007 18:23:41 GMT 7
Hi,
I found a nasty bug in the firmware <= 1.00.05 regarding the chmod -R command.
The chmod -R command changes the file mode for a complete directory tree recursively. Whenever it finds a symbolic link it will ignore it completely, because setting the mode of an symbolic link itself is not supported by unix (and not needed anyway) and traversing a symbolic is not wanted in order to avoid infinite loops (see the chmod(1) man page).
In opposite to that, the chmod -R command of busybox is traversing symbolic links, and, if you're having the wrong symbolic link in your data, it will never stop.
You can try it out very simple by doing the following commands:
Thats all. If you try it on the N5200, it will run into an infinite loop (you can stop it by pressing CTRL-C). If you run his on a "normal" Linux system, nothing goes wrong.
As I'm building Linux distributions, I have the complete files of a Linux root filesystem on my N5200. And these root filesystems contain the standard link /dev/fd -> /proc/self/fd and therefore causes the above chmod command to fail.
As I told you in another mail, I fiddling with the ACL and file permissions. So I changed a share from private to public and one of the actions doing this is changing the file permissions to 777 using the chmod -R 777 command above.
Just to make it clear: I'm doing this the official way using the web interface. And the result is, that this procedure will run forever - you need to stop it by killing he chmod process manually (using ssh) or rebooting the system. But even then, the work intended to be done is not finished, because there is no change to change all the files to 777.
I will check for a patched busybox or chmod command. Maybe the chown command is affected too.
Andreas
UPDATE:
The busybox currently used in 1.00.05 is 1.1.0 from 13.1.2006 in in the source of chmod I can see the bug (missing check for symbolic links). In the actual version 1.3.1 this bug has been solved already.
I'm now checking how to create a patch....
I found a nasty bug in the firmware <= 1.00.05 regarding the chmod -R command.
The chmod -R command changes the file mode for a complete directory tree recursively. Whenever it finds a symbolic link it will ignore it completely, because setting the mode of an symbolic link itself is not supported by unix (and not needed anyway) and traversing a symbolic is not wanted in order to avoid infinite loops (see the chmod(1) man page).
In opposite to that, the chmod -R command of busybox is traversing symbolic links, and, if you're having the wrong symbolic link in your data, it will never stop.
You can try it out very simple by doing the following commands:
mkdir /tmp/xdir
ln -s /proc/self/fd /tmp/xdir/xfile
chmod -R 777 /tmp/xdir/xfile
Thats all. If you try it on the N5200, it will run into an infinite loop (you can stop it by pressing CTRL-C). If you run his on a "normal" Linux system, nothing goes wrong.
As I'm building Linux distributions, I have the complete files of a Linux root filesystem on my N5200. And these root filesystems contain the standard link /dev/fd -> /proc/self/fd and therefore causes the above chmod command to fail.
As I told you in another mail, I fiddling with the ACL and file permissions. So I changed a share from private to public and one of the actions doing this is changing the file permissions to 777 using the chmod -R 777 command above.
Just to make it clear: I'm doing this the official way using the web interface. And the result is, that this procedure will run forever - you need to stop it by killing he chmod process manually (using ssh) or rebooting the system. But even then, the work intended to be done is not finished, because there is no change to change all the files to 777.
I will check for a patched busybox or chmod command. Maybe the chown command is affected too.
Andreas
UPDATE:
The busybox currently used in 1.00.05 is 1.1.0 from 13.1.2006 in in the source of chmod I can see the bug (missing check for symbolic links). In the actual version 1.3.1 this bug has been solved already.
I'm now checking how to create a patch....