mock chroot builds run as owner of /

Paul Howarth paul at city-fan.org
Sun Aug 7 10:22:30 UTC 2005


On Sun, 2005-08-07 at 02:38 -0700, Roland McGrath wrote:
> I've just figured out why a test in a build was failing in mock builds but
> not in my normal rpmbuilds.  The difference is that in the mock build,
> `test -O /' succeeds for my uid (aka mockbuild), while in the real root
> that fails.  The test might as well have been test -w /, which tests
> writability.  It happens that I am the owner of /var/lib/mock/.../root,
> not just able to write it.

You could also test for running as root by comparing $(%{__id_u}) with 0

> Would there be a problem with mock making the / in the chroot be owned by
> root?  That way the build as a normal user (mockbuild) would match the
> normal environment, in which "do I own / ?" or "can I write / ?" are ways
> to check for being root (and thus e.g. expect that file permissions won't
> be enforced in your tests).  As things are, this yields a false positive
> and fouls the package's logic that works around idiots who build as root.

That would seem a sensible thing to do for consistency reasons; a "real"
system would have root owning the root directory, so the build
environment should really do so too. IMHO.

Paul.
-- 
Paul Howarth <paul at city-fan.org>




More information about the fedora-extras-list mailing list