]> arthur.barton.de Git - bup.git/commitdiff
tmetadata: the "non existent group name" test didn't make any sense.
authorAvery Pennarun <apenwarr@gmail.com>
Sun, 20 Mar 2011 09:19:08 +0000 (02:19 -0700)
committerAvery Pennarun <apenwarr@gmail.com>
Sun, 20 Mar 2011 09:42:10 +0000 (02:42 -0700)
There's certainly no reason to expect the file's uid/gid would have changed
after a call that's supposed to fail.  It was passing by pure luck on Linux,
which doesn't have a sticky gid bit causing the newly created file to have
a gid != os.getgid().  But on MacOS, the file was originally created with a
gid != os.getgid(), and so restoring its numeric id restored that, and then
the test failed.

The test is still kind of pointless; it doesn't actually test anything
useful, like (for example) automatic fallback to restoring by numeric gid if
the groupname can't be found.  In fact, looking at the code, it doesn't seem
like it *would* fall back, which is a bug.  But I'm not going to fix that
right now.

Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
lib/bup/t/tmetadata.py

index c0d2b6dd9b481a646cb3b5a0be29e72a2faf88dc..8660ed9512e8faf9fe55c6c32e970beb1fbea0a4 100644 (file)
@@ -189,8 +189,8 @@ def test_restore_nonexistent_user_group():
         WVPASSEQ(os.stat(path).st_uid, m.uid)
         WVPASSEQ(os.stat(path).st_gid, m.gid)
         WVPASSEQ(m.apply_to_path(path, restore_numeric_ids=False), None)
-        WVPASSEQ(os.stat(path).st_uid, os.geteuid())
-        WVPASSEQ(os.stat(path).st_gid, os.getgid())
+        WVPASSEQ(os.stat(path).st_uid, m.uid)
+        WVPASSEQ(os.stat(path).st_gid, m.gid)
     finally:
         subprocess.call(['rm', '-rf', tmpdir])