[apparmor] Patch: Replace smartmatch operator in AppArmor.pm to fix experimental issue in Perl5.18

Kshitij Gupta kgupta8592 at gmail.com
Fri Aug 23 08:42:30 UTC 2013


Hello,

A previous bugreport [1] was fixed using the smartmatch operator,
which raised the minimum Perl version requirement to >=5.10.1 .
However in Perl5.18 the smartmatch operator has again become
"experimental" [2] so the following patch replace smartmatch operator
with grep and thereby avoiding the requirement hike and avoiding
warnings.

--- AppArmor.pm.old    2013-08-23 13:53:12.541915111 +0530
+++ AppArmor.pm    2013-08-23 13:54:00.477913694 +0530
@@ -3879,7 +3879,7 @@
                                             $newpath =~ s/\/[^\/]+$/\/\*/;
                                         }
                                     }
-                                    if (not $newpath ~~ @options) {
+                                    if (not grep { $newpath eq $_ } @options) {
                                         push @options, $newpath;
                                         $defaultoption = $#options + 1;
                                     }
@@ -3896,7 +3896,7 @@
                                     } else {
                                         $newpath =~
s/\/[^\/]+(\.[^\/]+)$/\/\*$1/;
                                     }
-                                    if (not $newpath ~~ @options) {
+                                    if (not grep { $newpath eq $_ } @options) {
                                         push @options, $newpath;
                                         $defaultoption = $#options + 1;
                                     }

Regards,
Kshitij Gupta

[1] https://bugs.launchpad.net/apparmor/+bug/1180230

[2] http://blogs.perl.org/users/mike_b/2013/06/a-little-nicer-way-to-use-smartmatch-on-perl-518.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: new_patch
Type: application/octet-stream
Size: 1136 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20130823/954500a3/attachment.obj>


More information about the AppArmor mailing list