From a69b6b869e4b73c6257e55b12dd2f574f5f3e0b8 Mon Sep 17 00:00:00 2001 From: yangxianzhao Date: Mon, 27 Nov 2023 17:48:59 +0800 Subject: [PATCH] Update to systemd-219-78.el7_9.8 --- ...duce-reference-counting-on-DnsStream.patch | 15 +- ...tream-while-calling-callbacks-for-it.patch | 7 +- ...r-Chase-symlinks-where-possible-6293.patch | 174 ++++++++++++++++++ dist | 1 - systemd.spec | 11 +- 5 files changed, 189 insertions(+), 19 deletions(-) rename 9001-resolve-introduce-reference-counting-on-DnsStream.patch => 0851-resolve-introduce-reference-counting-on-DnsStream.patch (93%) rename 9000-resolved-pin-stream-while-calling-callbacks-for-it.patch => 0852-resolved-pin-stream-while-calling-callbacks-for-it.patch (92%) create mode 100644 0853-fstab-generator-Chase-symlinks-where-possible-6293.patch delete mode 100644 dist diff --git a/9001-resolve-introduce-reference-counting-on-DnsStream.patch b/0851-resolve-introduce-reference-counting-on-DnsStream.patch similarity index 93% rename from 9001-resolve-introduce-reference-counting-on-DnsStream.patch rename to 0851-resolve-introduce-reference-counting-on-DnsStream.patch index 0a0c481..9b16434 100644 --- a/9001-resolve-introduce-reference-counting-on-DnsStream.patch +++ b/0851-resolve-introduce-reference-counting-on-DnsStream.patch @@ -1,4 +1,4 @@ -From d30e2a02f87a439367259c9f29abc80b989dae09 Mon Sep 17 00:00:00 2001 +From 47ef5ccd0edbff6610badc8c0f543f0e1d18bdc2 Mon Sep 17 00:00:00 2001 From: Michal Sekletar Date: Thu, 4 Aug 2022 11:11:58 +0200 Subject: [PATCH] resolve: introduce reference counting on DnsStream @@ -21,10 +21,10 @@ of that commit and leave everything else unchanged.] 4 files changed, 31 insertions(+), 12 deletions(-) diff --git a/src/resolve/resolved-dns-stream.c b/src/resolve/resolved-dns-stream.c -index f5faf154f2..1068a248ae 100644 +index 7f47e7223a..8d898b4819 100644 --- a/src/resolve/resolved-dns-stream.c +++ b/src/resolve/resolved-dns-stream.c -@@ -57,8 +57,8 @@ static int dns_stream_complete(DnsStream *s, int error) { +@@ -55,8 +55,8 @@ static int dns_stream_complete(DnsStream *s, int error) { if (s->complete) s->complete(s, error); @@ -35,7 +35,7 @@ index f5faf154f2..1068a248ae 100644 return 0; } -@@ -324,10 +324,16 @@ static int on_stream_io(sd_event_source *es, int fd, uint32_t revents, void *use +@@ -322,10 +322,16 @@ static int on_stream_io(sd_event_source *es, int fd, uint32_t revents, void *use return 0; } @@ -53,7 +53,7 @@ index f5faf154f2..1068a248ae 100644 dns_stream_stop(s); if (s->manager) { -@@ -340,14 +346,22 @@ DnsStream *dns_stream_free(DnsStream *s) { +@@ -338,14 +344,22 @@ DnsStream *dns_stream_free(DnsStream *s) { free(s); @@ -79,7 +79,7 @@ index f5faf154f2..1068a248ae 100644 int r; assert(m); -@@ -360,6 +374,7 @@ int dns_stream_new(Manager *m, DnsStream **ret, DnsProtocol protocol, int fd) { +@@ -358,6 +372,7 @@ int dns_stream_new(Manager *m, DnsStream **ret, DnsProtocol protocol, int fd) { if (!s) return -ENOMEM; @@ -163,6 +163,3 @@ index 173ab8a148..aa7aa68cab 100644 return 0; } --- -2.32.1 (Apple Git-133) - diff --git a/9000-resolved-pin-stream-while-calling-callbacks-for-it.patch b/0852-resolved-pin-stream-while-calling-callbacks-for-it.patch similarity index 92% rename from 9000-resolved-pin-stream-while-calling-callbacks-for-it.patch rename to 0852-resolved-pin-stream-while-calling-callbacks-for-it.patch index 2cfd925..02fbae9 100644 --- a/9000-resolved-pin-stream-while-calling-callbacks-for-it.patch +++ b/0852-resolved-pin-stream-while-calling-callbacks-for-it.patch @@ -1,4 +1,4 @@ -From 5b9f33c30309345738eedc226f6a667968949044 Mon Sep 17 00:00:00 2001 +From 420ffdb2b6c0d445b2f911cddfbee0a0d94c013d Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 4 Dec 2018 22:13:39 +0100 Subject: [PATCH] resolved: pin stream while calling callbacks for it @@ -16,7 +16,7 @@ Resolves: #2110544 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/resolve/resolved-dns-stream.c b/src/resolve/resolved-dns-stream.c -index 7f47e7223a..f5faf154f2 100644 +index 8d898b4819..1068a248ae 100644 --- a/src/resolve/resolved-dns-stream.c +++ b/src/resolve/resolved-dns-stream.c @@ -49,6 +49,8 @@ static int dns_stream_update_io(DnsStream *s) { @@ -37,6 +37,3 @@ index 7f47e7223a..f5faf154f2 100644 int r; assert(s); --- -2.37.1 - diff --git a/0853-fstab-generator-Chase-symlinks-where-possible-6293.patch b/0853-fstab-generator-Chase-symlinks-where-possible-6293.patch new file mode 100644 index 0000000..644af2c --- /dev/null +++ b/0853-fstab-generator-Chase-symlinks-where-possible-6293.patch @@ -0,0 +1,174 @@ +From a4c51f1bb38f272fb9c3dbaa33f1f383639ce345 Mon Sep 17 00:00:00 2001 +From: Colin Walters +Date: Tue, 11 Jul 2017 12:48:57 -0400 +Subject: [PATCH] fstab-generator: Chase symlinks where possible (#6293) + +This has a long history; see see 5261ba901845c084de5a8fd06500ed09bfb0bd80 +which originally introduced the behavior. Unfortunately that commit +doesn't include any rationale, but IIRC the basic issue is that +systemd wants to model the real mount state as units, and symlinks +make canonicalization much more difficult. + +At the same time, on a RHEL6 system (upstart), one can make e.g. `/home` a +symlink, and things work as well as they always did; but one doesn't have +access to the sophistication of mount units (dependencies, introspection, etc.) +Supporting symlinks here will hence make it easier for people to do upgrades to +RHEL7 and beyond. + +The `/home` as symlink case also appears prominently for OSTree; see +https://ostree.readthedocs.io/en/latest/manual/adapting-existing/ + +Further work has landed in the nspawn case for this; see e.g. +d944dc9553009822deaddec76814f5642a6a8176 + +A basic limitation with doing this in the fstab generator (and that I hit while +doing some testing) is that we obviously can't chase symlinks into mounts, +since the generator runs early before mounts. Or at least - doing so would +require multiple passes over the fstab data (as well as looking at existing +mount units), and potentially doing multi-phase generation. I'm not sure it's +worth doing that without a real world use case. For now, this will fix at least +the OSTree + `/home` case +mentioned above, and in general anyone who for whatever reason has symlinks in +their `/etc/fstab`. + +(cherry picked from commit 634735b56b82bdde3c67193ba7b470bab80fdcbd) + +Resolves: RHEL-6223 +--- + man/systemd-fstab-generator.xml | 8 +++++ + man/systemd.mount.xml | 5 ++-- + src/fstab-generator/fstab-generator.c | 42 ++++++++++++++++++++++----- + 3 files changed, 45 insertions(+), 10 deletions(-) + +diff --git a/man/systemd-fstab-generator.xml b/man/systemd-fstab-generator.xml +index bdc2dc1d0e..6f45c680cc 100644 +--- a/man/systemd-fstab-generator.xml ++++ b/man/systemd-fstab-generator.xml +@@ -71,6 +71,14 @@ + for more information about special /etc/fstab + mount options this generator understands. + ++ One special topic is handling of symbolic links. Historical init ++ implementations supported symlinks in /etc/fstab. ++ Because mount units will refuse mounts where the target is a symbolic link, ++ this generator will resolve any symlinks as far as possible when processing ++ /etc/fstab in order to enhance backwards compatibility. ++ If a symlink target does not exist at the time that this generator runs, it ++ is assumed that the symlink target is the final target of the mount. ++ + systemd-fstab-generator implements + systemd.generator7. + +diff --git a/man/systemd.mount.xml b/man/systemd.mount.xml +index 1590c44cec..5021db5584 100644 +--- a/man/systemd.mount.xml ++++ b/man/systemd.mount.xml +@@ -295,8 +295,9 @@ + + + Where= +- Takes an absolute path of a directory of the +- mount point. If the mount point does not exist at the time of ++ Takes an absolute path of a directory for the ++ mount point; in particular, the destination cannot be a symbolic ++ link. If the mount point does not exist at the time of + mounting, it is created. This string must be reflected in the + unit filename. (See above.) This option is + mandatory. +diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c +index 23b5457e43..91603b08f4 100644 +--- a/src/fstab-generator/fstab-generator.c ++++ b/src/fstab-generator/fstab-generator.c +@@ -240,6 +240,7 @@ static int write_idle_timeout(FILE *f, const char *where, const char *opts) { + static int add_mount( + const char *what, + const char *where, ++ const char *original_where, + const char *fstype, + const char *opts, + int passno, +@@ -327,12 +328,14 @@ static int add_mount( + } + + fprintf(f, +- "\n" ++ "\n" + "[Mount]\n" +- "What=%s\n" +- "Where=%s\n", +- what, +- where); ++ "What=%s\n", ++ what); ++ ++ if (original_where) ++ fprintf(f, "# Canonicalized from %s\n", original_where); ++ fprintf(f, "Where=%s\n", where); + + if (!isempty(fstype) && !streq(fstype, "auto")) + fprintf(f, "Type=%s\n", fstype); +@@ -436,7 +439,7 @@ static int parse_fstab(bool initrd) { + } + + while ((me = getmntent(f))) { +- _cleanup_free_ char *where = NULL, *what = NULL; ++ _cleanup_free_ char *where = NULL, *what = NULL, *canonical_where = NULL; + bool noauto, nofail; + int k; + +@@ -456,8 +459,28 @@ static int parse_fstab(bool initrd) { + if (!where) + return log_oom(); + +- if (is_path(where)) ++ if (is_path(where)) { + path_kill_slashes(where); ++ /* Follow symlinks here; see 5261ba901845c084de5a8fd06500ed09bfb0bd80 which makes sense for ++ * mount units, but causes problems since it historically worked to have symlinks in e.g. ++ * /etc/fstab. So we canonicalize here. Note that we use CHASE_NONEXISTENT to handle the case ++ * where a symlink refers to another mount target; this works assuming the sub-mountpoint ++ * target is the final directory. ++ */ ++ r = chase_symlinks(where, initrd ? "/sysroot" : NULL, ++ CHASE_PREFIX_ROOT | CHASE_NONEXISTENT, ++ &canonical_where); ++ if (r < 0) ++ /* In this case for now we continue on as if it wasn't a symlink */ ++ log_warning_errno(r, "Failed to read symlink target for %s: %m", where); ++ else { ++ if (streq(canonical_where, where)) ++ canonical_where = mfree(canonical_where); ++ else ++ log_debug("Canonicalized what=%s where=%s to %s", ++ what, where, canonical_where); ++ } ++ } + + noauto = fstab_test_yes_no_option(me->mnt_opts, "noauto\0" "auto\0"); + nofail = fstab_test_yes_no_option(me->mnt_opts, "nofail\0" "fail\0"); +@@ -482,7 +505,8 @@ static int parse_fstab(bool initrd) { + post = SPECIAL_LOCAL_FS_TARGET; + + k = add_mount(what, +- where, ++ canonical_where ?: where, ++ canonical_where ? where: NULL, + me->mnt_type, + me->mnt_opts, + me->mnt_passno, +@@ -526,6 +550,7 @@ static int add_sysroot_mount(void) { + log_debug("Found entry what=%s where=/sysroot type=%s", what, strna(arg_root_fstype)); + return add_mount(what, + "/sysroot", ++ NULL, + arg_root_fstype, + opts, + 1, +@@ -583,6 +608,7 @@ static int add_sysroot_usr_mount(void) { + log_debug("Found entry what=%s where=/sysroot/usr type=%s", what, strna(arg_usr_fstype)); + return add_mount(what, + "/sysroot/usr", ++ NULL, + arg_usr_fstype, + opts, + 1, diff --git a/dist b/dist deleted file mode 100644 index ad8eb77..0000000 --- a/dist +++ /dev/null @@ -1 +0,0 @@ -an7_9 diff --git a/systemd.spec b/systemd.spec index f1859e4..44be4bf 100644 --- a/systemd.spec +++ b/systemd.spec @@ -7,7 +7,7 @@ Name: systemd Url: http://www.freedesktop.org/wiki/Software/systemd Version: 219 -Release: 78%{?dist}.7 +Release: 78%{?dist}.8 # For a breakdown of the licensing, see README License: LGPLv2+ and MIT and GPLv2+ Summary: A System and Service Manager @@ -889,9 +889,9 @@ Patch0847: 0847-strv-fix-buffer-size-calculation-in-strv_join_quoted.patch Patch0848: 0848-install-refactor-find_symlinks-and-don-t-search-for-.patch Patch0849: 0849-install-fix-a-potential-crash.patch Patch0850: 0850-acl-util-only-set-the-mask-if-not-present.patch - -Patch9000: 9000-resolved-pin-stream-while-calling-callbacks-for-it.patch -Patch9001: 9001-resolve-introduce-reference-counting-on-DnsStream.patch +Patch0851: 0851-resolve-introduce-reference-counting-on-DnsStream.patch +Patch0852: 0852-resolved-pin-stream-while-calling-callbacks-for-it.patch +Patch0853: 0853-fstab-generator-Chase-symlinks-where-possible-6293.patch %global num_patches %{lua: c=0; for i,p in ipairs(patches) do c=c+1; end; print(c);} @@ -1869,6 +1869,9 @@ fi %{_mandir}/man8/systemd-resolved.* %changelog +* Tue Sep 26 2023 systemd maintenance team - 219-78.8 +- fstab-generator: Chase symlinks where possible (#6293) (RHEL-6223) + * Thu Aug 04 2022 systemd maintenance team - 219-78.7 - resolve: introduce reference counting on DnsStream (#2110544) -- Gitee