rpms/rpm/F-11 rpm-4.7.0-hardlink-sizes.patch, NONE, 1.1 rpm.spec, 1.349, 1.350

Panu Matilainen pmatilai at fedoraproject.org
Thu Jun 18 15:56:39 UTC 2009


Author: pmatilai

Update of /cvs/pkgs/rpms/rpm/F-11
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv24486

Modified Files:
	rpm.spec 
Added Files:
	rpm-4.7.0-hardlink-sizes.patch 
Log Message:
- fix hardlink size calculation on build (#503020)


rpm-4.7.0-hardlink-sizes.patch:

--- NEW FILE rpm-4.7.0-hardlink-sizes.patch ---
commit cdfd0934841d4eccc26d7da7c35b23e6e9f76a9c
Author: Panu Matilainen <pmatilai at 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.


Index: rpm.spec
===================================================================
RCS file: /cvs/pkgs/rpms/rpm/F-11/rpm.spec,v
retrieving revision 1.349
retrieving revision 1.350
diff -u -p -r1.349 -r1.350
--- rpm.spec	18 Jun 2009 15:52:23 -0000	1.349
+++ rpm.spec	18 Jun 2009 15:56:07 -0000	1.350
@@ -46,6 +46,7 @@ Patch3: rpm-4.6.0-fedora-specspo.patch
 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
@@ -190,6 +191,7 @@ that will manipulate RPM packages and da
 %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
@@ -407,6 +409,7 @@ exit 0
 - fix find-lang --with-kde with KDE3 (#466009)
 - fix pgp pubkey signature tag parsing
 - don't mess up problem altNEVR in python ts.check() (#501068)
+- fix hardlink size calculation on build (#503020)
 
 * Thu Apr 16 2009 Panu Matilainen <pmatilai at redhat.com> - 4.7.0-1
 - update to 4.7.0 final (http://rpm.org/wiki/Releases/4.7.0)




More information about the fedora-extras-commits mailing list