From 11a33b1e82a43a4641b5418972db33be074ed695 Mon Sep 17 00:00:00 2001 From: Matteo Croce Date: Sep 14 2024 16:59:06 +0000 Subject: reflink: set metadata for hardlinked files RPM deduplicates identical files by creating them as hardlinks. Since metadata is shared between copies, permissions are set when extracting the last copy. This breaks reflinks, where each copy has its own metadata. Fix it by always set metadata when the file content is handled by a plugin. --- diff --git a/0038-reflink-set-metadata-for-hardlinked-files.patch b/0038-reflink-set-metadata-for-hardlinked-files.patch new file mode 100644 index 0000000..1b7c595 --- /dev/null +++ b/0038-reflink-set-metadata-for-hardlinked-files.patch @@ -0,0 +1,30 @@ +From 3310d203e0aa162428c7b9dc1e9d8e09da768608 Mon Sep 17 00:00:00 2001 +From: Matteo Croce +Date: Sat, 14 Sep 2024 09:32:48 -0700 +Subject: [PATCH] reflink: set metadata for hardlinked files + +RPM deduplicates identical files by creating them as hardlinks. +Since metadata is shared between copies, permissions are set when +extracting the last copy. +This breaks reflinks, where each copy has its own metadata. +Fix it by always set metadata when the file content is handled by a plugin. +--- + lib/fsm.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/lib/fsm.c b/lib/fsm.c +index 05c5bcf..e562220 100644 +--- a/lib/fsm.c ++++ b/lib/fsm.c +@@ -1010,6 +1010,8 @@ int rpmPackageFilesInstall(rpmts ts, rpmte te, rpmfiles files, + rc = plugin_rc; + } else if(plugin_rc == RPMRC_PLUGIN_CONTENTS){ + rc = RPMRC_OK; ++ /* The reflink plugins handles hardlink differently, metadata has to be set. */ ++ fp->setmeta = 1; + } else if (S_ISREG(fp->sb.st_mode)) { + if (rc == RPMERR_ENOENT) { + rc = fsmMkfile(di.dirfd, fi, fp, files, psm, nodigest, +-- +2.43.5 + diff --git a/rpm.spec b/rpm.spec index 388cdf2..66496fc 100644 --- a/rpm.spec +++ b/rpm.spec @@ -32,7 +32,7 @@ %global rpmver 4.16.1.3 #global snapver rc1 -%global rel 34.1 +%global rel 34.2 %global sover 9 %global srcver %{rpmver}%{?snapver:-%{snapver}} @@ -185,6 +185,7 @@ Patch9934: 0034-rpmcow-fix-issue-for-transaction-with-transcoded-and-untranscode Patch9935: 0035-rpmcow-fix-segfault-in-rpm2extents.patch Patch9936: 0036-bsearchr_static.patch Patch9937: 0037-plugin_path.patch +Patch9938: 0038-reflink-set-metadata-for-hardlinked-files.patch Provides: rpm(pr1470) Provides: rpm(pr1470_1) @@ -763,6 +764,9 @@ fi %doc doc/librpm/html/* %changelog +* Sat Sep 14 2024 Matteo Croce - 4.16.1.3-34.2 +- Fix deduplication error in RPM CoW + * Tue Aug 20 2024 Matteo Croce - 4.16.1.3-34.1 - Backport fix from upstream