# no options, no cache, expect a miss and to write
$ /sbin/apparmor_parser -k --write-cache --cache-loc=/tmp/aa/cache --skip-kernel-load --add -- /tmp/aa/profiles
Cache: added primary location '/tmp/aa/cache'
Cache miss: /tmp/aa/profiles/sbin.dhclient
Wrote cache: /tmp/aa/cache/26b63962.0/sbin.dhclient
# no options, cache, expect a hit
$ /sbin/apparmor_parser -k --write-cache --cache-loc=/tmp/aa/cache --skip-kernel-load --add -- /tmp/aa/profiles
Cache: added primary location '/tmp/aa/cache'
Cache hit: /tmp/aa/cache/26b63962.0/sbin.dhclient
# reset
$ rm -rf /tmp/aa/cache/*
# no options, no cache, expect a miss and to write
$ /sbin/apparmor_parser -k --write-cache --cache-loc=/tmp/aa/cache --skip-kernel-load -O no-expr-simplify --add -- /tmp/aa/profiles
Cache: added primary location '/tmp/aa/cache'
Cache miss: /tmp/aa/profiles/sbin.dhclient
Wrote cache: /tmp/aa/cache/26b63962.0/sbin.dhclient
# no options, cache, expect a hit
$ /sbin/apparmor_parser -k --write-cache --cache-loc=/tmp/aa/cache --skip-kernel-load -O no-expr-simplify --add -- /tmp/aa/profiles
Cache: added primary location '/tmp/aa/cache'
Cache miss: /tmp/aa/profiles/sbin.dhclient # SHOULD BE A HIT
Wrote cache: /tmp/aa/cache/26b63962.0/sbin.dhclient
Same thing happens if omitting -O no-expr-simplify but add Optimize=no-expr-simplify to /etc/apparmor/parser.conf.
With 2.13.2 and the most recent testsuite patches from the 2.13 branch, I find that the cache works correctly when no options are specifying. Eg
# setup d/sbin. dhclient /tmp/aa/profiles/
$ mkdir -p /tmp/aa/cache /tmp/aa/profiles
$ cp /etc/apparmor.
# no options, no cache, expect a miss and to write parser -k --write-cache --cache- loc=/tmp/ aa/cache --skip-kernel-load --add -- /tmp/aa/profiles profiles/ sbin.dhclient cache/26b63962. 0/sbin. dhclient
$ /sbin/apparmor_
Cache: added primary location '/tmp/aa/cache'
Cache miss: /tmp/aa/
Wrote cache: /tmp/aa/
# no options, cache, expect a hit parser -k --write-cache --cache- loc=/tmp/ aa/cache --skip-kernel-load --add -- /tmp/aa/profiles cache/26b63962. 0/sbin. dhclient
$ /sbin/apparmor_
Cache: added primary location '/tmp/aa/cache'
Cache hit: /tmp/aa/
# reset
$ rm -rf /tmp/aa/cache/*
# no options, no cache, expect a miss and to write parser -k --write-cache --cache- loc=/tmp/ aa/cache --skip-kernel-load -O no-expr-simplify --add -- /tmp/aa/profiles profiles/ sbin.dhclient cache/26b63962. 0/sbin. dhclient
$ /sbin/apparmor_
Cache: added primary location '/tmp/aa/cache'
Cache miss: /tmp/aa/
Wrote cache: /tmp/aa/
# no options, cache, expect a hit parser -k --write-cache --cache- loc=/tmp/ aa/cache --skip-kernel-load -O no-expr-simplify --add -- /tmp/aa/profiles profiles/ sbin.dhclient # SHOULD BE A HIT cache/26b63962. 0/sbin. dhclient
$ /sbin/apparmor_
Cache: added primary location '/tmp/aa/cache'
Cache miss: /tmp/aa/
Wrote cache: /tmp/aa/
Same thing happens if omitting -O no-expr-simplify but add Optimize= no-expr- simplify to /etc/apparmor/ parser. conf.