Re: [vserver] testfs.sh-0.20 patches

From: Corey Wright <undefined_at_pobox.com>
Date: Mon 24 Aug 2009 - 05:46:07 BST
Message-Id: <20090823234607.b63513eb.undefined@pobox.com>

On Fri, 21 Aug 2009 17:06:55 -0500
Corey Wright <undefined@pobox.com> wrote:

> On Fri, 21 Aug 2009 20:41:53 +0200
> Herbert Poetzl <herbert@13thfloor.at> wrote:
>
> > On Fri, Aug 21, 2009 at 08:48:46AM -0400, Mark Little wrote:
> > > On Fri, 21 Aug 2009 10:03:07 +0200, Herbert Poetzl
> > > <herbert@13thfloor.at> wrote:
> > > > On Fri, Aug 21, 2009 at 12:07:39AM -0500, Corey Wright wrote:
> > > >> how about exec'ing chattr instead of eval'ing it (as chattr is too
> > > >> buggy to test with) and instead test the xattrs (using showattr &
> > > >> lsattr as done elsewhere in the code) after the attempted chattr to
> > > >> insure it didn't change them?
> > > >
> > > > close, but not perfect, we should at least (explicitly or
> > > > implicitly) ensure that chattr _exists_ and was executed,
> > > > because otherwise checking for changes doesn't make much
> > > > sense (i.e. will give a false positive)
> > > >
> > > > if that is done somehow, we can forget about the chattr
> > > > return code completely ...
> > >
> > > Could you first do a test of creating something in /tmp (on the host,
> > > not in a guest context) and then chattr and verify that the changes
> > > DID happen.. If so we assume chattr is working fine and then can trust
> > > the results of it within the contexts?
> >
> > well, the problem is not that chattr doesn't work, the
> > problem is that some versions report success, even when
> > they could not possibly have succeeded (e.g. no file
> > was found or similar)
> >
> > but yes, we might do a chattr test where it is supposed
> > to work (i.e. change something) first and check that
> > and if it fails, further tests utilizing chattr can be
> > considered invalid
>
> and that's what this patch does (plus a little extra):
> 1. test initial state of directory
> 2. use chattr on the directory
> 3. verify chattr actions on the directory
> 3. repeat chattr test after setting directory as barrier

4. uses "???" for test numbers on new tests which causes problems on
ubuntu.

i tested the modified script (testfs.sh-0.20c) on ubuntu hardy today and
"???" was being expanded to "bin tmp" which was wrecking havoc. i changed
the yet-unassigned tests from "???" to "10?" and the script worked fine.
(i have never seen "???" documented as a bash variable that expands to a
list of directories in the current directory, especially as i thought all
shell variables began with "$".)

remember that ubuntu hardy has an older chattr with an exit code of "0" (ie
success) when it clearly fails (but yet printing on stderr something
similar to "could not stat file/directory"), unlike debian lenny's properly
functioning chattr, and is the whole reason i created this patch. so this
patch "works for me" in my original use case.

i also tested that if the barrier was not set that the tests would fail as
expected (though tested by unsetting the barrier right before the chattr).
so the new tests were tested for both "true positives" and "true
negatives" (by executing with and without the barrier set), but nothing
more exotic (eg do_xattr_verify fails but do_xattr_barrier passes by
unsetting the barrier between the two tests; i can probably think of a lot
more test cases).

corey

-- 
undefined@pobox.com
Received on Mon Aug 24 05:46:34 2009
[Next/Previous Months] [Main vserver Project Homepage] [Howto Subscribe/Unsubscribe] [Paul Sladen's vserver stuff]
Generated on Mon 24 Aug 2009 - 05:46:38 BST by hypermail 2.1.8