summaryrefslogtreecommitdiff
path: root/backport-Consolidate-skipped-hardlink-with-content-case-with-.patch
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-09-10 03:05:12 +0000
committerCoprDistGit <infra@openeuler.org>2023-09-10 03:05:12 +0000
commit2bc2b430bc4c1a9a0bfd1c01da68bd53bf7da052 (patch)
treea2af4fd609c7decacbf0ea11926ea338596fb179 /backport-Consolidate-skipped-hardlink-with-content-case-with-.patch
parent0ae9f87336a3d78d8fbc0a1e5c75cba5f9cf8597 (diff)
automatic import of rpm
Diffstat (limited to 'backport-Consolidate-skipped-hardlink-with-content-case-with-.patch')
-rw-r--r--backport-Consolidate-skipped-hardlink-with-content-case-with-.patch56
1 files changed, 56 insertions, 0 deletions
diff --git a/backport-Consolidate-skipped-hardlink-with-content-case-with-.patch b/backport-Consolidate-skipped-hardlink-with-content-case-with-.patch
new file mode 100644
index 0000000..e992dca
--- /dev/null
+++ b/backport-Consolidate-skipped-hardlink-with-content-case-with-.patch
@@ -0,0 +1,56 @@
+From cc22fc694d30a64862f0b16d137deaab5416382d Mon Sep 17 00:00:00 2001
+From: Panu Matilainen <pmatilai@redhat.com>
+Date: Fri, 11 Feb 2022 13:05:45 +0200
+Subject: [PATCH] Consolidate skipped hardlink with content case with the
+ others
+
+Handling this in a separate clause makes the logic much clearer and
+(in theory at least) lets us handle hardlinks to any content, not
+just regular files.
+---
+ lib/fsm.c | 20 ++++++++++----------
+ 1 file changed, 10 insertions(+), 10 deletions(-)
+
+diff --git a/lib/fsm.c b/lib/fsm.c
+index ec6ee2c..82610c7 100644
+--- a/lib/fsm.c
++++ b/lib/fsm.c
+@@ -832,9 +832,18 @@ int rpmPackageFilesInstall(rpmts ts, rpmte te, rpmfiles files,
+ while (!rc && (fx = rpmfiNext(fi)) >= 0) {
+ struct filedata_s *fp = &fdata[fx];
+
++ /*
++ * Tricksy case: this file is a being skipped, but it's part of
++ * a hardlinked set and has the actual content linked with it.
++ * Write the content to the first non-skipped file of the set
++ * instead.
++ */
++ if (fp->skip && firstlink && rpmfiArchiveHasContent(fi))
++ fp = firstlink;
++
+ if (!fp->skip) {
+ /* Directories replacing something need early backup */
+- if (!fp->suffix) {
++ if (!fp->suffix && fp != firstlink) {
+ rc = fsmBackup(fi, fp->action);
+ }
+
+@@ -904,15 +913,6 @@ int rpmPackageFilesInstall(rpmts ts, rpmte te, rpmfiles files,
+ if (!IS_DEV_LOG(fp->fpath))
+ rc = RPMERR_UNKNOWN_FILETYPE;
+ }
+- } else if (firstlink && rpmfiArchiveHasContent(fi)) {
+- /*
+- * Tricksy case: this file is a being skipped, but it's part of
+- * a hardlinked set and has the actual content linked with it.
+- * Write the content to the first non-skipped file of the set
+- * instead.
+- */
+- rc = fsmMkfile(fi, firstlink, files, psm, nodigest,
+- &firstlink, &firstlinkfile);
+ }
+
+ /* Notify on success. */
+--
+1.8.3.1
+