On Fri 07 Mar 2008 at 12:30PM, [EMAIL PROTECTED] wrote:
> > Oh, one more interesting tidbit:
> > 
> > This failure only happens when I run "make test" as root.
> > 
> > In other words:
> > 
> > pfexec bash
> > make test
> > 
> > It seems to work fine if I run it as my own user.
> > 
> > Does that mean anything?
> 
> Yes.  Directory permission checks aren't enforced for root, so this test
> case will fail when run as root.
> 
> I've written a pejorative case for when we are running as root.  It
> doesn't test for the exception, but it does assert that we've set our
> errorlevel high enough to get exceptions, should they occur.

Gracefully handling cases like this is yet another deficiency in the
test suite, although one which I didn't think we'd get to so quickly.
I'll add this to my list of things to think about.   For now, the
workaround below seems OK.

        -dp

> Here's the diff for that:
> 
> diff -r ca9993d3aaea src/tests/api/t_pkgtarfile.py
> --- a/src/tests/api/t_pkgtarfile.py     Tue Mar 04 18:00:58 2008 -0800
> +++ b/src/tests/api/t_pkgtarfile.py     Fri Mar 07 12:27:23 2008 -0800
> @@ -62,11 +62,17 @@ class TestPkgTarFile(unittest.TestCase):
>  
>          def testerrorlevelIsCorrect(self):
>                  p = pkgtarfile.PkgTarFile(self.tarfile, 'r')
> +
> +                if os.getuid() == 0:
> +                        self.assert_(p.errorlevel == 2)
> +                        p.close()
> +                        return
> +
>                  extractpath = os.path.join(self.tpath, "foo/bar")
>                  os.makedirs(extractpath)
>                  os.chmod(extractpath, 0555)
>                  self.assertRaises(IOError, p.extract, "foo/bar/baz",
> -                    extractpath)
> +                    self.tpath)
>                  p.close()
>                  os.chmod(extractpath, 777)
>  
> 
> -j
> _______________________________________________
> pkg-discuss mailing list
> [email protected]
> http://mail.opensolaris.org/mailman/listinfo/pkg-discuss

-- 
Daniel Price - Solaris Kernel Engineering - [EMAIL PROTECTED] - blogs.sun.com/dp
_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss

Reply via email to