diff --git a/build/files.c b/build/files.c index 9dc5281..15d6baf 100644 --- a/build/files.c +++ b/build/files.c @@ -1074,10 +1074,18 @@ static void genCpioListAndHeader(FileList fl, if (sizeof(flp->fl_size) != sizeof(rpm_off_t)) { rpm_off_t psize = (rpm_off_t)flp->fl_size; - (void) headerAddOrAppendEntry(h, RPMTAG_FILESIZES, RPM_INT32_TYPE, + (void) headerAddOrAppendEntry(h, RPMTAG_OLDFILESIZES, RPM_INT32_TYPE, &(psize), 1); } else { - (void) headerAddOrAppendEntry(h, RPMTAG_FILESIZES, RPM_INT32_TYPE, + (void) headerAddOrAppendEntry(h, RPMTAG_OLDFILESIZES, RPM_INT32_TYPE, + &(flp->fl_size), 1); + } + if (sizeof(flp->fl_size) != sizeof(rpm_loff_t)) { + rpm_loff_t psize = (rpm_loff_t)flp->fl_size; + (void) headerAddOrAppendEntry(h, RPMTAG_NEWFILESIZES, RPM_INT64_TYPE, + &(psize), 1); + } else { + (void) headerAddOrAppendEntry(h, RPMTAG_NEWFILESIZES, RPM_INT64_TYPE, &(flp->fl_size), 1); } (void) headerAddOrAppendEntry(h, RPMTAG_FILEUSERNAME, RPM_STRING_ARRAY_TYPE, diff --git a/lib/backend/sqlite.c b/lib/backend/sqlite.c index 994b53b..3f54bb0 100644 --- a/lib/backend/sqlite.c +++ b/lib/backend/sqlite.c @@ -80,14 +80,17 @@ struct _sql_dbcursor_s { }; union _dbswap { - unsigned int ui; - unsigned char uc[4]; + uint64_t ul; + uint32_t ui[2]; + uint8_t uc[8]; }; #define _DBSWAP(_a) \ { unsigned char _b, *_c = (_a).uc; \ - _b = _c[3]; _c[3] = _c[0]; _c[0] = _b; \ - _b = _c[2]; _c[2] = _c[1]; _c[1] = _b; \ + _b = _c[7]; _c[7] = _c[0]; _c[0] = _b; \ + _b = _c[6]; _c[6] = _c[1]; _c[1] = _b; \ + _b = _c[5]; _c[5] = _c[2]; _c[2] = _b; \ + _b = _c[4]; _c[4] = _c[3]; _c[3] = _b; \ } static const unsigned int endian = 0x11223344; @@ -368,9 +371,10 @@ fprintf(stderr, "\t%d %s %s %d\n", i, cname, vtype, v); if (dbiByteSwapped(dbi) == 1) { union _dbswap dbswap; - memcpy(&dbswap.ui, scp->av[scp->ac], sizeof(dbswap.ui)); + memcpy(dbswap.ui, scp->av[scp->ac], sizeof(dbswap.ui)); + dbswap.ui[1] = 0; _DBSWAP(dbswap); - memcpy(scp->av[scp->ac], &dbswap.ui, sizeof(dbswap.ui)); + memcpy(scp->av[scp->ac], dbswap.ui, sizeof(dbswap.ui)); } scp->ac++; } @@ -448,9 +452,10 @@ assert(key->size == sizeof(int32_t)); if (dbiByteSwapped(dbi) == 1) { - memcpy(&dbswap.ui, &hnum, sizeof(dbswap.ui)); + memcpy(dbswap.ui, &hnum, sizeof(dbswap.ui)); + dbswap.ui[1] = 0; _DBSWAP(dbswap); - memcpy(&hnum, &dbswap.ui, sizeof(dbswap.ui)); + memcpy(&hnum, dbswap.ui, sizeof(dbswap.ui)); } rc = sqlite3_bind_int(scp->pStmt, pos, hnum); } break; @@ -476,17 +481,30 @@ assert(dbiByteSwapped(dbi) == 0); /* Byte swap?! */ rc = sqlite3_bind_int(scp->pStmt, pos, i); } break; case RPM_INT32_TYPE: -/* case RPM_INT64_TYPE: */ default: - { unsigned int i; + { uint32_t i; assert(key->size == sizeof(int32_t)); memcpy(&i, key->data, sizeof(i)); if (dbiByteSwapped(dbi) == 1) { - memcpy(&dbswap.ui, &i, sizeof(dbswap.ui)); + memcpy(dbswap.ui, &i, sizeof(dbswap.ui)); + dbswap.ui[1] = 0; _DBSWAP(dbswap); - memcpy(&i, &dbswap.ui, sizeof(dbswap.ui)); + memcpy(&i, dbswap.ui, sizeof(dbswap.ui)); +} + rc = sqlite3_bind_int(scp->pStmt, pos, i); + } break; + case RPM_INT64_TYPE: + { uint64_t l; +assert(key->size == sizeof(int64_t)); + memcpy(&l, key->data, sizeof(l)); + +if (dbiByteSwapped(dbi) == 1) +{ + memcpy(&dbswap.ul, &l, sizeof(dbswap.ul)); + _DBSWAP(dbswap); + memcpy(&l, &dbswap.ul, sizeof(dbswap.ul)); } rc = sqlite3_bind_int(scp->pStmt, pos, i); } break; @@ -638,7 +656,7 @@ static int sql_initDB(dbiIndex dbi) case RPM_INT8_TYPE: case RPM_INT16_TYPE: case RPM_INT32_TYPE: -/* case RPM_INT64_TYPE: */ + case RPM_INT64_TYPE: keytype = "int UNIQUE"; break; case RPM_STRING_TYPE: diff --git a/lib/header.c b/lib/header.c index fce6880..e3b3569 100644 --- a/lib/header.c +++ b/lib/header.c @@ -55,7 +55,7 @@ static const int typeSizes[16] = { 1, /*!< RPM_INT8_TYPE */ 2, /*!< RPM_INT16_TYPE */ 4, /*!< RPM_INT32_TYPE */ - -1, /*!< RPM_INT64_TYPE */ + 8, /*!< RPM_INT64_TYPE */ -1, /*!< RPM_STRING_TYPE */ 1, /*!< RPM_BIN_TYPE */ -1, /*!< RPM_STRING_ARRAY_TYPE */ @@ -448,6 +448,15 @@ static int regionSwab(indexEntry entry, int il, int dl, /* Perform endian conversions */ switch (ntohl(pe->type)) { + case RPM_INT64_TYPE: + { uint64_t * it = (uint64_t *)t; + for (; ie.info.count > 0; ie.info.count--, it += 1) { + if (dataEnd && ((unsigned char *)it) >= dataEnd) + return -1; + *it = htonll(*it); + } + t = (unsigned char *) it; + } break; case RPM_INT32_TYPE: { int32_t * it = (int32_t *)t; for (; ie.info.count > 0; ie.info.count--, it += 1) { @@ -689,6 +698,16 @@ static void * doHeaderUnload(Header h, /* copy data w/ endian conversions */ switch (entry->info.type) { + case RPM_INT64_TYPE: + count = entry->info.count; + src = entry->data; + while (count--) { + *((uint64_t *)te) = htonll(*((uint64_t *)src)); + te += sizeof(uint64_t); + src += sizeof(uint64_t); + } + break; + case RPM_INT32_TYPE: count = entry->info.count; src = entry->data; diff --git a/lib/header_internal.c b/lib/header_internal.c index 73d1c66..864f5d3 100644 --- a/lib/header_internal.c +++ b/lib/header_internal.c @@ -9,6 +9,14 @@ #include "debug.h" +uint64_t htonll( uint64_t n ) { + uint32_t *i = (uint32_t*)&n; + uint32_t b = i[0]; + i[0] = htonl(i[1]); + i[1] = htonl(b); + return n; +} + char ** headerGetLangs(Header h) { char **s, *e, **table; @@ -63,7 +71,9 @@ void headerDump(Header h, FILE *f, int flags) case RPM_INT32_TYPE: type = "INT32"; break; - /*case RPM_INT64_TYPE: type = "INT64"; break;*/ + case RPM_INT64_TYPE: + type = "INT64"; + break; case RPM_STRING_TYPE: type = "STRING"; break; diff --git a/lib/header_internal.h b/lib/header_internal.h index f679ae7..3aaeca8 100644 --- a/lib/header_internal.h +++ b/lib/header_internal.h @@ -94,6 +94,14 @@ extern "C" { #endif /** \ingroup header + * Conver a 64bit value to network byte order. + * @param n a number + * @return number in network byte order + */ +uint64_t htonll( uint64_t n ); + +char ** headerGetLangs(Header h); +/** \ingroup header * Return array of locales found in header. * The array is terminated with a NULL sentinel. * @param h header diff --git a/lib/query.c b/lib/query.c index fc59261..fd91072 100644 --- a/lib/query.c +++ b/lib/query.c @@ -27,13 +27,13 @@ /** */ static void printFileInfo(const char * name, - rpm_off_t size, unsigned short mode, + rpm_loff_t size, unsigned short mode, unsigned int mtime, unsigned short rdev, unsigned int nlink, const char * owner, const char * group, const char * linkto) { - char sizefield[15]; + char sizefield[21]; char ownerfield[8+1], groupfield[8+1]; char timefield[100]; time_t when = mtime; /* important if sizeof(int32_t) ! sizeof(time_t) */ @@ -54,7 +54,7 @@ static void printFileInfo(const char * name, rstrlcpy(groupfield, group, sizeof(groupfield)); /* this is normally right */ - sprintf(sizefield, "%12u", size); + snprintf(sizefield, sizeof(sizefield), "%20lu", size); /* this knows too much about dev_t */ @@ -135,7 +135,7 @@ int showQueryPackage(QVA_t qva, rpmts ts, Header h) unsigned short frdev; rpm_time_t fmtime; rpmfileState fstate; - rpm_off_t fsize; + rpm_loff_t flsize; const char * fn; const char * fuser; const char * fgroup; @@ -148,7 +148,7 @@ int showQueryPackage(QVA_t qva, rpmts ts, Header h) frdev = rpmfiFRdev(fi); fmtime = rpmfiFMtime(fi); fstate = rpmfiFState(fi); - fsize = rpmfiFSize(fi); + flsize = rpmfiFLSize(fi); fn = rpmfiFN(fi); fuser = rpmfiFUser(fi); fgroup = rpmfiFGroup(fi); @@ -196,8 +196,8 @@ int showQueryPackage(QVA_t qva, rpmts ts, Header h) if (qva->qva_flags & QUERY_FOR_DUMPFILES) { char *add, *fdigest; fdigest = rpmfiFDigestHex(fi, NULL); - rasprintf(&add, "%s %d %d %s 0%o ", - fn, (int)fsize, fmtime, fdigest ? fdigest : "", fmode); + rasprintf(&add, "%s %llu %d %s 0%o ", + fn, flsize, fmtime, fdigest ? fdigest : "", fmode); rstrcat(&buf, add); free(add); free(fdigest); @@ -227,14 +227,14 @@ int showQueryPackage(QVA_t qva, rpmts ts, Header h) /* XXX Adjust directory link count and size for display output. */ if (S_ISDIR(fmode)) { fnlink++; - fsize = 0; + flsize = 0; } if (fuser && fgroup) { if (buf) { rpmlog(RPMLOG_NOTICE, "%s", buf); } - printFileInfo(fn, fsize, fmode, fmtime, frdev, fnlink, + printFileInfo(fn, flsize, fmode, fmtime, frdev, fnlink, fuser, fgroup, flink); } else { rpmlog(RPMLOG_ERR, diff --git a/lib/rpmfi.c b/lib/rpmfi.c index 8461136..ec14a7c 100644 --- a/lib/rpmfi.c +++ b/lib/rpmfi.c @@ -229,6 +229,17 @@ rpm_off_t rpmfiFSize(rpmfi fi) return fsize; } +rpm_loff_t rpmfiFLSize(rpmfi fi) +{ + rpm_loff_t flsize = 0; + + if (fi != NULL && fi->i >= 0 && fi->i < fi->fc) { + if (fi->flsizes != NULL) + flsize = fi->flsizes[fi->i]; + } + return flsize; +} + rpm_rdev_t rpmfiFRdev(rpmfi fi) { rpm_rdev_t frdev = 0; @@ -1131,6 +1142,7 @@ fprintf(stderr, "*** fi %p\t%s[%d]\n", fi, fi->Type, fi->fc); fi->fflags = _constfree(fi->fflags); fi->vflags = _constfree(fi->vflags); fi->fsizes = _constfree(fi->fsizes); + fi->flsizes = _constfree(fi->flsizes); fi->frdevs = _constfree(fi->frdevs); fi->finodes = _constfree(fi->finodes); fi->dil = _free(fi->dil); @@ -1157,6 +1169,7 @@ fprintf(stderr, "*** fi %p\t%s[%d]\n", fi, fi->Type, fi->fc); fi->actions = _free(fi->actions); fi->replacedSizes = _free(fi->replacedSizes); + fi->replacedLSizes = _free(fi->replacedLSizes); fi->replaced = _free(fi->replaced); fi->h = headerFree(fi->h); @@ -1242,7 +1255,8 @@ rpmfi rpmfiNew(const rpmts ts, Header h, rpmTag tagN, int scareMem) xx = hge(h, RPMTAG_FILEMODES, NULL, (rpm_data_t *) &fi->fmodes, NULL); xx = hge(h, RPMTAG_FILEFLAGS, NULL, (rpm_data_t *) &fi->fflags, NULL); xx = hge(h, RPMTAG_FILEVERIFYFLAGS, NULL, (rpm_data_t *) &fi->vflags, NULL); - xx = hge(h, RPMTAG_FILESIZES, NULL, (rpm_data_t *) &fi->fsizes, NULL); + xx = hge(h, RPMTAG_OLDFILESIZES, NULL, (rpm_data_t *) &fi->fsizes, NULL); + xx = hge(h, RPMTAG_NEWFILESIZES, NULL, (rpm_data_t *) &fi->flsizes, NULL); xx = hge(h, RPMTAG_FILECOLORS, NULL, (rpm_data_t *) &fi->fcolors, NULL); fi->color = 0; @@ -1311,7 +1325,7 @@ if (fi->actions == NULL) xx = hge(h, RPMTAG_FILERDEVS, NULL, (rpm_data_t *) &fi->frdevs, NULL); xx = hge(h, RPMTAG_FILEINODES, NULL, (rpm_data_t *) &fi->finodes, NULL); - fi->replacedSizes = xcalloc(fi->fc, sizeof(*fi->replacedSizes)); + fi->replacedLSizes = xcalloc(fi->fc, sizeof(*fi->replacedLSizes)); xx = hge(h, RPMTAG_FILEUSERNAME, NULL, (rpm_data_t *) &fi->fuser, NULL); xx = hge(h, RPMTAG_FILEGROUPNAME, NULL, (rpm_data_t *) &fi->fgroup, NULL); @@ -1339,6 +1353,7 @@ if (fi->actions == NULL) _fdupe(fi, frdevs); _fdupe(fi, finodes); _fdupe(fi, fsizes); + _fdupe(fi, flsizes); _fdupe(fi, fflags); _fdupe(fi, vflags); _fdupe(fi, fmodes); diff --git a/lib/rpmfi.h b/lib/rpmfi.h index 072bc78..738a4ba 100644 --- a/lib/rpmfi.h +++ b/lib/rpmfi.h @@ -249,6 +249,13 @@ const char * rpmfiFLink(rpmfi fi); rpm_off_t rpmfiFSize(rpmfi fi); /** \ingroup rpmfi + * Return current long (64bit) file size from file info set. + * @param fi file info set + * @return current 64bit file size, 0 on invalid + */ +rpm_loff_t rpmfiFLSize(rpmfi fi); + +/** \ingroup rpmfi * Return current file rdev from file info set. * @param fi file info set * @return current file rdev, 0 on invalid diff --git a/lib/rpmfi_internal.h b/lib/rpmfi_internal.h index 647f973..71fb289 100644 --- a/lib/rpmfi_internal.h +++ b/lib/rpmfi_internal.h @@ -44,6 +44,8 @@ struct rpmfi_s { /*?null?*/ const rpm_off_t * fsizes; /*!< File size(s) (from header) */ /*?null?*/ + const rpm_loff_t * flsizes; /*!< Long (64bit) file size(s) (from header) */ +/*?null?*/ const rpm_time_t * fmtimes; /*!< File modification time(s) (from header) */ /*?null?*/ rpm_mode_t * fmodes; /*!< File mode(s) (from header) */ @@ -120,6 +122,7 @@ struct rpmfi_s { rpm_color_t color; /*!< Color bit(s) from file color union. */ sharedFileInfo replaced; /*!< (TR_ADDED) */ rpm_off_t * replacedSizes; /*!< (TR_ADDED) */ + rpm_loff_t * replacedLSizes;/*!< (TR_ADDED) */ unsigned int record; /*!< (TR_REMOVED) */ int magic; #define RPMFIMAGIC 0x09697923 diff --git a/lib/rpmps.c b/lib/rpmps.c index 92bf8bd..6afd819 100644 --- a/lib/rpmps.c +++ b/lib/rpmps.c @@ -18,7 +18,7 @@ struct rpmProblem_s { rpmProblemType type; int ignoreProblem; char * str1; - unsigned long ulong1; + uint64_t ulonglong1; }; /** @@ -153,12 +153,12 @@ void rpmpsAppendProblem(rpmps ps, rpmProblem prob) void rpmpsAppend(rpmps ps, rpmProblemType type, const char * pkgNEVR, fnpyKey key, const char * dn, const char * bn, - const char * altNEVR, unsigned long ulong1) + const char * altNEVR, uint64_t ulonglong1) { rpmProblem p = NULL; if (ps == NULL) return; - p = rpmProblemCreate(type, pkgNEVR, key, dn, bn, altNEVR, ulong1); + p = rpmProblemCreate(type, pkgNEVR, key, dn, bn, altNEVR, ulonglong1); rpmpsAppendProblem(ps, p); } @@ -213,14 +213,14 @@ rpmProblem rpmProblemCreate(rpmProblemType type, fnpyKey key, const char * dn, const char * bn, const char * altNEVR, - unsigned long ulong1) + uint64_t ulonglong1) { rpmProblem p = xcalloc(1, sizeof(*p)); char *t; p->type = type; p->key = key; - p->ulong1 = ulong1; + p->ulonglong1 = ulonglong1; p->ignoreProblem = 0; p->pkgNEVR = (pkgNEVR ? xstrdup(pkgNEVR) : NULL); @@ -271,9 +271,9 @@ const char * rpmProblemGetStr(const rpmProblem p) return (p->str1); } -unsigned long rpmProblemGetLong(const rpmProblem p) +uint64_t rpmProblemGetLongLong(const rpmProblem p) { - return (p->ulong1); + return (p->ulonglong1); } char * rpmProblemString(const rpmProblem prob) @@ -319,28 +319,28 @@ char * rpmProblemString(const rpmProblem prob) break; case RPMPROB_DISKSPACE: rc = rasprintf(&buf, - _("installing package %s needs %ld%cB on the %s filesystem"), + _("installing package %s needs %llu%cB on the %s filesystem"), pkgNEVR, - prob->ulong1 > (1024*1024) - ? (prob->ulong1 + 1024 * 1024 - 1) / (1024 * 1024) - : (prob->ulong1 + 1023) / 1024, - prob->ulong1 > (1024*1024) ? 'M' : 'K', + prob->ulonglong1 > (1024*1024) + ? (prob->ulonglong1 + 1024 * 1024 - 1) / (1024 * 1024) + : (prob->ulonglong1 + 1023) / 1024, + prob->ulonglong1 > (1024*1024) ? 'M' : 'K', str1); break; case RPMPROB_DISKNODES: rc = rasprintf(&buf, - _("installing package %s needs %ld inodes on the %s filesystem"), - pkgNEVR, (long)prob->ulong1, str1); + _("installing package %s needs %lld inodes on the %s filesystem"), + pkgNEVR, (int64_t)prob->ulonglong1, str1); break; case RPMPROB_REQUIRES: rc = rasprintf(&buf, _("%s is needed by %s%s"), altNEVR+2, - (prob->ulong1 ? "" : _("(installed) ")), pkgNEVR); + (prob->ulonglong1 ? "" : _("(installed) ")), pkgNEVR); break; case RPMPROB_CONFLICT: rc = rasprintf(&buf, _("%s conflicts with %s%s"), altNEVR+2, - (prob->ulong1 ? "" : _("(installed) ")), pkgNEVR); + (prob->ulonglong1 ? "" : _("(installed) ")), pkgNEVR); break; default: rc = rasprintf(&buf, @@ -366,7 +366,7 @@ static int sameProblem(const rpmProblem ap, const rpmProblem bp) if (bp->str1 && strcmp(ap->str1, bp->str1)) return 1; - if (ap->ulong1 != bp->ulong1) + if (ap->ulonglong1 != bp->ulonglong1) return 1; return 0; diff --git a/lib/rpmps.h b/lib/rpmps.h index f0d5783..c0b0e63 100644 --- a/lib/rpmps.h +++ b/lib/rpmps.h @@ -68,7 +68,7 @@ typedef enum rpmProblemType_e { * @param dn directory name * @param bn file base name * @param altNEVR related (e.g. through a dependency) package name - * @param ulong1 generic pointer/long attribute + * @param ulonglong1 generic pointer/long attribute * @return rpmProblem */ rpmProblem rpmProblemCreate(rpmProblemType type, @@ -76,7 +76,7 @@ rpmProblem rpmProblemCreate(rpmProblemType type, fnpyKey key, const char * dn, const char * bn, const char * altNEVR, - unsigned long ulong1); + uint64_t ulonglong1); /** \ingroup rpmps * Destroy a problem item. @@ -126,7 +126,7 @@ const char * rpmProblemGetStr(const rpmProblem prob); * @return a generic pointer/long attribute * @todo needs a better name */ -unsigned long rpmProblemGetLong(const rpmProblem prob); +uint64_t rpmProblemGetLongLong(const rpmProblem prob); /** \ingroup rpmps * Return formatted string representation of a problem. @@ -223,14 +223,14 @@ void rpmpsAppendProblem(rpmps ps, rpmProblem prob); * @param dn directory name * @param bn file base name * @param altNEVR related (e.g. through a dependency) package name - * @param ulong1 generic pointer/long attribute + * @param ulonglong1 generic pointer/long attribute */ void rpmpsAppend(rpmps ps, rpmProblemType type, const char * pkgNEVR, fnpyKey key, const char * dn, const char * bn, const char * altNEVR, - unsigned long ulong1); + uint64_t ulonglong1); /** \ingroup rpmps * Filter a problem set. diff --git a/lib/rpmtag.h b/lib/rpmtag.h index 9e1653e..8f83cba 100644 --- a/lib/rpmtag.h +++ b/lib/rpmtag.h @@ -99,7 +99,7 @@ typedef enum rpmTag_e { RPMTAG_PREUN = 1025, /* s */ RPMTAG_POSTUN = 1026, /* s */ RPMTAG_OLDFILENAMES = 1027, /* s[] obsolete */ - RPMTAG_FILESIZES = 1028, /* i[] */ + RPMTAG_OLDFILESIZES = 1028, /* i[] */ RPMTAG_FILESTATES = 1029, /* c[] */ RPMTAG_FILEMODES = 1030, /* h[] */ RPMTAG_FILEUIDS = 1031, /* i[] internal */ @@ -268,6 +268,7 @@ typedef enum rpmTag_e { RPMTAG_REQUIREATTRSX = 1192, /* i[] (unimplemented) */ RPMTAG_BUILDPROVIDES = 1193, /* internal */ RPMTAG_BUILDOBSOLETES = 1194, /* internal */ + RPMTAG_NEWFILESIZES = 1195, /* l[] */ RPMTAG_FILENAMES = 5000, /* s[] extension */ RPMTAG_FILEPROVIDE = 5001, /* s[] extension */ RPMTAG_FILEREQUIRE = 5002, /* s[] extension */ @@ -312,7 +313,7 @@ typedef enum rpmTagType_e { RPM_INT8_TYPE = 2, RPM_INT16_TYPE = 3, RPM_INT32_TYPE = 4, -/* RPM_INT64_TYPE = 5, ---- These aren't supported (yet) */ + RPM_INT64_TYPE = 5, RPM_STRING_TYPE = 6, RPM_BIN_TYPE = 7, RPM_STRING_ARRAY_TYPE = 8, diff --git a/lib/rpmts.c b/lib/rpmts.c index d333db7..171aba3 100644 --- a/lib/rpmts.c +++ b/lib/rpmts.c @@ -1199,20 +1199,20 @@ int rpmtsInitDSI(const rpmts ts) /* XXX assigning negative value to unsigned type */ dsi->iavail = !(sfb.f_ffree == 0 && sfb.f_files == 0) ? sfb.f_ffree : -1; - rpmlog(RPMLOG_DEBUG, "%5d 0x%08x %8u %12ld %12ld %s\n", - i, (unsigned) dsi->dev, (unsigned) dsi->bsize, - (signed long) dsi->bavail, (signed long) dsi->iavail, + rpmlog(RPMLOG_DEBUG, "%5d 0x%08x %8lld %12lld %12lld %s\n", + i, (unsigned) dsi->dev, dsi->bsize, + dsi->bavail, dsi->iavail, ts->filesystems[i]); } return rc; } void rpmtsUpdateDSI(const rpmts ts, dev_t dev, - rpm_off_t fileSize, rpm_off_t prevSize, rpm_off_t fixupSize, + rpm_loff_t fileSize, rpm_loff_t prevSize, rpm_loff_t fixupSize, rpmFileAction action) { rpmDiskSpaceInfo dsi; - uint32_t bneeded; + int64_t bneeded; dsi = ts->dsi; if (dsi) { diff --git a/lib/rpmts.h b/lib/rpmts.h index 0b4af36..4c30c74 100644 --- a/lib/rpmts.h +++ b/lib/rpmts.h @@ -567,13 +567,13 @@ int rpmtsInitDSI(const rpmts ts); * Update disk space info for a file. * @param ts transaction set * @param dev mount point device - * @param fileSize file size - * @param prevSize previous file size (if upgrading) - * @param fixupSize size difference (if + * @param fileLSize long (64bit) file size + * @param prevSize previous long file size (if upgrading) + * @param fixupSize long size difference * @param action file disposition */ void rpmtsUpdateDSI(const rpmts ts, dev_t dev, - rpm_off_t fileSize, rpm_off_t prevSize, rpm_off_t fixupSize, + rpm_loff_t fileSize, rpm_loff_t prevSize, rpm_loff_t fixupSize, rpmFileAction action); /** \ingroup rpmts diff --git a/lib/rpmts_internal.h b/lib/rpmts_internal.h index 6c662e4..83a8bc8 100644 --- a/lib/rpmts_internal.h +++ b/lib/rpmts_internal.h @@ -13,12 +13,12 @@ typedef struct diskspaceInfo_s * rpmDiskSpaceInfo; /** \ingroup rpmts */ struct diskspaceInfo_s { - dev_t dev; /*!< File system device number. */ - signed long bneeded; /*!< No. of blocks needed. */ - signed long ineeded; /*!< No. of inodes needed. */ - int bsize; /*!< File system block size. */ - signed long long bavail; /*!< No. of blocks available. */ - signed long long iavail; /*!< No. of inodes available. */ + dev_t dev; /*!< File system device number. */ + int64_t bneeded; /*!< No. of blocks needed. */ + int64_t ineeded; /*!< No. of inodes needed. */ + int64_t bsize; /*!< File system block size. */ + int64_t bavail; /*!< No. of blocks available. */ + int64_t iavail; /*!< No. of inodes available. */ }; /** \ingroup rpmts diff --git a/lib/rpmtypes.h b/lib/rpmtypes.h index 66ee500..bc0efcc 100644 --- a/lib/rpmtypes.h +++ b/lib/rpmtypes.h @@ -44,6 +44,7 @@ typedef int32_t rpm_tid_t; * @{ */ typedef uint32_t rpm_off_t; +typedef uint64_t rpm_loff_t; typedef uint32_t rpm_time_t; typedef uint16_t rpm_mode_t; typedef uint16_t rpm_rdev_t; diff --git a/lib/tagexts.c b/lib/tagexts.c index 7575ce4..2c9bfa6 100644 --- a/lib/tagexts.c +++ b/lib/tagexts.c @@ -130,15 +130,15 @@ static int instprefixTag(Header h, rpmtd td) * @retval td tag data container * @return 0 on success */ -static int fssizesTag(Header h, rpmtd td) +static int64_t fssizesTag(Header h, rpmtd td) { HGE_t hge = (HGE_t)headerGetEntryMinMemory; const char ** filenames; - rpm_off_t * filesizes; - rpm_off_t * usages; + rpm_loff_t * filesizes; + rpm_loff_t * usages; rpm_count_t numFiles; - if (!hge(h, RPMTAG_FILESIZES, NULL, (rpm_data_t *) &filesizes, &numFiles)) { + if (!hge(h, RPMTAG_NEWFILESIZES, NULL, (rpm_data_t *) &filesizes, &numFiles)) { filesizes = NULL; numFiles = 0; filenames = NULL; @@ -149,7 +149,7 @@ static int fssizesTag(Header h, rpmtd td) if (rpmGetFilesystemList(NULL, &(td->count))) return 1; - td->type = RPM_INT32_TYPE; + td->type = RPM_INT64_TYPE; td->flags = RPMTD_ALLOCED; if (filenames == NULL) { diff --git a/lib/transaction.c b/lib/transaction.c index c443b96..1266c92 100644 --- a/lib/transaction.c +++ b/lib/transaction.c @@ -185,6 +185,7 @@ static int handleInstInstalledFiles(const rpmts ts, fi->actions[fileNum] = action; } fi->replacedSizes[fileNum] = rpmfiFSize(otherFi); + fi->replacedLSizes[fileNum] = rpmfiFLSize(otherFi); } ps = rpmpsFree(ps); diff --git a/lib/verify.c b/lib/verify.c index 5ff05a8..f9ce2cc 100644 --- a/lib/verify.c +++ b/lib/verify.c @@ -128,7 +128,7 @@ int rpmVerifyFile(const rpmts ts, const rpmfi fi, } if (flags & RPMVERIFY_FILESIZE) { - if (sb.st_size != rpmfiFSize(fi)) + if (sb.st_size != rpmfiFLSize(fi)) *res |= RPMVERIFY_FILESIZE; } diff --git a/python/rpmfi-py.c b/python/rpmfi-py.c index b3ef5f3..405ab2c 100644 --- a/python/rpmfi-py.c +++ b/python/rpmfi-py.c @@ -118,6 +118,12 @@ rpmfi_FSize(rpmfiObject * s) } static PyObject * +rpmfi_FLSize(rpmfiObject * s) +{ + return Py_BuildValue("l", rpmfiFLSize(s->fi)); +} + +static PyObject * rpmfi_FRdev(rpmfiObject * s) { return Py_BuildValue("i", rpmfiFRdev(s->fi)); diff --git a/python/rpmps-py.c b/python/rpmps-py.c index 1914c6c..b0b3567 100644 --- a/python/rpmps-py.c +++ b/python/rpmps-py.c @@ -25,7 +25,7 @@ static int rpmps_append(rpmpsObject * s, PyObject * value) { char *pkgNEVR, *altNEVR, *str1; - unsigned long ulong1; + uint64_t ulonglong1; int ignoreProblem; rpmProblemType type; fnpyKey key; @@ -33,11 +33,11 @@ rpmps_append(rpmpsObject * s, PyObject * value) if (!PyArg_ParseTuple(value, "ssOiisN:rpmps value tuple", &pkgNEVR, &altNEVR, &key, &type, &ignoreProblem, &str1, - &ulong1)) + &ulonglong1)) { return -1; } - rpmpsAppend(s->ps, type, pkgNEVR, key, str1, NULL, altNEVR, ulong1); + rpmpsAppend(s->ps, type, pkgNEVR, key, str1, NULL, altNEVR, ulonglong1); return 0; }