From c3bbe59bf02eec807d3feb5e42401ee3354d67251a153b469c36259d625c5273 Mon Sep 17 00:00:00 2001 From: "Dr. Werner Fink" Date: Thu, 18 Dec 2014 11:26:58 +0000 Subject: [PATCH] Accepting request 265723 from home:tsaupe update systemd-tmpfiles ignore statements code OBS-URL: https://build.opensuse.org/request/show/265723 OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=837 --- 0022-systemd-tmpfiles-ownerkeep.patch | 10 ---- systemd-add-user-keep.patch | 78 +++++++++++++++++++++++++++ systemd-mini.changes | 9 ++++ systemd-mini.spec | 10 ++-- systemd.changes | 9 ++++ systemd.spec | 10 ++-- 6 files changed, 104 insertions(+), 22 deletions(-) delete mode 100644 0022-systemd-tmpfiles-ownerkeep.patch create mode 100644 systemd-add-user-keep.patch diff --git a/0022-systemd-tmpfiles-ownerkeep.patch b/0022-systemd-tmpfiles-ownerkeep.patch deleted file mode 100644 index c7f3589b..00000000 --- a/0022-systemd-tmpfiles-ownerkeep.patch +++ /dev/null @@ -1,10 +0,0 @@ -diff -Naur systemd-208/units/systemd-tmpfiles-clean.service.in systemd-208-mod/units/systemd-tmpfiles-clean.service.in ---- systemd-208/units/systemd-tmpfiles-clean.service.in 2013-08-13 20:02:52.826756410 +0000 -+++ systemd-208-mod/units/systemd-tmpfiles-clean.service.in 2014-02-21 13:34:56.456511025 +0000 -@@ -19,5 +19,6 @@ - - [Service] - Type=oneshot -+ExecStart=-@rootbindir@/systemd-tmpfiles-keep - ExecStart=@rootbindir@/systemd-tmpfiles --clean - IOSchedulingClass=idle diff --git a/systemd-add-user-keep.patch b/systemd-add-user-keep.patch new file mode 100644 index 00000000..c1c06ba5 --- /dev/null +++ b/systemd-add-user-keep.patch @@ -0,0 +1,78 @@ +diff -Naur systemd-210/man/tmpfiles.d.xml systemd-210.mod/man/tmpfiles.d.xml +--- systemd-210/man/tmpfiles.d.xml 2014-12-18 09:40:29.403629407 +0100 ++++ systemd-210.mod/man/tmpfiles.d.xml 2014-12-18 10:34:06.274130934 +0100 +@@ -435,8 +435,12 @@ + f, F, + and w may be used to + specify a short string that is written to the +- file, suffixed by a newline. Ignored for all +- other lines. ++ file, suffixed by a newline. ++ For x, X ++ a comma separated list of usernames. If given, ++ only paths belonging to these users will be ++ excluded during directory cleanup. ++ Ignored for all other lines. + + + +diff -Naur systemd-210/src/tmpfiles/tmpfiles.c systemd-210.mod/src/tmpfiles/tmpfiles.c +--- systemd-210/src/tmpfiles/tmpfiles.c 2014-12-18 09:40:29.342629177 +0100 ++++ systemd-210.mod/src/tmpfiles/tmpfiles.c 2014-12-18 11:58:16.686576974 +0100 +@@ -263,6 +263,7 @@ + struct timespec times[2]; + bool deleted = false; + int r = 0; ++ Item *found = NULL; + + while ((dent = readdir(d))) { + struct stat s; +@@ -306,11 +307,43 @@ + } + + /* Is there an item configured for this path? */ +- if (hashmap_get(items, sub_path)) +- continue; +- +- if (find_glob(globs, sub_path)) +- continue; ++ found = hashmap_get(items, sub_path); ++ ++ if (!found) ++ found = find_glob(globs, sub_path); ++ ++ if (found) { ++ /* evaluate username arguments in ignore statements */ ++ if (found->type == IGNORE_PATH || found->type == IGNORE_DIRECTORY_PATH) { ++ if (!found->argument) ++ continue; ++ else { ++ struct passwd *pw; ++ char *userfound = NULL, *args = strdup(found->argument); ++ bool match = false; ++ int uid = -1; ++ ++ while ((userfound = strsep(&args, ","))) { ++ pw = getpwnam(userfound); ++ ++ if (!pw) ++ log_error("Unknown user '%s' in ignore statement.", userfound); ++ else { ++ uid = pw->pw_uid; ++ if (s.st_uid == uid) { ++ match = true; ++ break; ++ } ++ } ++ } ++ if (match) { ++ found = NULL; ++ continue; ++ } ++ } ++ } else ++ continue; ++ } + + if (S_ISDIR(s.st_mode)) { + diff --git a/systemd-mini.changes b/systemd-mini.changes index 5964f329..d2bbccbf 100644 --- a/systemd-mini.changes +++ b/systemd-mini.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Wed Dec 17 14:57:42 UTC 2014 - thomas.blume@suse.com + +- remove 0022-systemd-tmpfiles-ownerkeep.patch since this is now + implemented into the systemd-tmpfiles binary +- add user based ignore statements in tmpfiles removal directives + (bnc#903009) + add systemd-add-user-keep.patch + ------------------------------------------------------------------- Tue Dec 16 09:45:38 UTC 2014 - thomas.blume@suse.com diff --git a/systemd-mini.spec b/systemd-mini.spec index 8ddf7e23..7bfb5876 100644 --- a/systemd-mini.spec +++ b/systemd-mini.spec @@ -42,7 +42,6 @@ %bcond_with udevsettle %endif %bcond_with systemgrps -%{expand: %%global has_tmpkeep %(type -p systemd-tmpfiles-keep &>/dev/null && echo 1 || echo 0)} Name: systemd-mini Url: http://www.freedesktop.org/wiki/Software/systemd @@ -396,8 +395,6 @@ Patch181: 0018-Make-LSB-Skripts-know-about-Required-and-Should.patch Patch182: 0019-make-completion-smart-to-be-able-to-redirect.patch # PATCH-FIX-SUSE 0001-add-network-device-after-NFS-mount-units.patch werner@suse.com Patch183: 0001-add-network-device-after-NFS-mount-units.patch -# PATCH-FIX-SUSE 0022-systemd-tmpfiles-ownerkeep.patch -Patch184: 0022-systemd-tmpfiles-ownerkeep.patch # PATCH-FIX-SUSE systemd-powerd-initctl-support.patch Patch185: systemd-powerd-initctl-support.patch # PATCH-FIX-SUSE systemctl-set-default-target.patch @@ -1062,6 +1059,9 @@ Patch517: 0004-core-fix-transaction-destructiveness-check-once-more.patch Patch518: 0001-units-tmpfiles-setup-dev-allow-unsafe-file-creation-.patch # PATCH-FIX-UPSTREAM added at 2014/12/16 Patch519: 0002-man-tmpfiles.d-recommend-using-b-and-c.patch +# PATCH-FIX-SUSE systemd-add-user-keep.patch (bnc#903009) +Patch520: systemd-add-user-keep.patch +# # UDEV PATCHES # ============ @@ -1605,9 +1605,6 @@ cp %{SOURCE7} m4/ %patch181 -p1 %patch182 -p1 %patch183 -p1 -%if 0%{?has_tmpkeep} -%patch184 -p1 -%endif %patch185 -p1 %patch186 -p1 %patch187 -p1 @@ -1943,6 +1940,7 @@ cp %{SOURCE7} m4/ %patch517 -p0 %patch518 -p1 %patch519 -p1 +%patch520 -p1 # udev patches %patch1001 -p1 diff --git a/systemd.changes b/systemd.changes index 5964f329..d2bbccbf 100644 --- a/systemd.changes +++ b/systemd.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Wed Dec 17 14:57:42 UTC 2014 - thomas.blume@suse.com + +- remove 0022-systemd-tmpfiles-ownerkeep.patch since this is now + implemented into the systemd-tmpfiles binary +- add user based ignore statements in tmpfiles removal directives + (bnc#903009) + add systemd-add-user-keep.patch + ------------------------------------------------------------------- Tue Dec 16 09:45:38 UTC 2014 - thomas.blume@suse.com diff --git a/systemd.spec b/systemd.spec index 90fcb1f9..01feb14d 100644 --- a/systemd.spec +++ b/systemd.spec @@ -40,7 +40,6 @@ %bcond_with udevsettle %endif %bcond_with systemgrps -%{expand: %%global has_tmpkeep %(type -p systemd-tmpfiles-keep &>/dev/null && echo 1 || echo 0)} Name: systemd Url: http://www.freedesktop.org/wiki/Software/systemd @@ -391,8 +390,6 @@ Patch181: 0018-Make-LSB-Skripts-know-about-Required-and-Should.patch Patch182: 0019-make-completion-smart-to-be-able-to-redirect.patch # PATCH-FIX-SUSE 0001-add-network-device-after-NFS-mount-units.patch werner@suse.com Patch183: 0001-add-network-device-after-NFS-mount-units.patch -# PATCH-FIX-SUSE 0022-systemd-tmpfiles-ownerkeep.patch -Patch184: 0022-systemd-tmpfiles-ownerkeep.patch # PATCH-FIX-SUSE systemd-powerd-initctl-support.patch Patch185: systemd-powerd-initctl-support.patch # PATCH-FIX-SUSE systemctl-set-default-target.patch @@ -1057,6 +1054,9 @@ Patch517: 0004-core-fix-transaction-destructiveness-check-once-more.patch Patch518: 0001-units-tmpfiles-setup-dev-allow-unsafe-file-creation-.patch # PATCH-FIX-UPSTREAM added at 2014/12/16 Patch519: 0002-man-tmpfiles.d-recommend-using-b-and-c.patch +# PATCH-FIX-SUSE systemd-add-user-keep.patch (bnc#903009) +Patch520: systemd-add-user-keep.patch +# # UDEV PATCHES # ============ @@ -1600,9 +1600,6 @@ cp %{SOURCE7} m4/ %patch181 -p1 %patch182 -p1 %patch183 -p1 -%if 0%{?has_tmpkeep} -%patch184 -p1 -%endif %patch185 -p1 %patch186 -p1 %patch187 -p1 @@ -1938,6 +1935,7 @@ cp %{SOURCE7} m4/ %patch517 -p0 %patch518 -p1 %patch519 -p1 +%patch520 -p1 # udev patches %patch1001 -p1