Replace the objects/pack directory with an empty file to provoke an
ENOTDIR error from stat('objects/pack/.').
Previously the code changed the permissions of the test directory to
0000 in order to provoke an error other than ENOENT (i.e. EACCES), but
that doesn't work when the tests are run as root or fakeroot.
(As Gabriel Filion pointed out, the chmod of the testdir is no
longer necessary, so I removed it and squashed that into this patch.
-- apenwarr)
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
bup bup-* cmd/bup-* lib/bup/_version.py randomgen memtest \
out[12] out2[tc] tags[12] tags2[tc] \
testfs.img lib/bup/t/testfs.img
- [ -d lib/bup/t/pybuptest.tmp ] && chmod u+rwx lib/bup/t/pybuptest.tmp || true
rm -rf *.tmp t/*.tmp lib/*/*/*.tmp build lib/bup/build
if test -e testfs; then rmdir testfs; fi
if test -e lib/bup/t/testfs; then rmdir lib/bup/t/testfs; fi
git.check_repo_or_die()
WVPASS('check_repo_or_die') # if we reach this point the call above passed
- mode = os.stat('pybuptest.tmp').st_mode
- os.chmod('pybuptest.tmp', 0000)
+ os.rename('pybuptest.tmp/objects/pack', 'pybuptest.tmp/objects/pack.tmp')
+ open('pybuptest.tmp/objects/pack', 'w').close()
try:
git.check_repo_or_die()
except SystemExit, e:
WVPASSEQ(e.code, 14)
else:
WVFAIL()
- os.chmod('pybuptest.tmp', mode)
+ os.unlink('pybuptest.tmp/objects/pack')
+ os.rename('pybuptest.tmp/objects/pack.tmp', 'pybuptest.tmp/objects/pack')
try:
git.check_repo_or_die('nonexistantbup.tmp')