RPMTAG_SIZE counter is broken a bit.
1) Duplicate file entries are not getting merged.
%install
mkdir -p %buildroot/foo
head -c 1024 /dev/zero >%buildroot/foo/1
%files
/foo/1
/foo/1
RPMTAG_SIZE == 2048.
2) File flags are not getting mreged.
%install
mkdir -p %buildroot/foo
head -c 1024 /dev/zero >%buildroot/foo/1
%files
/foo/1
%exclude /foo/1
RPMTAG_SIZE == 1024 (empty package).
3) Similar problems with %ghost files.
To fix the problem, RPMTAG_SIZE counter should be invoked after
file dups are merged. This means the code should be moved from
addFile() to genCpioListAndHeader().
--- rpm-5.1.3/build/files.c- 2008-04-06 12:47:47 +0400
+++ rpm-5.1.3/build/files.c 2008-06-16 07:16:45 +0400
@@ -1601,15 +1601,6 @@ if (!(_rpmbuildFlags & 4))
/*@=moduncon =noeffectuncon @*/
sxfn = _free(sxfn);
- ui32 = fl->totalFileSize;
- he->tag = RPMTAG_SIZE;
- he->t = RPM_UINT32_TYPE;
- he->p.ui32p = &ui32;
- he->c = 1;
- he->append = 1;
- xx = headerPut(h, he, 0);
- he->append = 0;
-
if (_rpmbuildFlags & 4) {
(void) rpmlibNeedsFeature(h, "PayloadFilesHavePrefix", "4.0-1");
(void) rpmlibNeedsFeature(h, "CompressedFileNames", "3.0.4-1");
@@ -1713,7 +1704,44 @@ if (_rpmbuildFlags & 4) {
if (isSrc)
fi->fmapflags[i] |= IOSM_FOLLOW_SYMLINKS;
+ if (S_ISREG(flp->fl_mode) && flp->fl_nlink == 1)
+ fl->totalFileSize += flp->fl_size;
+ else if (S_ISREG(flp->fl_mode) && flp->fl_nlink > 1) {
+ /* Hard links need be counted only once. */
+ FileListRec jlp;
+ int j;
+ int found = 0;
+ for (j = i+1, jlp = flp+1; (unsigned)j < fi->fc; j++, jlp++) {
+ while (((jlp - fl->fileList) < (fl->fileListRecsUsed - 1)) &&
+ !strcmp(jlp->fileURL, jlp[1].fileURL))
+ jlp++;
+ if (!S_ISREG(jlp->fl_mode))
+ continue;
+ if (flp->fl_nlink != jlp->fl_nlink)
+ continue;
+ if (flp->fl_ino != jlp->fl_ino)
+ continue;
+ if (flp->fl_dev != jlp->fl_dev)
+ continue;
+ if (jlp->flags & (RPMFILE_EXCLUDE | RPMFILE_GHOST))
+ continue;
+ found = 1;
+ break;
+ }
+ if (!found) /* last entry in hardlink set */
+ fl->totalFileSize += flp->fl_size;
+ }
}
+
+ ui32 = fl->totalFileSize;
+ he->tag = RPMTAG_SIZE;
+ he->t = RPM_UINT32_TYPE;
+ he->p.ui32p = &ui32;
+ he->c = 1;
+ he->append = 1;
+ xx = headerPut(h, he, 0);
+ he->append = 0;
+
/*@-compdef@*/
if (fip)
*fip = fi;
@@ -1947,26 +1975,6 @@ static int addFile(FileList fl, const ch
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)
- fl->totalFileSize += flp->fl_size;
}
fl->fileListRecsUsed++;
@@ -2758,8 +2766,6 @@ int processSourceFiles(Spec spec)
#endif
flp->langs = xstrdup("");
- fl.totalFileSize += flp->fl_size;
-
if (! (flp->uname && flp->gname)) {
rpmlog(RPMLOG_ERR, _("Bad owner/group: %s\n"), diskURL);
rc = fl.processingFailed = 1;
- application/pgp-signature attachment: stored
Received on Mon Jun 16 05:33:32 2008