[packages/apparmor-parser] - rel 2; try to detect more cases when cache needs to be rebuild (not perfect)
arekm
arekm at pld-linux.org
Wed Jan 10 10:45:10 CET 2018
commit 70de829ea6ed5a2aacadc5461f2b88ff4ee7f5d6
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Wed Jan 10 10:45:00 2018 +0100
- rel 2; try to detect more cases when cache needs to be rebuild (not perfect)
apparmor-parser-cache-rebuild.patch | 42 +++++++++++++++++++++++++++++++++++++
apparmor-parser.spec | 5 ++++-
2 files changed, 46 insertions(+), 1 deletion(-)
---
diff --git a/apparmor-parser.spec b/apparmor-parser.spec
index 08d4622..4246aad 100644
--- a/apparmor-parser.spec
+++ b/apparmor-parser.spec
@@ -7,7 +7,7 @@ Summary: AppArmor userlevel parser utility
Summary(pl.UTF-8): Narzędzie przestrzeni użytkownika do przetwarzania AppArmor
Name: apparmor-parser
Version: 2.12
-Release: 1
+Release: 2
Epoch: 1
License: GPL v2
Group: Applications/System
@@ -15,6 +15,8 @@ Source0: http://launchpad.net/apparmor/2.12/%{version}.0/+download/apparmor-%{ve
# Source0-md5: 49054f58042f8e51ea92cc866575a833
Source1: %{name}.init
Patch0: %{name}-pld.patch
+# Drop when upstream does cache rebuild based on hash and not on mtime
+Patch1: %{name}-cache-rebuild.patch
URL: http://wiki.apparmor.net/
BuildRequires: bison
BuildRequires: flex
@@ -49,6 +51,7 @@ SubDomain.
%prep
%setup -q -n apparmor-%{version}
%patch0 -p0
+%patch1 -p1
%build
%{__make} -j1 -C parser \
diff --git a/apparmor-parser-cache-rebuild.patch b/apparmor-parser-cache-rebuild.patch
new file mode 100644
index 0000000..97954bc
--- /dev/null
+++ b/apparmor-parser-cache-rebuild.patch
@@ -0,0 +1,42 @@
+diff -ur apparmor-2.12.org/parser/parser_main.c apparmor-2.12/parser/parser_main.c
+--- apparmor-2.12.org/parser/parser_main.c 2017-12-24 09:48:31.000000000 +0100
++++ apparmor-2.12/parser/parser_main.c 2018-01-10 09:33:09.568033805 +0100
+@@ -811,6 +811,8 @@
+ skip_cache = 1;
+
+ if (cachename) {
++ cache_tstamp_final_check();
++
+ /* Load a binary cache if it exists and is newest */
+ if (cache_hit(cachename)) {
+ retval = process_binary(option, kernel_interface,
+diff -ur apparmor-2.12.org/parser/policy_cache.c apparmor-2.12/parser/policy_cache.c
+--- apparmor-2.12.org/parser/policy_cache.c 2017-12-24 09:48:31.000000000 +0100
++++ apparmor-2.12/parser/policy_cache.c 2018-01-10 09:30:27.533641865 +0100
+@@ -78,6 +78,15 @@
+ cache_tstamp = t;
+ }
+
++void cache_tstamp_final_check(void)
++{
++ if (tstamp_cmp(cache_tstamp, mru_policy_tstamp) != 0) {
++ if (debug_cache)
++ pwarn("%s: cache mtime is different than policy files mtimes\n", progname);
++ mru_skip_cache = 1;
++ }
++}
++
+ void update_mru_tstamp(FILE *file, const char *name)
+ {
+ struct stat stat_file;
+diff -ur apparmor-2.12.org/parser/policy_cache.h apparmor-2.12/parser/policy_cache.h
+--- apparmor-2.12.org/parser/policy_cache.h 2017-12-24 09:48:31.000000000 +0100
++++ apparmor-2.12/parser/policy_cache.h 2018-01-10 09:31:45.412419437 +0100
+@@ -39,6 +39,7 @@
+ extern int debug_cache;
+
+ void set_cache_tstamp(struct timespec t);
++void cache_tstamp_final_check(void);
+ void update_mru_tstamp(FILE *file, const char *path);
+ bool valid_cached_file_version(const char *cachename);
+ char *cache_filename(const char *cachedir, const char *basename);
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/apparmor-parser.git/commitdiff/70de829ea6ed5a2aacadc5461f2b88ff4ee7f5d6
More information about the pld-cvs-commit
mailing list