[Rpm-maint] odd chroot behavior inside the rpm transaction

James Antill james at fedoraproject.org
Tue Sep 15 13:59:14 UTC 2009


On Tue, 2009-09-15 at 10:04 +0200, Michael Schroeder wrote:
> On Mon, Sep 14, 2009 at 04:54:11PM -0400, Seth Vidal wrote:
> >  if, from the python bindings, I open a file with a name starting with '/' 
> > while in a transaction then as expected, the file is opened inside the 
> > installroot
> > 
> > however, if I open a file with a name NOT starting with '/' then the file 
> > is opened OUTSIDE of the installroot.
> > 
> > Does this make any sense? B/c I admit I don't quite grok why it would be 
> > this way.
> 
> That's because rpm needs a way to switch back from the installroot
> to the old root. It does this by doing a
>     chroot(".")
> call.

 This is usually done by keeping around an fd for the old ".", and then
doing fchdir() on it (followed by chroot(".")).

-- 
James Antill <james at fedoraproject.org>
Fedora


More information about the Rpm-maint mailing list