From c65b72f7b18e110dcb002dbf5789cfeaf9633d2f Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Mon, 28 Nov 2022 11:35:51 -0500 Subject: [PATCH] Cherry pick https://github.com/coreos/rpm-ostree/pull/4166 --- ...st-Handle-existing-absolute-symlinks.patch | 42 +++++++++++++++++++ rpm-ostree.spec | 7 +++- 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 0001-composepost-Handle-existing-absolute-symlinks.patch diff --git a/0001-composepost-Handle-existing-absolute-symlinks.patch b/0001-composepost-Handle-existing-absolute-symlinks.patch new file mode 100644 index 0000000..7e2d1ff --- /dev/null +++ b/0001-composepost-Handle-existing-absolute-symlinks.patch @@ -0,0 +1,42 @@ +From 37ae5546dad6df1897cc3d903add5cecd09bc47f Mon Sep 17 00:00:00 2001 +From: Colin Walters +Date: Thu, 24 Nov 2022 12:56:37 -0500 +Subject: [PATCH] composepost: Handle existing absolute symlinks + +Regression from cap-std porting around absolute symlinks *again*. +The `try_exists()` API will follow symlinks, which is not what +we want here. + +This was hit in the fedora-iot builds. +--- + rust/src/composepost.rs | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/rust/src/composepost.rs b/rust/src/composepost.rs +index bbe49a2e..77dfcc07 100644 +--- a/rust/src/composepost.rs ++++ b/rust/src/composepost.rs +@@ -344,13 +344,18 @@ fn compose_postprocess_units(rootfs_dfd: &Dir, treefile: &mut Treefile) -> Resul + + for unit in units { + let dest = multiuser_wants.join(unit); +- if rootfs_dfd.try_exists(&dest)? { ++ if rootfs_dfd ++ .symlink_metadata_optional(&dest) ++ .with_context(|| format!("Querying {unit}"))? ++ .is_some() ++ { + continue; + } + + println!("Adding {} to multi-user.target.wants", unit); + let target = format!("/usr/lib/systemd/system/{unit}"); +- cap_primitives::fs::symlink_contents(target, &rootfs_dfd.as_filelike_view(), dest)?; ++ cap_primitives::fs::symlink_contents(target, &rootfs_dfd.as_filelike_view(), dest) ++ .with_context(|| format!("Linking {unit}"))?; + } + Ok(()) + } +-- +2.38.1 + diff --git a/rpm-ostree.spec b/rpm-ostree.spec index cc97c7e..9562624 100644 --- a/rpm-ostree.spec +++ b/rpm-ostree.spec @@ -4,13 +4,15 @@ Summary: Hybrid image/package system Name: rpm-ostree Version: 2022.16 -Release: 1%{?dist} +Release: 2%{?dist} License: LGPLv2+ URL: https://github.com/coreos/rpm-ostree # This tarball is generated via "cd packaging && make -f Makefile.dist-packaging dist-snapshot" # in the upstream git. It also contains vendored Rust sources. Source0: https://github.com/coreos/rpm-ostree/releases/download/v%{version}/rpm-ostree-%{version}.tar.xz +Patch0: 0001-composepost-Handle-existing-absolute-symlinks.patch + ExclusiveArch: %{rust_arches} BuildRequires: make @@ -247,6 +249,9 @@ $PYTHON autofiles.py > files.devel \ %files devel -f files.devel %changelog +* Mon Nov 28 2022 Colin Walters - 2022.16-2 +- Cherry pick https://github.com/coreos/rpm-ostree/pull/4166 + * Fri Nov 18 2022 Jonathan Lebon - 2022.16-1 - https://github.com/coreos/rpm-ostree/releases/tag/v2022.16