1 can't load iconv tables for codeset ASCII
2 testing in /
3 PWD is /
4 getcwd() = /
5 stat(".") = 0, ino=4174
6 chdir("/") = 0
7 stat(".") = 0, ino=531294
8 stat("/") = 0, ino=531294
9 child: stat(".") = 0, ino=531294
10 parent: stat(".") = 0, ino=531294
11
12 testing in /anydir
13 PWD is /anydir
14 getcwd() = /anydir
15 stat(".") = -1, ino=0
16 stat: No such file or directory
17 chdir("/anydir") = 0
18 stat(".") = 0, ino=446354
19 stat("/anydir") = 0, ino=446354
20 child: stat(".") = 0, ino=446354
21 parent: stat(".") = 0, ino=446354
You can see from line 5 and 15 above that stat(2) sees the
absolute root dir. A subsequent chdir(2) corrects
stat(2)'s idea of cwd (line 7 and 18).
As the bug is not in fork(2), see lines 9,10,20,21,
I suppose it's in exec(2).
For Interix 5.2 I saw this output:
1 $ /usr/sbin/chroot /tmp/chroot /anydir/start_test
2 testing in /
3 PWD is /
4 getcwd() = /
5 stat(".") = 0, ino=6606
6 stat("/") = 0, ino=10736
7 child: stat(".") = 0, ino=6606
8 parent: stat(".") = 0, ino=6606
9
10 testing in /anydir
11 PWD is /anydir
12 getcwd() = /anydir
13 stat(".") = -1, ino=0
14 stat: No such file or directory
15 stat("/anydir") = 0, ino=35992
16 parent: stat(".") = -1, ino=35992
17 parent: stat: No such file or directory
18 child: stat(".") = -1, ino=35992
19 child: stat: No such file or directory
Apparently, the bug is here in fork(2).
The inode of C:\Windows\SUA is 6606,
the inode of C:\Windows\SUA\tmp\chroot is 10736.
In line 7 and 8 you can see that both parent and child have left the chroot,
i.e. their cwd has changed to C:\Windows\SUA.
For line 16 and 18 the cwd is apparently believed to be
C:\Windows\SUA\anydir
(instead of the expected C:\Windows\SUA\tmp\chroot\anydir),
which doesn't exist.
For Interix 6.0:
testing in /
PWD is /
getcwd() = /
stat(".") = 0, ino=615222
stat("/") = 0, ino=615222
parent: stat(".") = 0, ino=615222
child: stat(".") = 0, ino=615222
testing in /anydir
PWD is /anydir
getcwd() = /anydir
stat(".") = 0, ino=615223
stat("/anydir") = 0, ino=615223
child: stat(".") = 0, ino=615223
parent: stat(".") = 0, ino=615223
Here everything looks as expected, so the bug seems to have been fixed with
this release of Interix.
see also: http://www.interopsystems.com/tools/tm.aspx?m=11325#11374 http://www.interopsystems.com/tools/tm.aspx?m=13238
see: http://msdn2.microsoft.com/en-us/library/ms811897.aspx
see also: http://www.interopsystems.com/tools/tm.aspx?m=4891
Last update of this document: Saturday, 04-Oct-2008 13:09:41 CEST
Copyright 2007-2008 Martin Köppe <mkoeppe 'at' gmx . de>