public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Panu Matilainen <pmatilai@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/rpm] pmatilai-v6: - Skip ghost files in payload (#1156497)
Date: Mon, 23 Nov 2026 09:29:13 GMT	[thread overview]
Message-ID: <179542615350.1.17416144496222651585.rpms-rpm-3feadd7134f3@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : rpms/rpm
            Branch : pmatilai-v6
            Commit : 3feadd7134f30854676b716debc4e5e1e6de6bc9
            Author : Panu Matilainen <pmatilai@redhat.com>
            Date   : 2014-10-28T11:19:13+02:00
            Stats  : +124/-1 in 3 file(s)
            URL    : https://src.fedoraproject.org/rpms/rpm/c/3feadd7134f30854676b716debc4e5e1e6de6bc9?branch=pmatilai-v6

            Log:
            - Skip ghost files in payload (#1156497)
- Fix size and archice size tag generation on big-endian systems

---
diff --git a/rpm-4.12.0-archive-endian.patch b/rpm-4.12.0-archive-endian.patch
new file mode 100644
index 0000000..49839ff
--- /dev/null
+++ b/rpm-4.12.0-archive-endian.patch
@@ -0,0 +1,76 @@
+commit 104856ea17161eb3a508913c2b7ed701f2e4f6aa
+Author: Panu Matilainen <pmatilai@redhat.com>
+Date:   Tue Oct 7 15:37:21 2014 +0300
+
+    Unbreak size and archive size generation on big-endian systems
+    
+    - Fix regression from commit 68bddc353a7ea87ea00ad957858cd509e845e84c,
+      accessing a 64bit int as if it were a 32bit one doesn't make it one.
+
+diff --git a/build/pack.c b/build/pack.c
+index 28834dc..15f005a 100644
+--- a/build/pack.c
++++ b/build/pack.c
+@@ -273,9 +273,6 @@ static rpmRC generateSignature(char *SHA1, uint8_t *MD5, rpm_loff_t size,
+ {
+     Header sig = NULL;
+     struct rpmtd_s td;
+-    rpmTagVal sizetag;
+-    rpmTagVal payloadtag;
+-    rpm_tagtype_t typetag;
+     rpmRC rc = RPMRC_OK;
+     char *reservedSpace;
+     int spaceSize = 0;
+@@ -297,29 +294,33 @@ static rpmRC generateSignature(char *SHA1, uint8_t *MD5, rpm_loff_t size,
+     td.data = MD5;
+     headerPut(sig, &td, HEADERPUT_DEFAULT);
+ 
++    rpmtdReset(&td);
++    td.count = 1;
+     if (payloadSize < UINT32_MAX) {
+-	sizetag = RPMSIGTAG_SIZE;
+-	payloadtag = RPMSIGTAG_PAYLOADSIZE;
+-	typetag = RPM_INT32_TYPE;
++	rpm_off_t p = payloadSize;
++	rpm_off_t s = size;
++	td.type = RPM_INT32_TYPE;
++
++	td.tag = RPMSIGTAG_PAYLOADSIZE;
++	td.data = &p;
++	headerPut(sig, &td, HEADERPUT_DEFAULT);
++
++	td.tag = RPMSIGTAG_SIZE;
++	td.data = &s;
++	headerPut(sig, &td, HEADERPUT_DEFAULT);
+     } else {
+-	sizetag = RPMSIGTAG_LONGSIZE;
+-	payloadtag = RPMSIGTAG_LONGARCHIVESIZE;
+-	typetag = RPM_INT64_TYPE;
+-    }
++	rpm_loff_t p = payloadSize;
++	rpm_loff_t s = size;
++	td.type = RPM_INT64_TYPE;
+ 
+-    rpmtdReset(&td);
+-    td.tag = payloadtag;
+-    td.count = 1;
+-    td.type = typetag;
+-    td.data = &payloadSize;
+-    headerPut(sig, &td, HEADERPUT_DEFAULT);
++	td.tag = RPMSIGTAG_LONGARCHIVESIZE;
++	td.data = &p;
++	headerPut(sig, &td, HEADERPUT_DEFAULT);
+ 
+-    rpmtdReset(&td);
+-    td.tag = sizetag;
+-    td.count = 1;
+-    td.type = typetag;
+-    td.data = &size;
+-    headerPut(sig, &td, HEADERPUT_DEFAULT);
++	td.tag = RPMSIGTAG_LONGSIZE;
++	td.data = &s;
++	headerPut(sig, &td, HEADERPUT_DEFAULT);
++    }
+ 
+     spaceSize = rpmExpandNumeric("%{__gpg_reserved_space}");
+     if(spaceSize > 0) {

diff --git a/rpm-4.12.0-payload-ghost.patch b/rpm-4.12.0-payload-ghost.patch
new file mode 100644
index 0000000..a193b60
--- /dev/null
+++ b/rpm-4.12.0-payload-ghost.patch
@@ -0,0 +1,39 @@
+diff --git a/lib/rpmarchive.h b/lib/rpmarchive.h
+index fab2d58..85079ca 100644
+--- a/lib/rpmarchive.h
++++ b/lib/rpmarchive.h
+@@ -23,6 +23,7 @@ enum rpmfilesErrorCodes {
+ 	RPMERR_ENOENT		= -10,
+ 	RPMERR_ENOTEMPTY	= -11,
+ 	RPMERR_FILE_SIZE	= -12,
++	RPMERR_ITER_SKIP	= -13,
+ 
+ 	RPMERR_OPEN_FAILED	= -32768,
+ 	RPMERR_CHMOD_FAILED	= -32769,
+diff --git a/lib/rpmfi.c b/lib/rpmfi.c
+index 384a6c9..2fba707 100644
+--- a/lib/rpmfi.c
++++ b/lib/rpmfi.c
+@@ -821,7 +821,10 @@ int rpmfiNext(rpmfi fi)
+ {
+     int next = -1;
+     if (fi != NULL) {
+-	next = fi->next(fi);
++	do {
++	    next = fi->next(fi);
++	} while (next == RPMERR_ITER_SKIP);
++
+ 	if (next >= 0 && next < rpmfilesFC(fi->files)) {
+ 	    fi->i = next;
+ 	    fi->j = rpmfilesDI(fi->files, fi->i);
+@@ -1942,6 +1945,10 @@ static int iterReadArchiveNext(rpmfi fi)
+ 	rpm_loff_t fsize = 0;
+ 	rpm_mode_t mode = rpmfilesFMode(fi->files, fx);
+ 
++	/* %ghost in payload, should not be there but rpm < 4.11 sometimes did this */
++	if (rpmfilesFFlags(fi->files, fx) & RPMFILE_GHOST)
++	    return RPMERR_ITER_SKIP;
++
+ 	if (S_ISREG(mode)) {
+ 	    const int * links;
+ 	    uint32_t numlinks = rpmfilesFLinks(fi->files, fx, &links);

diff --git a/rpm.spec b/rpm.spec
index 36a80f2..35d2aea 100644
--- a/rpm.spec
+++ b/rpm.spec
@@ -27,7 +27,7 @@
 Summary: The RPM package management system
 Name: rpm
 Version: %{rpmver}
-Release: %{?snapver:0.%{snapver}.}2%{?dist}
+Release: %{?snapver:0.%{snapver}.}3%{?dist}
 Group: System Environment/Base
 Url: http://www.rpm.org/
 Source0: http://rpm.org/releases/rpm-4.12.x/%{name}-%{srcver}.tar.bz2
@@ -52,6 +52,10 @@ Patch5: rpm-4.12.0-rpm2cpio-hack.patch
 # Patches already upstream:
 # Dont wait for transaction lock inside scriptlets (#1135596)
 Patch100: rpm-4.12.0-tslock-nowait.patch
+# Skip ghosts in payload (#1156497)
+Patch101: rpm-4.12.0-payload-ghost.patch
+# Unbreak size tag generation on big-endian systems
+Patch102: rpm-4.12.0-archive-endian.patch
 
 # These are not yet upstream
 Patch302: rpm-4.7.1-geode-i686.patch
@@ -530,6 +534,10 @@ exit 0
 %doc doc/librpm/html/*
 
 %changelog
+* Tue Oct 28 2014 Panu Matilainen <pmatilai@redhat.com> - 4.12.0.1-3
+- Skip ghost files in payload (#1156497)
+- Fix size and archice size tag generation on big-endian systems
+
 * Wed Oct 01 2014 Panu Matilainen <pmatilai@redhat.com> - 4.12.0.1-2
 - Dont wait for transaction lock inside scriptlets (#1135596)
 

                 reply	other threads:[~2026-11-23  9:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179542615350.1.17416144496222651585.rpms-rpm-3feadd7134f3@fedoraproject.org \
    --to=pmatilai@redhat.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox