rpm/rpm-4.12.0-payload-ghost.patch
Panu Matilainen 3feadd7134 - Skip ghost files in payload (#1156497)
- Fix size and archice size tag generation on big-endian systems
2014-10-28 11:19:13 +02:00

40 lines
1.1 KiB
Diff

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);