<div dir="ltr">Hello,<br><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Dec 26, 2015 at 10:06 PM, Christian Boltz <span dir="ltr"><<a href="mailto:apparmor@cboltz.de" target="_blank">apparmor@cboltz.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello,<br>
<br>
if a profile file contains multiple profiles, aa-mergeprof crashes on<br>
saving in write_profile() because the second profile in the file is not<br>
listed in 'changed'.<br>
<br>
This patch first checks if 'changed' contains the profile before<br>
pop()ing it.<br></blockquote><div>Assuming, this is because the second profile is actually not changing )looking at the in and out files, only comment was removed)/<br>I guess ideally we should probably have two lists of profiles for a file(changed and unchanged), to maintain that the profile is always processed and we may show this info elsewhere.<br> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Reproducer: copy utils/test/<a href="http://cleanprof_test.in" rel="noreferrer" target="_blank">cleanprof_test.in</a> to your profile directory<br>
and run   aa-mergeprof utils/test/cleanprof_test.out. Then just press<br>
's' to save the profile.<br>
<br>
<br>
I can reproduce this with trunk, 2.10 and 2.9 and therefore propose this<br>
patch for all these branches.<br>
<br>
<br>
[ 47-fix-multi-profile-mergeprof-crash.diff ]<br>
<br>
--- utils/apparmor/aa.py        2015-12-26 16:47:30.614839586 +0100<br>
+++ utils/apparmor/aa.py        2015-12-26 17:27:36.376228122 +0100<br>
@@ -4039,7 +4039,11 @@<br>
<br>
     os.rename(<a href="http://newprof.name" rel="noreferrer" target="_blank">newprof.name</a>, prof_filename)<br>
<br>
-    changed.pop(profile)<br>
+    if profile in changed:<br>
+        changed.pop(profile)<br>
+    else:<br>
+        debug_logger.error("%s written, but not listed in 'changed' list" % profile)<br>
+<br></blockquote><div>We may rephrase it to something like: "Unchanged/unlisted profile %s written to file" with a log level of warn?<br><br>With above nit-pick considered:<br><br>Acked-by: Kshitij Gupta <<a href="mailto:kgupta8592@gmail.com" target="_blank">kgupta8592@gmail.com</a>>  <br><br></div><div>for trunk, 2.10 and 2.9<br></div><div><br>Thanks for the patch.<br><div class=""><div id=":11q" class="" tabindex="0"><img class="" src="https://ssl.gstatic.com/ui/v1/icons/mail/images/cleardot.gif"></div></div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
     original_aa[profile] = deepcopy(aa[profile])<br>
<br>
 def matchliteral(aa_regexp, literal):<br>
<br>
<br>
Regards,<br>
<br>
Christian Boltz<br>
<span class=""><font color="#888888">--<br>
[Glaskugel?] Ich habe früher Aufsicht im Rechnerpool an der Uni gemacht.<br>
Irgendwie hat es die User beeindruckt, wenn ich Ihnen (ohne den Monitor<br>
einsehen zu können und ohne dass die User etwas gesagt hätten) erklärt<br>
habe, dass Word abstürzt, wenn man erst die Diskette entfernt und dann<br>
Word schließt. Das Laufwerksknurpsgeräusch und der Gesichtsausdruck der<br>
User war eindeutig genug... [Antje M. Bendrich in suse-linux]<br>
</font></span><br>--<br>
AppArmor mailing list<br>
<a href="mailto:AppArmor@lists.ubuntu.com">AppArmor@lists.ubuntu.com</a><br>
Modify settings or unsubscribe at: <a href="https://lists.ubuntu.com/mailman/listinfo/apparmor" rel="noreferrer" target="_blank">https://lists.ubuntu.com/mailman/listinfo/apparmor</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature"><div dir="ltr"><div>Regards,<br><br></div>Kshitij Gupta<br></div></div>
</div></div>