Re:The origins of chroot()
by spc476 on Thursday September 03, 2015 @12:28AM
(#10163340)
Very early versions of Unix didn't enforce a hierarchical file system---it was, in fact, a directed graph (not only could you have multiple hardlinks to files, but multiple hardlinks to directories!). (information from "Unix Implementation", Bell System Technical Journal, July-August 1978). So things back then were a lot less ... structured.
Re:The origins of chroot()
by siebenmann on Wednesday September 02, 2015 @03:24PM
(#10161398)
I suspect that the answer is 'badly'. V7's chroot() seems to be more than a little bit of a fast hack, one that was good enough for some things but not at all comprehensive or problem free.
(There are PDP-11 emulators and V7 disk images available through tuhs.org, so intrepid people who want to find out for themselves can actually try this out on a live V7 system.)
Re:The origins of chroot()
by dfox on Wednesday September 02, 2015 @07:19PM
(#10162557)
I think that chroot predates anything in kernel that would care about canonical paths. OS X manpage (first google hit for "getcwd history") claims that "The getwd() function appeared in 4.0BSD.", which is to this day essentially the only syscall that returns path name.
Re:The origins of chroot()
by qu4z-2 on Wednesday September 02, 2015 @06:49PM
(#10162434)
That is indeed the modern behaviour of chroot. It is not clear that the "original implementation" shown in the article shares that property, though.
EDIT: That's not to say it doesn't prevent that behaviour. If the usual code to prevent you ..ing above the root checks against u.u_rdir instead of /, it might well work as modern implementations do.
(There are PDP-11 emulators and V7 disk images available through tuhs.org, so intrepid people who want to find out for themselves can actually try this out on a live V7 system.)
EDIT: That's not to say it doesn't prevent that behaviour. If the usual code to prevent you ..ing above the root checks against u.u_rdir instead of /, it might well work as modern implementations do.