Michael Schröder 2018-02-14 10:55:30 +00:00 committed by Git OBS Bridge
parent 87becdafd6
commit 766d882a56

View File

@ -11,28 +11,48 @@
#define RPMFI_FLAGS_INSTALL \
--- lib/transaction.c.orig
+++ lib/transaction.c
@@ -412,6 +412,8 @@ static void handleInstInstalledFile(const rpmts ts, rpmte p, rpmfiles fi, int fx
@@ -231,11 +231,11 @@ static void rpmtsUpdateDSI(const rpmts ts, dev_t dev, const char *dirName,
dsi->bneeded += bneeded;
dsi->ineeded++;
if (prevSize) {
- dsi->bdelta += BLOCK_ROUND(prevSize, dsi->bsize);
+ dsi->bdelta += BLOCK_ROUND(prevSize - 1, dsi->bsize);
dsi->idelta++;
}
if (fixupSize) {
- dsi->bdelta += BLOCK_ROUND(fixupSize, dsi->bsize);
+ dsi->bdelta += BLOCK_ROUND(fixupSize - 1, dsi->bsize);
dsi->idelta++;
}
@@ -412,6 +412,9 @@ static void handleInstInstalledFile(const rpmts ts, rpmte p, rpmfiles fi, int fx
{
rpmfs fs = rpmteGetFileStates(p);
int isCfgFile = ((rpmfilesFFlags(otherFi, ofx) | rpmfilesFFlags(fi, fx)) & RPMFILE_CONFIG);
+ rpm_loff_t otherFileSize
+ int nlink;
+ const int *links;
if (XFA_SKIPPING(rpmfsGetAction(fs, fx)))
return;
@@ -481,7 +483,10 @@ static void handleInstInstalledFile(const rpmts ts, rpmte p, rpmfiles fi, int fx
@@ -481,7 +484,15 @@ static void handleInstInstalledFile(const rpmts ts, rpmte p, rpmfiles fi, int fx
}
}
- rpmfilesSetFReplacedSize(fi, fx, rpmfilesFSize(otherFi, ofx));
+ otherFileSize = rpmfilesFSize(otherFi, ofx);
+
+ /* Only account for the last file of a hardlink set */
+ nlink = rpmfilesFLinks(otherFi, ofx, &links);
+ if (nlink <= 1 || links[nlink - 1] == ofx)
+ rpmfilesSetFReplacedSize(fi, fx, rpmfilesFSize(otherFi, ofx));
+ if (nlink > 1 && links[nlink - 1] != ofx)
+ otherFileSize = 0;
+
+ /* Add one to make sure the size is not zero */
+ rpmfilesSetFReplacedSize(fi, fx, otherFileSize + 1);
}
/**
@@ -491,6 +496,7 @@ static void handleInstInstalledFile(const rpmts ts, rpmte p, rpmfiles fi, int fx
@@ -491,6 +502,7 @@ static void handleInstInstalledFile(const rpmts ts, rpmte p, rpmfiles fi, int fx
static void handleOverlappedFiles(rpmts ts, fingerPrintCache fpc, rpmte p, rpmfiles fi)
{
rpm_loff_t fixupSize = 0;
@ -40,7 +60,17 @@
int i, j;
rpmfs fs = rpmteGetFileStates(p);
rpmfs otherFs;
@@ -675,9 +681,16 @@ assert(otherFi != NULL);
@@ -628,7 +640,8 @@ assert(otherFi != NULL);
break;
/* Try to get the disk accounting correct even if a conflict. */
- fixupSize = rpmfilesFSize(otherFi, otherFileNum);
+ /* Add one to make sure the size is not zero */
+ fixupSize = rpmfilesFSize(otherFi, otherFileNum) + 1;
if (rpmfilesConfigConflict(fi, i)) {
/* Here is an overlapped pre-existing config file. */
@@ -675,9 +688,16 @@ assert(otherFi != NULL);
}
rpmfilesFree(otherFi);
@ -49,7 +79,7 @@
+ if (nlink > 1 && links[nlink - 1] != i) {
+ /* Only account for the last file of a hardlink set */
+ fileSize = 0;
+ fixupSize = 0;
+ fixupSize = fixupSize ? 1 : 0;
+ }
/* Update disk space info for a file. */
rpmtsUpdateDSI(ts, fpEntryDev(fpc, fiFps), fpEntryDir(fpc, fiFps),