public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Panu Matilainen <pmatilai@fedoraproject.org>
To: git-commits@fedoraproject.org
Subject: [rpms/rpm] pmatilai-v6: - don't mess up problem altNEVR in python ts.check() (#501068)
Date: Mon, 23 Nov 2026 09:25:56 GMT	[thread overview]
Message-ID: <179542595630.1.7719332196800492147.rpms-rpm-61937a9d765d@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : rpms/rpm
            Branch : pmatilai-v6
            Commit : 61937a9d765df068fc5d67d49511c829e72977d6
            Author : Panu Matilainen <pmatilai@fedoraproject.org>
            Date   : 2009-06-03T13:38:58+00:00
            Stats  : +146/-1 in 3 file(s)
            URL    : https://src.fedoraproject.org/rpms/rpm/c/61937a9d765df068fc5d67d49511c829e72977d6?branch=pmatilai-v6

            Log:
            - don't mess up problem altNEVR in python ts.check() (#501068)
- fix hardlink size calculation on build (#503020)

---
diff --git a/rpm-4.7.0-hardlink-sizes.patch b/rpm-4.7.0-hardlink-sizes.patch
new file mode 100644
index 0000000..487b86d
--- /dev/null
+++ b/rpm-4.7.0-hardlink-sizes.patch
@@ -0,0 +1,98 @@
+commit cdfd0934841d4eccc26d7da7c35b23e6e9f76a9c
+Author: Panu Matilainen <pmatilai@redhat.com>
+Date:   Fri May 29 09:02:44 2009 +0300
+
+    Fix calculation of hardlinked files (RhBug:503020)
+    - regression from commit 899dfb58927ec6e91014773430824462f4d0002e,
+      size of hardlinked file set is the size of one file of the set
+    - add isHardLink() internal helper to avoid a copy-paste code
+
+diff --git a/build/files.c b/build/files.c
+index ef60ae2..98abedd 100644
+--- a/build/files.c
++++ b/build/files.c
+@@ -981,6 +981,14 @@ static int isDoc(FileList fl, const char * fileName)
+     return 0;
+ }
+ 
++static int isHardLink(FileListRec flp, FileListRec tlp)
++{
++    return ((S_ISREG(flp->fl_mode) && S_ISREG(tlp->fl_mode)) &&
++	    ((flp->fl_nlink > 1) && (flp->fl_nlink == tlp->fl_nlink)) &&
++	    (flp->fl_ino == tlp->fl_ino) && 
++	    (flp->fl_dev == tlp->fl_dev));
++}
++
+ /**
+  * Verify that file attributes scope over hardlinks correctly.
+  * If partial hardlink sets are possible, then add tracking dependency.
+@@ -999,14 +1007,18 @@ static int checkHardLinks(FileList fl)
+ 
+ 	for (j = i + 1; j < fl->fileListRecsUsed; j++) {
+ 	    jlp = fl->fileList + j;
+-	    if (!S_ISREG(jlp->fl_mode))
+-		continue;
+-	    if (ilp->fl_nlink != jlp->fl_nlink)
+-		continue;
+-	    if (ilp->fl_ino != jlp->fl_ino)
+-		continue;
+-	    if (ilp->fl_dev != jlp->fl_dev)
+-		continue;
++	    if (isHardLink(ilp, jlp)) {
++		return 1;
++	    }
++	}
++    }
++    return 0;
++}
++
++static int seenHardLink(FileList fl, FileListRec flp)
++{
++    for (FileListRec ilp = fl->fileList; ilp < flp; ilp++) {
++	if (isHardLink(flp, ilp)) {
+ 	    return 1;
+ 	}
+     }
+@@ -1147,9 +1159,12 @@ static void genCpioListAndHeader(FileList fl,
+ 	    rpm_off_t rsize32 = (rpm_off_t)flp->fl_size;
+ 	    headerPutUint32(h, RPMTAG_FILESIZES, &rsize32, 1);
+ 	}
+-	/* Excludes and dupes have been filtered out by now */
+-	if (S_ISREG(flp->fl_mode))
+-	    totalFileSize += flp->fl_size;
++	/* Excludes and dupes have been filtered out by now. */
++	if (S_ISREG(flp->fl_mode)) {
++	    if (flp->fl_nlink == 1 || !seenHardLink(fl, flp)) {
++		totalFileSize += flp->fl_size;
++	    }
++	}
+ 	
+ 	/*
+  	 * For items whose size varies between systems, always explicitly 
+@@ -1492,25 +1507,7 @@ static rpmRC addFile(FileList fl, const char * diskPath,
+ 	flp->specdFlags = fl->currentSpecdFlags;
+ 	flp->verifyFlags = fl->currentVerifyFlags;
+ 
+-	/* Hard links need be counted only once. */
+-	if (S_ISREG(flp->fl_mode) && flp->fl_nlink > 1) {
+-	    FileListRec ilp;
+-	    for (i = 0;  i < fl->fileListRecsUsed; i++) {
+-		ilp = fl->fileList + i;
+-		if (!S_ISREG(ilp->fl_mode))
+-		    continue;
+-		if (flp->fl_nlink != ilp->fl_nlink)
+-		    continue;
+-		if (flp->fl_ino != ilp->fl_ino)
+-		    continue;
+-		if (flp->fl_dev != ilp->fl_dev)
+-		    continue;
+-		break;
+-	    }
+-	} else
+-	    i = fl->fileListRecsUsed;
+-
+-	if (!(flp->flags & RPMFILE_EXCLUDE) && S_ISREG(flp->fl_mode) && i >= fl->fileListRecsUsed) {
++	if (!(flp->flags & RPMFILE_EXCLUDE) && S_ISREG(flp->fl_mode)) {
+ 	    /*
+ 	     * XXX Simple and stupid check for now, this needs to be per-payload
+ 	     * format check once we have other payloads than good 'ole cpio.

diff --git a/rpm-4.7.0-python-altnevr.patch b/rpm-4.7.0-python-altnevr.patch
new file mode 100644
index 0000000..1626fed
--- /dev/null
+++ b/rpm-4.7.0-python-altnevr.patch
@@ -0,0 +1,39 @@
+commit 9322f737819a3d81088699b1d7fa667259245411
+Author: Panu Matilainen <pmatilai@redhat.com>
+Date:   Tue May 19 10:26:50 2009 +0300
+
+    Don't mess up problem altNEVR in python ts.check() (rhbz#501068)
+    - the use of strrchr() silently casts away the const from the problem
+      set altNEVR string, which we then happily modify..
+    - similar to commit 62cc76e25cdfad78ac30bb28f626b474efdecddc
+
+diff --git a/python/rpmts-py.c b/python/rpmts-py.c
+index e56e001..9877fbc 100644
+--- a/python/rpmts-py.c
++++ b/python/rpmts-py.c
+@@ -365,7 +365,7 @@ fprintf(stderr, "*** rpmts_Check(%p) ts %p cb %p\n", s, s->ts, cbInfo.cb);
+ 
+ 	/* XXX TODO: rpmlib >= 4.0.3 can return multiple suggested keys. */
+ 	while ((i = rpmpsNextIterator(psi)) >= 0) {
+-	    const char * needsName;
++	    char * altNEVR, * needsName;
+ 	    char * byName, * byVersion, * byRelease, *byArch;
+ 	    char * needsOP, * needsVersion;
+ 	    rpmsenseFlags needsFlags, sense;
+@@ -383,7 +383,7 @@ fprintf(stderr, "*** rpmts_Check(%p) ts %p cb %p\n", s, s->ts, cbInfo.cb);
+ 
+ 	    key = rpmProblemGetKey(p);
+ 
+-	    needsName = rpmProblemGetAltNEVR(p);
++	    altNEVR = needsName = xstrdup(rpmProblemGetAltNEVR(p));
+ 	    if (needsName[1] == ' ') {
+ 		sense = (needsName[0] == 'C')
+ 			? RPMDEP_SENSE_CONFLICTS : RPMDEP_SENSE_REQUIRES;
+@@ -409,6 +409,7 @@ fprintf(stderr, "*** rpmts_Check(%p) ts %p cb %p\n", s, s->ts, cbInfo.cb);
+ 	    PyList_Append(list, (PyObject *) cf);
+ 	    Py_DECREF(cf);
+ 	    free(byName);
++	    free(altNEVR);
+ 	}
+ 
+ 	psi = rpmpsFreeIterator(psi);

diff --git a/rpm.spec b/rpm.spec
index afd5f9d..b837abc 100644
--- a/rpm.spec
+++ b/rpm.spec
@@ -21,7 +21,7 @@
 Summary: The RPM package management system
 Name: rpm
 Version: %{rpmver}
-Release: 4%{?dist}
+Release: 5%{?dist}
 Group: System Environment/Base
 Url: http://www.rpm.org/
 Source0: http://rpm.org/releases/testing/%{name}-%{srcver}.tar.bz2
@@ -41,6 +41,8 @@ Patch3: rpm-4.6.0-fedora-specspo.patch
 # Patches already in upstream
 Patch200: rpm-4.7.0-findlang-kde3.patch
 Patch201: rpm-4.7.0-prtsig.patch
+Patch202: rpm-4.7.0-python-altnevr.patch
+Patch203: rpm-4.7.0-hardlink-sizes.patch
 
 # These are not yet upstream
 Patch300: rpm-4.7.0-extra-provides.patch
@@ -194,6 +196,8 @@ packages on a system.
 
 %patch200 -p1 -b .findlang-kde3
 %patch201 -p1 -b .prtsig
+%patch202 -p1 -b .py-altnevr
+%patch203 -p1 -b .hardlink-sizes
 
 %patch300 -p1 -b .extra-prov
 %patch301 -p1 -b .niagara
@@ -408,6 +412,10 @@ exit 0
 %doc doc/librpm/html/*
 
 %changelog
+* Tue Jun 03 2009 Panu Matilainen <pmatilai@redhat.com> - 4.7.0-5
+- don't mess up problem altNEVR in python ts.check() (#501068)
+- fix hardlink size calculation on build (#503020)
+
 * Thu May 14 2009 Panu Matilainen <pmatilai@redhat.com> - 4.7.0-4
 - split cron-job into a sub-package to avoid silly deps on core rpm (#500722)
 - rpm requires coreutils but not in %%post

                 reply	other threads:[~2026-11-23  9:25 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=179542595630.1.7719332196800492147.rpms-rpm-61937a9d765d@fedoraproject.org \
    --to=pmatilai@fedoraproject.org \
    --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