[apparmor] test-aa-easyprof.py fails because of UsrMove
Christian Boltz
apparmor at cboltz.de
Wed Mar 5 20:27:29 UTC 2014
Hello,
Am Dienstag, 4. März 2014 schrieb Kshitij Gupta:
> On Sat, Mar 1, 2014 at 3:41 AM, Christian Boltz wrote:
> > test-aa-easyprof.py depends on /bin/ls being a real binary.
> > In practise, it is a symlink to /usr/bin/ls on some distributions.
...
> @Christian
> With the patch from @Steve in place I don't get any errors.
> Do you still get these failures?
Steve's patch fixes the "path to ls" issue, but in a slightly different
way (and probably better, because it should also catch "/bin is a
symlink to /usr/bin" case)
Nevertheless, I still get the two errors I mentioned - but didn't have
time to debug it yet. (I'm just back from the annual carnival tour - I
drove a big float on 4 carnival parades in the last days and helped to
dismantle the float today.)
[some minutes later]
I finally applied Steve's small change to preserve the tempdirs (and
another one to tell me the used tempdir - BTW: is there a "clean" way to
do this? I had to abuse a "self.assertTrue(0 == 1, "tempdir %s" %
self.tempdir)" because a simple "print" didn't produce any screen
output.
The tempdirs of the two failing tests are attached, but I didn't look
into their content yet.
Hmm, thinking about it, it might also be a symlink issue:
The tempdirs are something like /tmp/test-aa-easyprofXXXXXX, and my /tmp
is a symlink to /home/sys-tmp/
Seems to be a good guess - after
=== modified file 'utils/test/test-aa-easyprof.py'
--- utils/test/test-aa-easyprof.py 2014-03-03 21:26:41 +0000
+++ utils/test/test-aa-easyprof.py 2014-03-05 20:15:49 +0000
@@ -108,7 +108,7 @@
'''Setup for tests'''
global topdir
- self.tmpdir = tempfile.mkdtemp(prefix='test-aa-easyprof')
+ self.tmpdir = tempfile.mkdtemp(prefix='test-aa-easyprof', dir='/home/sys-tmp/')
# Copy everything into place
for d in ['easyprof/policygroups', 'easyprof/templates']:
the tests don't fail anymore.
One more thing that breaks by /tmp being a symlink ;-)
I'll attach the tempdir content of the failed tests (without the dir=
added) nevertheless, in case someone wants to look into them.
Looks like we need os.path.realpath even for /tmp :-/
What about this patch?
=== modified file 'utils/test/test-aa-easyprof.py'
--- utils/test/test-aa-easyprof.py 2014-03-03 21:26:41 +0000
+++ utils/test/test-aa-easyprof.py 2014-03-05 20:19:49 +0000
@@ -108,7 +108,7 @@
'''Setup for tests'''
global topdir
- self.tmpdir = tempfile.mkdtemp(prefix='test-aa-easyprof')
+ self.tmpdir = tempfile.mkdtemp(prefix='test-aa-easyprof', dir=os.path.realpath('/tmp'))
# Copy everything into place
for d in ['easyprof/policygroups', 'easyprof/templates']:
It works for me, but I'm not sure if using the hardcoded /tmp is always
a good idea. (When not specifying dir=, environment variables like
TMPDIR are honored.)
Opinions? Acks? Naks? ;-)
Regards,
Christian Boltz
PS @Seth: yes, the whitespace was a bit broken - vim accidently isserted
a tab, which got displayed as 8 spaces in the "bzr diff" output. Add
copy&paste from konsole to the mail, and the tab is now "really" 8
spaces ;-) I should probably tell vim to always use "expandtab" in
python files...
(Just as a side note, now that Steve's patch is in.)
--
> The wiki is as much yours as it is ours, and if you think that
> someone deserves recognition by naming them, you don't need
> anybody's permission.
Then I must put my thanks to Bill Gates somewhere. he made me use
Linux. :-) [> Peter Flodin and houghi in opensuse-wiki]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test-aa-easyprof-failures.tar.gz
Type: application/x-compressed-tar
Size: 2454 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20140305/6f54426f/attachment.bin>
More information about the AppArmor
mailing list