> > That's because the bug is in chroot(8), not chroot(2). chroot(2) is
> > supposed to change only the root directory; Linux's behavior is
> > correct.
>
> I don't think the bug is in chroot(8) necessarily (although
>
> POSIX tests don't include chroot AFAIK, the man pages on other systems
> don't specify that the PWD isn't changed (although they DO specify that
> /.. should point to /., a behaviour which Linux follows) therefore there
> is no real standard as to determine what makes it incorrect/correct.
Which other systems' manpages did you read? I found a few which did
not specify what the new cwd should be, but also several which said
that Linux's behavior was correct. For instance:
SunOS 4.1.1: "The current working directory is unaffected by this call."
SunOS 5.4 / Solaris 2.4: "The user's working directory is unaffected
by the chroot() and fchroot() functions."
IRIX 5.3: "The user's working directory is unaffected by the chroot
system call."
NetBSD 1.2: "It should be noted that chroot() has no effect on the
process's current directory."
Any questions?
-- Aaron M. Ucko (amu@mit.edu) | For Geek Code, PGP public key, and other info, finger amu@monk.mit.edu. | "Kids! Bringing about Armageddon can be dangerous. Do not attempt it in your home." -- T. Pratchett & N. Gaiman, _Good Omens_