11a33b
From 3310d203e0aa162428c7b9dc1e9d8e09da768608 Mon Sep 17 00:00:00 2001
11a33b
From: Matteo Croce <teknoraver@meta.com>
11a33b
Date: Sat, 14 Sep 2024 09:32:48 -0700
11a33b
Subject: [PATCH] reflink: set metadata for hardlinked files
11a33b
11a33b
RPM deduplicates identical files by creating them as hardlinks.
11a33b
Since metadata is shared between copies, permissions are set when
11a33b
extracting the last copy.
11a33b
This breaks reflinks, where each copy has its own metadata.
11a33b
Fix it by always set metadata when the file content is handled by a plugin.
11a33b
---
11a33b
 lib/fsm.c | 2 ++
11a33b
 1 file changed, 2 insertions(+)
11a33b
11a33b
diff --git a/lib/fsm.c b/lib/fsm.c
11a33b
index 05c5bcf..e562220 100644
11a33b
--- a/lib/fsm.c
11a33b
+++ b/lib/fsm.c
11a33b
@@ -1010,6 +1010,8 @@ int rpmPackageFilesInstall(rpmts ts, rpmte te, rpmfiles files,
11a33b
 		rc = plugin_rc;
11a33b
 	    } else if(plugin_rc == RPMRC_PLUGIN_CONTENTS){
11a33b
 		rc = RPMRC_OK;
11a33b
+		/* The reflink plugins handles hardlink differently, metadata has to be set. */
11a33b
+		fp->setmeta = 1;
11a33b
 	    } else if (S_ISREG(fp->sb.st_mode)) {
11a33b
 		if (rc == RPMERR_ENOENT) {
11a33b
 		    rc = fsmMkfile(di.dirfd, fi, fp, files, psm, nodigest,
11a33b
-- 
11a33b
2.43.5
11a33b