From: jbj Date: Sun, 11 Nov 2001 20:45:20 +0000 (+0000) Subject: Replace loadFi with fiNew, freeFi with fiFree. X-Git-Tag: rpm-4.4-release~1345 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1eb0503123bfd829d5122e54353a000d89333a10;p=platform%2Fupstream%2Frpm.git Replace loadFi with fiNew, freeFi with fiFree. CVS patchset: 5175 CVS date: 2001/11/11 20:45:20 --- diff --git a/build.c b/build.c index 908c2a9..e0ee60e 100644 --- a/build.c +++ b/build.c @@ -28,7 +28,7 @@ static int checkSpec(rpmTransactionSet ts, Header h) && !headerIsEntry(h, RPMTAG_CONFLICTNAME)) return 0; - rc = rpmtransAddPackage(ts, h, NULL, NULL, 0, NULL); + rc = rpmtransAddPackage(ts, h, NULL, 0, NULL); rc = rpmdepCheck(ts, &conflicts, &numConflicts); /*@-branchstate@*/ diff --git a/build/files.c b/build/files.c index de66572..be5c12f 100644 --- a/build/files.c +++ b/build/files.c @@ -1337,13 +1337,14 @@ static void genCpioListAndHeader(/*@partial@*/ FileList fl, } { TFI_t fi = xcalloc(1, sizeof(*fi)); + int scareMem = 1; char * a, * d; /* XXX FIXME drill rpmTransactionSet ts all the way down here */ /*@i@*/ fi->te = xcalloc(1, sizeof(*fi->te)); /*@i@*/ fi->te->type = TR_ADDED; - loadFi(NULL, fi, h, 1); + fi = fiNew(NULL, fi, h, RPMTAG_BASENAMES, scareMem); fi->dnl = _free(fi->dnl); fi->bnl = _free(fi->bnl); diff --git a/build/spec.c b/build/spec.c index a54efae..c57efb9 100644 --- a/build/spec.c +++ b/build/spec.c @@ -162,10 +162,12 @@ Package freePackage(Package pkg) if (pkg->cpioList) { TFI_t fi = pkg->cpioList; pkg->cpioList = NULL; - freeFi(fi); + fi = fiFree(fi, 1); +#ifdef DYING /*@-refcounttrans@*/ /* FIX: fi needs to be only */ fi = _free(fi); /*@=refcounttrans@*/ +#endif } pkg->specialDoc = freeStringBuf(pkg->specialDoc); @@ -510,10 +512,12 @@ Spec freeSpec(Spec spec) if (spec->sourceCpioList) { TFI_t fi = spec->sourceCpioList; spec->sourceCpioList = NULL; - freeFi(fi); + fi = fiFree(fi, 1); +#ifdef DYING /*@-refcounttrans@*/ /* FIX: fi needs to be only */ fi = _free(fi); /*@=refcounttrans@*/ +#endif } spec->buildRestrictions = headerFree(spec->buildRestrictions, "spec->>buildRestrictions"); diff --git a/lib/depends.c b/lib/depends.c index 7025e86..a9d9312 100644 --- a/lib/depends.c +++ b/lib/depends.c @@ -158,9 +158,9 @@ static void delTE(transactionElement p) p->requires = dsFree(p->requires); p->conflicts = dsFree(p->conflicts); p->obsoletes = dsFree(p->obsoletes); - p->fns = fnsFree(p->fns); + p->fns = fiFree(p->fns, 1); - /*@-type@*/ /* FIX: cast? */ + /*@-type@*/ /* FIX: cast? Fclose? */ if (p->fd != NULL) p->fd = fdFree(p->fd, "alAddPackage (delTE)"); /*@=type@*/ @@ -179,11 +179,13 @@ static void delTE(transactionElement p) /*@=nullstate@*/ } -static void addTE(transactionElement p, Header h, +static void addTE(rpmTransactionSet ts, transactionElement p, Header h, +#ifdef DYING /*@null@*/ FD_t fd, +#endif /*@null@*/ fnpyKey key, /*@null@*/ rpmRelocation * relocs) - /*@modifies p, h @*/ + /*@modifies ts, p, h @*/ { int scareMem = _DS_SCAREMEM; HGE_t hge = (HGE_t)headerGetEntryMinMemory; @@ -217,7 +219,7 @@ static void addTE(transactionElement p, Header h, p->this = dsThis(h, RPMTAG_PROVIDENAME, RPMSENSE_EQUAL); p->provides = dsNew(h, RPMTAG_PROVIDENAME, scareMem); - p->fns = fnsNew(h, RPMTAG_BASENAMES, scareMem); + p->fns = fiNew(ts, NULL, h, RPMTAG_BASENAMES, scareMem); p->requires = dsNew(h, RPMTAG_REQUIRENAME, scareMem); p->conflicts = dsNew(h, RPMTAG_CONFLICTNAME, scareMem); p->obsoletes = dsNew(h, RPMTAG_OBSOLETENAME, scareMem); @@ -226,9 +228,13 @@ static void addTE(transactionElement p, Header h, p->key = key; /*@=assignexpose =temptrans @*/ +#ifdef DYING /*@-type@*/ /* FIX: cast? */ p->fd = (fd != NULL ? fdLink(fd, "addTE") : NULL); /*@=type@*/ +#else + p->fd = NULL; +#endif if (relocs != NULL) { rpmRelocation * r; @@ -371,7 +377,8 @@ static int removePackage(rpmTransactionSet ts, Header h, int dboffset, memset(p, 0, sizeof(*p)); - addTE(p, h, NULL, NULL, NULL); + /* XXX FIXME: what should a TR_REMOVED key be ??? */ + addTE(ts, p, h, NULL, NULL); p->type = TR_REMOVED; p->u.removed.dboffset = dboffset; @@ -382,7 +389,7 @@ static int removePackage(rpmTransactionSet ts, Header h, int dboffset, return 0; } -int rpmtransAddPackage(rpmTransactionSet ts, Header h, FD_t fd, +int rpmtransAddPackage(rpmTransactionSet ts, Header h, fnpyKey key, int upgrade, rpmRelocation * relocs) { HGE_t hge = (HGE_t)headerGetEntryMinMemory; @@ -436,7 +443,7 @@ int rpmtransAddPackage(rpmTransactionSet ts, Header h, FD_t fd, p = ts->order + oc; memset(p, 0, sizeof(*p)); - addTE(p, h, fd, key, relocs); + addTE(ts, p, h, key, relocs); p->type = TR_ADDED; pkgKey = alAddPackage(ts->addedPackages, pkgKey, p->key, @@ -564,12 +571,12 @@ void rpmtransAvailablePackage(rpmTransactionSet ts, Header h, fnpyKey key) { int scareMem = _DS_SCAREMEM; rpmDepSet provides = dsNew(h, RPMTAG_PROVIDENAME, scareMem); - rpmFNSet fns = fnsNew(h, RPMTAG_BASENAMES, scareMem); + rpmFNSet fns = fiNew(ts, NULL, h, RPMTAG_BASENAMES, scareMem); /* XXX FIXME: return code RPMAL_NOMATCH is error */ (void) alAddPackage(ts->availablePackages, RPMAL_NOMATCH, key, provides, fns); - fns = fnsFree(fns); + fns = fiFree(fns, 1); provides = dsFree(provides); } diff --git a/lib/depends.h b/lib/depends.h index f9d77c0..7fd6229 100644 --- a/lib/depends.h +++ b/lib/depends.h @@ -153,9 +153,10 @@ struct rpmTransactionSet_s { int dbmode; /*!< Database open mode. */ /*@refcounted@*/ /*@null@*/ rpmdb rpmdb; /*!< Database handle. */ -/*@only@*/ hashTable ht; /*!< Fingerprint hash table. */ - /*@only@*/ + hashTable ht; /*!< Fingerprint hash table. */ + +/*@only@*/ /*@null@*/ int * removedPackages; /*!< Set of packages being removed. */ int numRemovedPackages; /*!< No. removed package instances. */ int allocedRemovedPackages; /*!< Size of removed packages array. */ diff --git a/lib/psm.c b/lib/psm.c index 789c9e0..654baf9 100644 --- a/lib/psm.c +++ b/lib/psm.c @@ -20,7 +20,7 @@ #include "debug.h" /*@unchecked@*/ -int _fi_debug = 0; +static int _fi_debug = 0; /*@access Header@*/ /* compared with NULL */ /*@access rpmdbMatchIterator@*/ /* compared with NULL */ @@ -559,198 +559,6 @@ fprintf(stderr, "--> fi %p ++ %d %s at %s:%u\n", fi, fi->nrefs, msg, fn, ln); /*@-refcounttrans@*/ return fi; /*@=refcounttrans@*/ } -void loadFi(const rpmTransactionSet ts, TFI_t fi, Header h, int keep_header) -{ - HGE_t hge; - HFD_t hfd; - uint_32 * uip; - int len; - int rc; - int i; - - if (fi->fsm == NULL) - fi->fsm = newFSM(); - - /* XXX avoid gcc noise on pointer (4th arg) cast(s) */ - hge = (keep_header && fi->te->type == TR_ADDED) - ? (HGE_t) headerGetEntryMinMemory : (HGE_t) headerGetEntry; - fi->hge = hge; - fi->hae = (HAE_t) headerAddEntry; - fi->hme = (HME_t) headerModifyEntry; - fi->hre = (HRE_t) headerRemoveEntry; - fi->hfd = hfd = headerFreeData; - - /*@-branchstate@*/ - if (h && fi->h == NULL) fi->h = headerLink(h, "loadFi"); - /*@=branchstate@*/ - - /* 0 means unknown */ - rc = hge(fi->h, RPMTAG_ARCHIVESIZE, NULL, (void **) &uip, NULL); - fi->archiveSize = (rc ? *uip : 0); - - if (!hge(fi->h, RPMTAG_BASENAMES, NULL, (void **) &fi->bnl, &fi->fc)) { - fi->dc = 0; - fi->fc = 0; - return; - } - - rc = hge(fi->h, RPMTAG_DIRNAMES, NULL, (void **) &fi->dnl, &fi->dc); - - rc = hge(fi->h, RPMTAG_DIRINDEXES, NULL, (void **) &fi->dil, NULL); - rc = hge(fi->h, RPMTAG_FILEMODES, NULL, (void **) &fi->fmodes, NULL); - rc = hge(fi->h, RPMTAG_FILEFLAGS, NULL, (void **) &fi->fflags, NULL); - rc = hge(fi->h, RPMTAG_FILESIZES, NULL, (void **) &fi->fsizes, NULL); - - /* XXX initialized to NULL for TR_ADDED? */ - rc = hge(fi->h, RPMTAG_FILESTATES, NULL, (void **) &fi->fstates, NULL); - - fi->action = FA_UNKNOWN; - fi->flags = 0; - - /* actions is initialized earlier for added packages */ - if (fi->actions == NULL) - fi->actions = xcalloc(fi->fc, sizeof(*fi->actions)); - - fi->keep_header = keep_header; - switch (fi->te->type) { - case TR_ADDED: - fi->mapflags = - CPIO_MAP_PATH | CPIO_MAP_MODE | CPIO_MAP_UID | CPIO_MAP_GID; - rc = hge(fi->h, RPMTAG_FILELINKTOS, NULL, (void **) &fi->flinks, NULL); - rc = hge(fi->h, RPMTAG_FILELANGS, NULL, (void **) &fi->flangs, NULL); - - rc = hge(fi->h, RPMTAG_FILEMD5S, NULL, (void **) &fi->fmd5s, NULL); - - rc = hge(fi->h, RPMTAG_FILEMTIMES, NULL, (void **) &fi->fmtimes, NULL); - rc = hge(fi->h, RPMTAG_FILERDEVS, NULL, (void **) &fi->frdevs, NULL); - - /* 0 makes for noops */ - fi->replacedSizes = xcalloc(fi->fc, sizeof(*fi->replacedSizes)); - - if (ts != NULL && fi->h != NULL) - { Header foo = relocateFileList(ts, fi, fi->h, fi->actions); - foo = headerFree(foo, "loadFi TR_ADDED relocate"); - } - - if (!fi->keep_header) { - fi->fmtimes = memcpy(xmalloc(fi->fc * sizeof(*fi->fmtimes)), - fi->fmtimes, fi->fc * sizeof(*fi->fmtimes)); - fi->frdevs = memcpy(xmalloc(fi->fc * sizeof(*fi->frdevs)), - fi->frdevs, fi->fc * sizeof(*fi->frdevs)); - - fi->fsizes = memcpy(xmalloc(fi->fc * sizeof(*fi->fsizes)), - fi->fsizes, fi->fc * sizeof(*fi->fsizes)); - fi->fflags = memcpy(xmalloc(fi->fc * sizeof(*fi->fflags)), - fi->fflags, fi->fc * sizeof(*fi->fflags)); - fi->fmodes = memcpy(xmalloc(fi->fc * sizeof(*fi->fmodes)), - fi->fmodes, fi->fc * sizeof(*fi->fmodes)); - /* XXX there's a tedious segfault here for some version(s) of rpm */ - if (fi->fstates) - fi->fstates = memcpy(xmalloc(fi->fc * sizeof(*fi->fstates)), - fi->fstates, fi->fc * sizeof(*fi->fstates)); - else - fi->fstates = xcalloc(1, fi->fc * sizeof(*fi->fstates)); - fi->dil = memcpy(xmalloc(fi->fc * sizeof(*fi->dil)), - fi->dil, fi->fc * sizeof(*fi->dil)); - fi->h = headerFree(fi->h, "loadFi TR_ADDED"); - } - - break; - case TR_REMOVED: - fi->mapflags = - CPIO_MAP_ABSOLUTE | CPIO_MAP_ADDDOT | CPIO_ALL_HARDLINKS | - CPIO_MAP_PATH | CPIO_MAP_MODE | CPIO_MAP_UID | CPIO_MAP_GID; - rc = hge(fi->h, RPMTAG_FILEMD5S, NULL, (void **) &fi->fmd5s, NULL); - rc = hge(fi->h, RPMTAG_FILELINKTOS, NULL, (void **) &fi->flinks, NULL); - fi->fsizes = memcpy(xmalloc(fi->fc * sizeof(*fi->fsizes)), - fi->fsizes, fi->fc * sizeof(*fi->fsizes)); - fi->fflags = memcpy(xmalloc(fi->fc * sizeof(*fi->fflags)), - fi->fflags, fi->fc * sizeof(*fi->fflags)); - fi->fmodes = memcpy(xmalloc(fi->fc * sizeof(*fi->fmodes)), - fi->fmodes, fi->fc * sizeof(*fi->fmodes)); - /* XXX there's a tedious segfault here for some version(s) of rpm */ - if (fi->fstates) - fi->fstates = memcpy(xmalloc(fi->fc * sizeof(*fi->fstates)), - fi->fstates, fi->fc * sizeof(*fi->fstates)); - else - fi->fstates = xcalloc(1, fi->fc * sizeof(*fi->fstates)); - fi->dil = memcpy(xmalloc(fi->fc * sizeof(*fi->dil)), - fi->dil, fi->fc * sizeof(*fi->dil)); - fi->h = headerFree(fi->h, "loadFi TR_REMOVED"); - break; - } - - fi->dnlmax = -1; - for (i = 0; i < fi->dc; i++) { - if ((len = strlen(fi->dnl[i])) > fi->dnlmax) - fi->dnlmax = len; - } - - fi->bnlmax = -1; - for (i = 0; i < fi->fc; i++) { - if ((len = strlen(fi->bnl[i])) > fi->bnlmax) - fi->bnlmax = len; - } - - fi->dperms = 0755; - fi->fperms = 0644; - - return; -} - -void freeFi(TFI_t fi) -{ - HFD_t hfd = (fi->hfd ? fi->hfd : headerFreeData); - - switch (fi->te->type) { - case TR_ADDED: - if (!fi->keep_header) { - fi->fmtimes = hfd(fi->fmtimes, -1); - fi->frdevs = hfd(fi->frdevs, -1); - fi->fsizes = hfd(fi->fsizes, -1); - fi->fflags = hfd(fi->fflags, -1); - fi->fmodes = hfd(fi->fmodes, -1); - fi->fstates = hfd(fi->fstates, -1); - fi->dil = hfd(fi->dil, -1); - } - break; - case TR_REMOVED: - fi->fsizes = hfd(fi->fsizes, -1); - fi->fflags = hfd(fi->fflags, -1); - fi->fmodes = hfd(fi->fmodes, -1); - fi->fstates = hfd(fi->fstates, -1); - fi->dil = hfd(fi->dil, -1); - break; - } - - fi->fsm = freeFSM(fi->fsm); - - fi->apath = _free(fi->apath); - fi->fuids = _free(fi->fuids); - fi->fgids = _free(fi->fgids); - fi->fmapflags = _free(fi->fmapflags); - - fi->bnl = hfd(fi->bnl, -1); - fi->dnl = hfd(fi->dnl, -1); - fi->obnl = hfd(fi->obnl, -1); - fi->odnl = hfd(fi->odnl, -1); - fi->flinks = hfd(fi->flinks, -1); - fi->fmd5s = hfd(fi->fmd5s, -1); - fi->fuser = hfd(fi->fuser, -1); - fi->fgroup = hfd(fi->fgroup, -1); - fi->flangs = hfd(fi->flangs, -1); - - fi->actions = _free(fi->actions); - fi->replacedSizes = _free(fi->replacedSizes); - fi->replaced = _free(fi->replaced); - - fi->h = headerFree(fi->h, "freeFi"); - - /*@-nullstate@*/ /* FIX: fi->{name,version,release,actions,...,h} NULL */ - return; - /*@=nullstate@*/ -} - /*@observer@*/ const char *const fiTypeString(TFI_t fi) { switch(fi->te->type) { @@ -1134,7 +942,8 @@ rpmRC rpmInstallSourcePackage(rpmTransactionSet ts, rpmCallbackFunction notify, rpmCallbackData notifyData, const char ** cookie) { - TFI_t fi = xcalloc(sizeof(*fi), 1); + int scareMem = 1; + TFI_t fi = NULL; const char * _sourcedir = NULL; const char * _specdir = NULL; const char * specFile = NULL; @@ -1167,29 +976,35 @@ rpmRC rpmInstallSourcePackage(rpmTransactionSet ts, goto exit; } - /* XXX don't bother with fd, linked directly into fi below. */ - (void) rpmtransAddPackage(ts, h, NULL, NULL, 0, NULL); - - fi->te = ts->order; + (void) rpmtransAddPackage(ts, h, NULL, 0, NULL); +#ifdef DYING + fi = xcalloc(1, sizeof(*fi)); fi->h = headerLink(h, "InstallSourcePackage"); - -/*@i@*/ fi->te->fd = fd; - /* XXX header arg unused. */ loadFi(ts, fi, fi->h, 1); - hge = fi->hge; - hfd = (fi->hfd ? fi->hfd : headerFreeData); +#else + fi = fiNew(ts, fi, h, RPMTAG_BASENAMES, scareMem); +#endif h = headerFree(h, "InstallSourcePackage"); + if (fi == NULL) { /* XXX can't happen */ + rc = RPMRC_FAIL; + goto exit; + } + + fi->te = ts->order; +/*@i@*/ fi->te->fd = fd; + hge = fi->hge; + hfd = fi->hfd; - (void) rpmInstallLoadMacros(fi, fi->h); +/*@i@*/ (void) rpmInstallLoadMacros(fi, fi->h); memset(psm, 0, sizeof(*psm)); - /*@-assignexpose@*/ + /*@-assignexpose -usereleased @*/ psm->ts = rpmtsLink(ts, "InstallSourcePackage"); psm->fi = fi; psm->te = fi->te; - /*@=assignexpose@*/ + /*@=assignexpose =usereleased @*/ if (cookie) { *cookie = NULL; @@ -1198,7 +1013,7 @@ rpmRC rpmInstallSourcePackage(rpmTransactionSet ts, } /* XXX FIXME: can't do endian neutral MD5 verification yet. */ - fi->fmd5s = hfd(fi->fmd5s, -1); +/*@i@*/ fi->fmd5s = hfd(fi->fmd5s, -1); /* XXX FIXME: don't do per-file mapping, force global flags. */ fi->fmapflags = _free(fi->fmapflags); @@ -1259,7 +1074,7 @@ rpmRC rpmInstallSourcePackage(rpmTransactionSet ts, int sourcelen = strlen(_sourcedir) + 2; char * t; - fi->dnl = hfd(fi->dnl, -1); +/*@i@*/ fi->dnl = hfd(fi->dnl, -1); fi->dc = 2; fi->dnl = xmalloc(fi->dc * sizeof(*fi->dnl) + fi->fc * sizeof(*fi->dil) + @@ -1303,12 +1118,16 @@ exit: if (h) h = headerFree(h, "InstallSourcePackage exit"); + /*@-branchstate@*/ if (fi) { - freeFi(fi); + fi = fiFree(fi, 1); +#ifdef DYING /*@-refcounttrans@*/ /* FIX: fi needs to be only */ fi = _free(fi); /*@=refcounttrans@*/ +#endif } + /*@=branchstate@*/ psm->fi = NULL; psm->te = NULL; diff --git a/lib/psm.h b/lib/psm.h index c41f710..9262764 100644 --- a/lib/psm.h +++ b/lib/psm.h @@ -10,11 +10,6 @@ #include "depends.h" #include "rpmds.h" -/*@unchecked@*/ -/*@-exportlocal@*/ -extern int _fi_debug; -/*@=exportlocal@*/ - /** */ #define PSM_VERBOSE 0x8000 @@ -105,17 +100,6 @@ struct psm_s { extern "C" { #endif -#ifdef DYING -/** - * Return (malloc'd) transaction element name-version-release string. - * @param fi transaction element file info - * @return name-version-release string - */ -/*@only@*/ /*@null@*/ -char * fiGetNEVR(/*@null@*/const TFI_t fi) - /*@*/; -#endif - /** * Return file type from mode_t. * @param mode file mode bits (from header) @@ -138,24 +122,6 @@ Header relocateFileList(const rpmTransactionSet ts, TFI_t fi, /*@modifies ts, fi, origH, actions @*/; /** - * Load data from header into transaction file element info. - * @param ts transaction set - * @param fi transaction element file info - * @param h header - * @param keep_header use header memory? - */ -void loadFi(/*@null@*/ const rpmTransactionSet ts, TFI_t fi, - Header h, int keep_header) - /*@modifies ts, fi, h @*/; - -/** - * Destroy transaction element file info. - * @param fi transaction element file info - */ -void freeFi(TFI_t fi) - /*@modifies fi @*/; - -/** * Retrieve key from transaction element file info * @param fi transaction element file info * @return transaction element file info key diff --git a/lib/rpmal.c b/lib/rpmal.c index 4f274d6..d26e9e9 100644 --- a/lib/rpmal.c +++ b/lib/rpmal.c @@ -222,7 +222,7 @@ availableList alFree(availableList al) if ((alp = al->list) != NULL) for (i = 0; i < al->size; i++, alp++) { alp->provides = dsFree(alp->provides); - alp->fns = fnsFree(alp->fns); + alp->fns = fiFree(alp->fns, 1); } if ((die = al->dirs) != NULL) @@ -358,7 +358,7 @@ fprintf(stderr, "*** del %p[%d]\n", al->list, pkgNum); } alp->provides = dsFree(alp->provides); - alp->fns = fnsFree(alp->fns); + alp->fns = fiFree(alp->fns, 1); memset(alp, 0, sizeof(*alp)); /* XXX trash and burn */ /*@-nullstate@*/ /* FIX: al->list->h may be NULL */ diff --git a/lib/rpmds.c b/lib/rpmds.c index beaf9b8..761599b 100644 --- a/lib/rpmds.c +++ b/lib/rpmds.c @@ -2,12 +2,12 @@ * \file lib/rpmds.c */ #include "system.h" -#include #ifdef DYING +#include #include "rpmds.h" #else -#include "depends.h" /* XXX rpmTransactionType */ +#include "psm.h" /* XXX rpmTransactionType */ #endif #include "debug.h" @@ -15,15 +15,29 @@ /*@access alKey@*/ /*@access rpmFNSet @*/ +/*@access transactionElement @*/ /*@unchecked@*/ -static int _fns_debug = 0; +static int _fi_debug = -1; + +/** + * Wrapper to free(3), hides const compilation noise, permit NULL, return NULL. + * @param p memory to free + * @return NULL always + */ +/*@unused@*/ static /*@null@*/ +void * _xfree(/*@only@*/ /*@null@*/ /*@out@*/ const void * p) + /*@modifies p @*/ +{ + if (p != NULL) free((void *)p); + return NULL; +} rpmFNSet XrpmfnsUnlink(rpmFNSet fns, const char * msg, const char * fn, unsigned ln) { if (fns == NULL) return NULL; /*@-modfilesystem@*/ -if (_fns_debug && msg != NULL) +if (_fi_debug && msg != NULL) fprintf(stderr, "--> fi %p -- %d %s at %s:%u\n", fns, fns->nrefs, msg, fn, ln); /*@=modfilesystem@*/ fns->nrefs--; @@ -35,144 +49,228 @@ rpmFNSet XrpmfnsLink(rpmFNSet fns, const char * msg, const char * fn, unsigned l if (fns == NULL) return NULL; fns->nrefs++; /*@-modfilesystem@*/ -if (_fns_debug && msg != NULL) +if (_fi_debug && msg != NULL) fprintf(stderr, "--> fi %p ++ %d %s at %s:%u\n", fns, fns->nrefs, msg, fn, ln); /*@=modfilesystem@*/ /*@-refcounttrans@*/ return fns; /*@=refcounttrans@*/ } -rpmFNSet fnsFree(rpmFNSet fns) +rpmFNSet fiFree(rpmFNSet fi, int freefimem) { HFD_t hfd = headerFreeData; - if (fns == NULL) return NULL; + if (fi == NULL) return NULL; - if (fns->nrefs > 1) - return rpmfnsUnlink(fns, fns->Type); + if (fi->nrefs > 1) + return rpmfnsUnlink(fi, fi->Type); /*@-modfilesystem@*/ -if (_fns_debug < 0) -fprintf(stderr, "*** fi %p\t%s[%d]\n", fns, fns->Type, fns->fc); +if (_fi_debug < 0) +fprintf(stderr, "*** fi %p\t%s[%d]\n", fi, fi->Type, fi->fc); /*@=modfilesystem@*/ /*@-branchstate@*/ - if (fns->fc > 0) { - fns->bnl = hfd(fns->bnl, -1); - fns->dnl = hfd(fns->dnl, -1); + if (fi->fc > 0) { + fi->bnl = hfd(fi->bnl, -1); + fi->dnl = hfd(fi->dnl, -1); - fns->flinks = hfd(fns->flinks, -1); - fns->flangs = hfd(fns->flangs, -1); - fns->fmd5s = hfd(fns->fmd5s, -1); + fi->flinks = hfd(fi->flinks, -1); + fi->flangs = hfd(fi->flangs, -1); + fi->fmd5s = hfd(fi->fmd5s, -1); - fns->fuser = hfd(fns->fuser, -1); - fns->fuids = _free(fns->fuids); - fns->fgroup = hfd(fns->fgroup, -1); - fns->fgids = _free(fns->fgids); + fi->fuser = hfd(fi->fuser, -1); + fi->fuids = _xfree(fi->fuids); + fi->fgroup = hfd(fi->fgroup, -1); + fi->fgids = _xfree(fi->fgids); - fns->fstates = _free(fns->fstates); + fi->fstates = _xfree(fi->fstates); /*@-evalorder@*/ - if (fns->h != NULL) { - fns->h = headerFree(fns->h, fns->Type); - } else { - fns->fmtimes = _free(fns->fmtimes); - fns->fmodes = _free(fns->fmodes); - fns->fflags = _free(fns->fflags); - fns->fsizes = _free(fns->fsizes); - fns->frdevs = _free(fns->frdevs); - fns->dil = _free(fns->dil); + if (!fi->keep_header && fi->h == NULL) { + fi->fmtimes = _xfree(fi->fmtimes); + fi->fmodes = _xfree(fi->fmodes); + fi->fflags = _xfree(fi->fflags); + fi->fsizes = _xfree(fi->fsizes); + fi->frdevs = _xfree(fi->frdevs); + fi->dil = _xfree(fi->dil); } /*@=evalorder@*/ } /*@=branchstate@*/ - /*@-refcounttrans -usereleased@*/ - (void) rpmfnsUnlink(fns, fns->Type); - memset(fns, 0, sizeof(*fns)); /* XXX trash and burn */ - fns = _free(fns); - /*@=refcounttrans =usereleased@*/ + fi->fsm = freeFSM(fi->fsm); + + fi->apath = _xfree(fi->apath); + fi->fmapflags = _xfree(fi->fmapflags); + + fi->obnl = hfd(fi->obnl, -1); + fi->odnl = hfd(fi->odnl, -1); + + fi->actions = _xfree(fi->actions); + fi->replacedSizes = _xfree(fi->replacedSizes); + fi->replaced = _xfree(fi->replaced); + + fi->h = headerFree(fi->h, fi->Type); + + /*@-nullstate -refcounttrans -usereleased@*/ + (void) rpmfnsUnlink(fi, fi->Type); + memset(fi, 0, sizeof(*fi)); /* XXX trash and burn */ + /*@-branchstate@*/ + if (freefimem) + fi = _xfree(fi); + /*@=branchstate@*/ + /*@=nullstate =refcounttrans =usereleased@*/ + return NULL; } -#define _fdupe(_fns, _data) \ - if ((_fns)->_data != NULL) \ - (_fns)->_data = memcpy(xmalloc((_fns)->fc * sizeof(*(_fns)->_data)), \ - (_fns)->_data, (_fns)->fc * sizeof(*(_fns)->_data)) +#define _fdupe(_fi, _data) \ + if ((_fi)->_data != NULL) \ + (_fi)->_data = memcpy(xmalloc((_fi)->fc * sizeof(*(_fi)->_data)), \ + (_fi)->_data, (_fi)->fc * sizeof(*(_fi)->_data)) -rpmFNSet fnsNew(Header h, rpmTag tagN, int scareMem) +rpmFNSet fiNew(rpmTransactionSet ts, rpmFNSet fi, + Header h, rpmTag tagN, int scareMem) { HGE_t hge = (scareMem ? (HGE_t) headerGetEntryMinMemory : (HGE_t) headerGetEntry); - rpmFNSet fns = NULL; const char * Type; - const char ** N; - rpmTagType Nt; - int_32 Count; + uint_32 * uip; + int malloced = 0; + int len; + int xx; + int i; if (tagN == RPMTAG_BASENAMES) { Type = "Files"; - } else + } else { + Type = "?Type?"; goto exit; + } /*@-branchstate@*/ - if (hge(h, tagN, &Nt, (void **) &N, &Count) - && N != NULL && Count > 0) - { - int xx; + if (fi == NULL) { + fi = xcalloc(1, sizeof(*fi)); + malloced = 0; /* XXX always return with memory alloced. */ + } + /*@=branchstate@*/ - fns = xcalloc(1, sizeof(*fns)); - fns->Type = Type; - fns->h = headerLink(h, fns->Type); - fns->i = -1; - fns->tagN = tagN; - fns->bnl = N; - fns->fc = Count; - - xx = hge(h, RPMTAG_DIRNAMES, NULL, (void **) &fns->dnl, &fns->dc); - - xx = hge(h, RPMTAG_FILELINKTOS, NULL, (void **) &fns->flinks, NULL); - xx = hge(h, RPMTAG_FILELANGS, NULL, (void **) &fns->flangs, NULL); - xx = hge(h, RPMTAG_FILEMD5S, NULL, (void **) &fns->fmd5s, NULL); - - xx = hge(h, RPMTAG_FILEMTIMES, NULL, (void **) &fns->fmtimes, NULL); - xx = hge(h, RPMTAG_FILEMODES, NULL, (void **) &fns->fmodes, NULL); - xx = hge(h, RPMTAG_FILEFLAGS, NULL, (void **) &fns->fflags, NULL); - xx = hge(h, RPMTAG_FILESIZES, NULL, (void **) &fns->fsizes, NULL); - xx = hge(h, RPMTAG_FILERDEVS, NULL, (void **) &fns->frdevs, NULL); - xx = hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &fns->dil, NULL); - - xx = hge(h, RPMTAG_FILEUSERNAME, NULL, (void **) &fns->fuser, NULL); - fns->fuids = NULL; - xx = hge(h, RPMTAG_FILEGROUPNAME, NULL, (void **) &fns->fgroup, NULL); - fns->fgids = NULL; - - xx = hge(h, RPMTAG_FILESTATES, NULL, (void **) &fns->fstates, NULL); - _fdupe(fns, fstates); - - if (xx == 0 || fns->fstates == NULL) - fns->fstates = xcalloc(fns->fc, sizeof(*fns->fstates)); - - if (!scareMem) { - _fdupe(fns, fmtimes); - _fdupe(fns, fmodes); - _fdupe(fns, fflags); - _fdupe(fns, fsizes); - _fdupe(fns, frdevs); - _fdupe(fns, dil); - fns->h = headerFree(fns->h, fns->Type); + fi->magic = TFIMAGIC; + fi->Type = Type; + fi->i = -1; + fi->tagN = tagN; + + fi->hge = hge; + fi->hae = (HAE_t) headerAddEntry; + fi->hme = (HME_t) headerModifyEntry; + fi->hre = (HRE_t) headerRemoveEntry; + fi->hfd = headerFreeData; + + fi->h = (scareMem ? headerLink(h, fi->Type) : NULL); + + if (fi->fsm == NULL) + fi->fsm = newFSM(); + + /* 0 means unknown */ + xx = hge(h, RPMTAG_ARCHIVESIZE, NULL, (void **) &uip, NULL); + fi->archiveSize = (xx ? *uip : 0); + + if (!hge(h, RPMTAG_BASENAMES, NULL, (void **) &fi->bnl, &fi->fc)) { + /*@-branchstate@*/ + if (malloced) { + if (scareMem && fi->h) + fi->h = headerFree(fi->h, fi->Type); + fi->fsm = freeFSM(fi->fsm); + /*@-refcounttrans@*/ + fi = _xfree(fi); + /*@=refcounttrans@*/ + } else { + fi->fc = 0; + fi->dc = 0; } + /*@=branchstate@*/ + goto exit; + } + xx = hge(h, RPMTAG_DIRNAMES, NULL, (void **) &fi->dnl, &fi->dc); + xx = hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &fi->dil, NULL); + xx = hge(h, RPMTAG_FILEMODES, NULL, (void **) &fi->fmodes, NULL); + xx = hge(h, RPMTAG_FILEFLAGS, NULL, (void **) &fi->fflags, NULL); + xx = hge(h, RPMTAG_FILESIZES, NULL, (void **) &fi->fsizes, NULL); + xx = hge(h, RPMTAG_FILESTATES, NULL, (void **) &fi->fstates, NULL); + if (xx == 0 || fi->fstates == NULL) + fi->fstates = xcalloc(fi->fc, sizeof(*fi->fstates)); + else if (!scareMem) + _fdupe(fi, fstates); + + fi->action = FA_UNKNOWN; + fi->flags = 0; + if (fi->actions == NULL) + fi->actions = xcalloc(fi->fc, sizeof(*fi->actions)); + fi->keep_header = (scareMem ? 1 : 0); + + /* XXX TR_REMOVED needs CPIO_MAP_{ABSOLUTE,ADDDOT} CPIO_ALL_HARDLINKS */ + fi->mapflags = + CPIO_MAP_PATH | CPIO_MAP_MODE | CPIO_MAP_UID | CPIO_MAP_GID; + + xx = hge(h, RPMTAG_FILELINKTOS, NULL, (void **) &fi->flinks, NULL); + xx = hge(h, RPMTAG_FILELANGS, NULL, (void **) &fi->flangs, NULL); + + xx = hge(h, RPMTAG_FILEMD5S, NULL, (void **) &fi->fmd5s, NULL); + + /* XXX TR_REMOVED doesn;t need fmtimes or frdevs */ + xx = hge(h, RPMTAG_FILEMTIMES, NULL, (void **) &fi->fmtimes, NULL); + xx = hge(h, RPMTAG_FILERDEVS, NULL, (void **) &fi->frdevs, NULL); + fi->replacedSizes = xcalloc(fi->fc, sizeof(*fi->replacedSizes)); + + xx = hge(h, RPMTAG_FILEUSERNAME, NULL, (void **) &fi->fuser, NULL); + fi->fuids = NULL; + xx = hge(h, RPMTAG_FILEGROUPNAME, NULL, (void **) &fi->fgroup, NULL); + fi->fgids = NULL; + + if (ts != NULL) + if (fi != NULL) + if (fi->te != NULL && fi->te->type == TR_ADDED) { + Header foo; + fi->actions = xcalloc(fi->fc, sizeof(*fi->actions)); + /*@-type@*/ + foo = relocateFileList(ts, fi, h, fi->actions); + /*@=type@*/ + fi->h = headerFree(fi->h, "fiNew fi->h"); + fi->h = headerLink(foo, "fiNew fi->h = foo"); + foo = headerFree(foo, "fiNew foo"); + } -/*@-modfilesystem@*/ -if (_fns_debug < 0) -fprintf(stderr, "*** fi %p\t%s[%d]\n", fns, fns->Type, fns->fc); -/*@=modfilesystem@*/ + if (!scareMem) { + _fdupe(fi, fmtimes); + _fdupe(fi, frdevs); + _fdupe(fi, fsizes); + _fdupe(fi, fflags); + _fdupe(fi, fmodes); + _fdupe(fi, dil); + fi->h = headerFree(fi->h, fi->Type); + } + fi->dnlmax = -1; + for (i = 0; i < fi->dc; i++) { + if ((len = strlen(fi->dnl[i])) > fi->dnlmax) + fi->dnlmax = len; } - /*@=branchstate@*/ + fi->bnlmax = -1; + for (i = 0; i < fi->fc; i++) { + if ((len = strlen(fi->bnl[i])) > fi->bnlmax) + fi->bnlmax = len; + } + fi->dperms = 0755; + fi->fperms = 0644; exit: +/*@-modfilesystem@*/ +if (_fi_debug < 0) +fprintf(stderr, "*** fi %p\t%s[%d]\n", fi, Type, (fi ? fi->fc : 0)); +/*@=modfilesystem@*/ + /*@-nullstate@*/ /* FIX: TFI/rpmFNSet null annotations */ - return rpmfnsLink(fns, (fns ? fns->Type : NULL)); + return rpmfnsLink(fi, (fi ? fi->Type : NULL)); /*@=nullstate@*/ } diff --git a/lib/rpmds.h b/lib/rpmds.h index 6914f72..70be8ea 100644 --- a/lib/rpmds.h +++ b/lib/rpmds.h @@ -30,7 +30,7 @@ struct rpmFNSet_s { rpmTag tagN; /*!< Header tag. */ /*@refcounted@*/ /*@null@*/ - Header h; /*!< Header for file name set (or NULL) */ + Header h; /*!< Header for file set (or NULL) */ /*@only@*/ /*?null?*/ const char ** bnl; /*!< Base name(s) (from header) */ @@ -188,24 +188,28 @@ rpmFNSet XrpmfnsLink (/*@null@*/ rpmFNSet fns, /*@null@*/ const char * msg, #define rpmfnsLink(_fns, _msg) XrpmfnsLink(_fns, _msg, __FILE__, __LINE__) /** - * Destroy a file name set. - * @param ds file name set + * Destroy a file set. + * @param fi file set + * @param freefimem free fi memory too? * @return NULL always */ /*@null@*/ -rpmFNSet fnsFree(/*@killref@*/ /*@only@*/ /*@null@*/ rpmFNSet fns) - /*@modifies fns@*/; +rpmFNSet fiFree(/*@killref@*/ /*@only@*/ /*@null@*/ rpmFNSet fi, int freefimem) + /*@modifies fi@*/; /** - * Create and load a file name set. + * Create and load a file set. + * @param ts transaction set + * @param fi file set (NULL if creating) * @param h header * @param tagN RPMTAG_BASENAMES * @param scareMem Use pointers to refcounted header memory? - * @return new file name set + * @return new file set */ /*@null@*/ -rpmFNSet fnsNew(Header h, rpmTag tagN, int scareMem) - /*@modifies h @*/; +rpmFNSet fiNew(rpmTransactionSet ts, /*@null@*/ rpmFNSet fi, + Header h, rpmTag tagN, int scareMem) + /*@modifies ts, fi, h @*/; /** * Unreference a dependency set instance. diff --git a/lib/rpminstall.c b/lib/rpminstall.c index 9bd844b..7785472 100644 --- a/lib/rpminstall.c +++ b/lib/rpminstall.c @@ -423,7 +423,7 @@ restart: /*@-nullstate@*/ /* FIX: ts->rootDir may be NULL? */ /*@-abstract@*/ - rc = rpmtransAddPackage(ts, eiu->h, NULL, (fnpyKey)fileName, + rc = rpmtransAddPackage(ts, eiu->h, (fnpyKey)fileName, (interfaceFlags & INSTALL_UPGRADE) != 0, relocations); /*@=abstract@*/ diff --git a/lib/rpmlib.h b/lib/rpmlib.h index f5922c9..da82e2f 100644 --- a/lib/rpmlib.h +++ b/lib/rpmlib.h @@ -1415,19 +1415,20 @@ rpmdbMatchIterator rpmtsInitIterator(const rpmTransactionSet ts, int rpmtag, * used, otherwise fd is only needed (and only opened) for actual package * installation. * + * @warning The fd argument has been eliminated, and is assumed always NULL. + * * @param ts transaction set * @param h package header - * @param fd package file handle * @param key package private data * @param upgrade is package being upgraded? * @param relocs package file relocations * @return 0 on success, 1 on I/O error, 2 needs capabilities */ -int rpmtransAddPackage(rpmTransactionSet ts, Header h, /*@null@*/ FD_t fd, +int rpmtransAddPackage(rpmTransactionSet ts, Header h, /*@null@*/ /*@owned@*/ const fnpyKey key, int upgrade, /*@null@*/ rpmRelocation * relocs) /*@globals fileSystem, internalState @*/ - /*@modifies fd, h, ts, fileSystem, internalState @*/; + /*@modifies ts, h, fileSystem, internalState @*/; /** \ingroup rpmtrans * Add package to universe of possible packages to install in transaction set. diff --git a/lib/transaction.c b/lib/transaction.c index 9168dba..bf68f1b 100644 --- a/lib/transaction.c +++ b/lib/transaction.c @@ -98,8 +98,10 @@ static /*@null@*/ void * freeFl(rpmTransactionSet ts, int oc; /*@-usereleased -onlytrans @*/ /* FIX: fi needs to be only */ + /*@-branchstate@*/ for (oc = 0, fi = flList; oc < ts->orderCount; oc++, fi++) - freeFi(fi); + (void) fiFree(fi, 0); + /*@=branchstate@*/ flList = _free(flList); /*@=usereleased =onlytrans @*/ } @@ -1100,11 +1102,19 @@ int keep_header = 0; case TR_ADDED: fi->record = 0; +#ifdef DYING /*@i@*/ fi->h = headerLink(p->h, "xfer to fi->h"); p->h = headerFree(p->h, "xfer to fi->h"); /* XXX header arg unused. */ loadFi(ts, fi, fi->h, keep_header); +#else + /* XXX header arg unused. */ + /*@-nullpass@*/ + (void) fiNew(ts, fi, p->h, RPMTAG_BASENAMES, keep_header); + /*@=nullpass@*/ + p->h = NULL; +#endif if (fi->fc == 0) continue; @@ -1115,6 +1125,7 @@ int keep_header = 0; case TR_REMOVED: fi->record = p->u.removed.dboffset; /* Retrieve erased package header from the database. */ +#ifdef DYING { rpmdbMatchIterator mi; mi = rpmtsInitIterator(ts, RPMDBI_PACKAGES, @@ -1129,6 +1140,22 @@ int keep_header = 0; } /* XXX header arg unused. */ loadFi(ts, fi, fi->h, 0); +#else + { rpmdbMatchIterator mi; + + mi = rpmtsInitIterator(ts, RPMDBI_PACKAGES, + &fi->record, sizeof(fi->record)); + if ((p->h = rpmdbNextIterator(mi)) != NULL) + p->h = headerLink(p->h, "TR_REMOVED loadFi"); + mi = rpmdbFreeIterator(mi); + } + if (p->h == NULL) { + /* ACK! */ + continue; + } + (void) fiNew(ts, fi, p->h, RPMTAG_BASENAMES, 0); + p->h = NULL; +#endif /*@switchbreak@*/ break; } /*@=branchstate@*/ @@ -1258,6 +1285,7 @@ int keep_header = 0; /* Is this file from a package being removed? */ beingRemoved = 0; + if (ts->removedPackages != NULL) for (j = 0; j < ts->numRemovedPackages; j++) { if (ts->removedPackages[j] != shared->otherPkg) /*@innercontinue@*/ continue; @@ -1416,9 +1444,14 @@ int keep_header = 0; pkgKey = p->u.addedKey; rpmMessage(RPMMESS_DEBUG, "========== +++ %s\n", p->NEVR); +#ifdef DYING h = (fi->h ? headerLink(fi->h, "TR_ADDED install") : NULL); /*@-branchstate@*/ - if (p->fd == NULL) { + if (p->fd == NULL) +#else + h = NULL; +#endif + { /*@-noeffectuncon @*/ /* FIX: ??? */ p->fd = ts->notify(fi->h, RPMCALLBACK_INST_OPEN_FILE, 0, 0, p->key, ts->notifyData); @@ -1426,8 +1459,6 @@ int keep_header = 0; if (p->fd != NULL) { rpmRC rpmrc; - h = headerFree(h, "TR_ADDED install"); - /*@-mustmod@*/ /* LCL: segfault */ rpmrc = rpmReadPackageFile(ts, p->fd, "rpmRunTransactions", &h); @@ -1441,39 +1472,42 @@ int keep_header = 0; /*@=noeffectuncon @*/ p->fd = NULL; ourrc++; - } else if (fi->h != NULL) { + } +#ifdef DYING + else { Header foo = relocateFileList(ts, fi, h, NULL); h = headerFree(h, "TR_ADDED read free"); h = headerLink(foo, "TR_ADDED relocate xfer"); foo = headerFree(foo, "TR_ADDED relocate"); } +#endif if (p->fd != NULL) gotfd = 1; } } /*@=branchstate@*/ + /*@-branchstate@*/ if (p->fd != NULL) { - Header hsave = NULL; - - if (fi->h) { - hsave = headerLink(fi->h, "TR_ADDED fi->h hsave"); - fi->h = headerFree(fi->h, "TR_ADDED fi->h free"); - fi->h = headerLink(h, "TR_ADDED fi->h link"); - } else { +#ifdef DYING + fi->h = headerLink(h, "TR_ADDED fi->h link"); +#endif + { char * fstates = fi->fstates; fileAction * actions = fi->actions; fi->fstates = NULL; fi->actions = NULL; - freeFi(fi); + (void) fiFree(fi, 0); +/*@-usereleased@*/ fi->magic = TFIMAGIC; fi->te = p; fi->record = 0; - loadFi(ts, fi, h, 1); + (void) fiNew(ts, fi, h, RPMTAG_BASENAMES, 1); fi->fstates = _free(fi->fstates); fi->fstates = fstates; fi->actions = _free(fi->actions); fi->actions = actions; +/*@=usereleased@*/ } if (p->multiLib) @@ -1483,15 +1517,14 @@ fi->actions = actions; ourrc++; lastKey = pkgKey; } +#ifdef DYING fi->h = headerFree(fi->h, "TR_ADDED fi->h free"); - if (hsave) { - fi->h = headerLink(hsave, "TR_ADDED fi->h restore"); - hsave = headerFree(hsave, "TR_ADDED hsave free"); - } +#endif } else { ourrc++; lastKey = pkgKey; } + /*@=branchstate@*/ h = headerFree(h, "TR_ADDED h free"); @@ -1502,8 +1535,7 @@ fi->actions = actions; /*@=noeffectuncon @*/ p->fd = NULL; } -fi->h = headerFree(fi->h, "TR_ADDED fini"); - freeFi(fi); + (void) fiFree(fi, 0); /*@switchbreak@*/ break; case TR_REMOVED: rpmMessage(RPMMESS_DEBUG, "========== --- %s\n", p->NEVR); @@ -1512,12 +1544,11 @@ fi->h = headerFree(fi->h, "TR_ADDED fini"); if (psmStage(psm, PSM_PKGERASE)) ourrc++; } -fi->h = headerFree(fi->h, "TR_REMOVED fini"); - freeFi(fi); + (void) fiFree(fi, 0); /*@switchbreak@*/ break; } xx = rpmdbSync(ts->rpmdb); - (void) rpmfiUnlink(fi, "tsInstall"); + (void) rpmfiUnlink(psm->fi, "tsInstall"); psm->fi = NULL; psm->te = NULL; } diff --git a/lib/ts.c b/lib/ts.c index 2fd5cbb..19f0f20 100644 --- a/lib/ts.c +++ b/lib/ts.c @@ -185,7 +185,7 @@ static int ftsPrint(FTS * ftsp, FTSENT * fts, rpmTransactionSet ts) indent * (fts->fts_level < 0 ? 0 : fts->fts_level), "", n, v, r); #ifdef NOTYET - xx = rpmtransAddPackage(ts, h, NULL, fts->fts_path, 1, NULL); + xx = rpmtransAddPackage(ts, h, fts->fts_path, 1, NULL); #endif break; diff --git a/lib/verify.c b/lib/verify.c index 7208463..e7801b1 100644 --- a/lib/verify.c +++ b/lib/verify.c @@ -285,7 +285,9 @@ static int rpmVerifyScript(/*@unused@*/ QVA_t qva, rpmTransactionSet ts, /*@modifies ts, h, rpmGlobalMacroContext, fileSystem, internalState @*/ { - TFI_t fi = xcalloc(1, sizeof(*fi)); +#ifdef DYING + TFI_t fi; +#endif PSM_t psm = memset(alloca(sizeof(*psm)), 0, sizeof(*psm)); int rc; @@ -296,20 +298,32 @@ static int rpmVerifyScript(/*@unused@*/ QVA_t qva, rpmTransactionSet ts, ts->scriptFd = fdLink(scriptFd, "rpmVerifyScript"); /*@=type@*/ } +#ifdef DYING fi->magic = TFIMAGIC; + fi = xcalloc(1, sizeof(*fi)); loadFi(ts, fi, h, 1); - memset(psm, 0, sizeof(*psm)); /*@-assignexpose@*/ psm->fi = fi; /*@=assignexpose@*/ - psm->stepName = "verify"; - psm->scriptTag = RPMTAG_VERIFYSCRIPT; - psm->progTag = RPMTAG_VERIFYSCRIPTPROG; - rc = psmStage(psm, PSM_SCRIPT); - freeFi(fi); +#else + /*@-type@*/ + psm->fi = fiNew(ts, NULL, h, RPMTAG_BASENAMES, 1); + /*@=type@*/ +#endif + if (psm->fi != NULL) { /* XXX can't happen */ + psm->stepName = "verify"; + psm->scriptTag = RPMTAG_VERIFYSCRIPT; + psm->progTag = RPMTAG_VERIFYSCRIPTPROG; + rc = psmStage(psm, PSM_SCRIPT); + } + /*@-type@*/ + psm->fi = fiFree(psm->fi, 1); + /*@=type@*/ +#ifdef DYING /*@-refcounttrans@*/ /* FIX: fi needs to be only */ fi = _free(fi); /*@=refcounttrans@*/ +#endif if (scriptFd != NULL) { /*@-type@*/ /* FIX: ??? */ @@ -496,7 +510,7 @@ static int verifyDependencies(/*@unused@*/ QVA_t qva, rpmTransactionSet ts, int i; rpmtransClean(ts); - (void) rpmtransAddPackage(ts, h, NULL, NULL, 0, NULL); + (void) rpmtransAddPackage(ts, h, NULL, 0, NULL); (void) rpmdepCheck(ts, &conflicts, &numConflicts); diff --git a/po/rpm.pot b/po/rpm.pot index ea03291..709e257 100644 --- a/po/rpm.pot +++ b/po/rpm.pot @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2001-11-11 10:55-0500\n" +"POT-Creation-Date: 2001-11-11 15:31-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -596,88 +596,88 @@ msgstr "" msgid "Symlink points to BuildRoot: %s -> %s\n" msgstr "" -#: build/files.c:1501 +#: build/files.c:1502 #, c-format msgid "File doesn't match prefix (%s): %s\n" msgstr "" -#: build/files.c:1525 +#: build/files.c:1526 #, c-format msgid "File not found: %s\n" msgstr "" -#: build/files.c:1568 build/files.c:2180 build/parsePrep.c:50 +#: build/files.c:1569 build/files.c:2181 build/parsePrep.c:50 #, c-format msgid "Bad owner/group: %s\n" msgstr "" -#: build/files.c:1580 +#: build/files.c:1581 #, c-format msgid "File %4d: %07o %s.%s\t %s\n" msgstr "" -#: build/files.c:1684 +#: build/files.c:1685 #, c-format msgid "File needs leading \"/\": %s\n" msgstr "" -#: build/files.c:1707 +#: build/files.c:1708 #, c-format msgid "Glob not permitted: %s\n" msgstr "" -#: build/files.c:1722 +#: build/files.c:1723 #, c-format msgid "File not found by glob: %s\n" msgstr "" -#: build/files.c:1784 +#: build/files.c:1785 #, c-format msgid "Could not open %%files file %s: %s\n" msgstr "" -#: build/files.c:1795 build/pack.c:146 +#: build/files.c:1796 build/pack.c:146 #, c-format msgid "line: %s\n" msgstr "" -#: build/files.c:2168 +#: build/files.c:2169 #, c-format msgid "Bad file: %s: %s\n" msgstr "" #. XXX this error message is probably not seen. -#: build/files.c:2242 +#: build/files.c:2243 #, c-format msgid "Couldn't exec %s: %s\n" msgstr "" -#: build/files.c:2247 +#: build/files.c:2248 #, c-format msgid "Couldn't fork %s: %s\n" msgstr "" -#: build/files.c:2331 +#: build/files.c:2332 #, c-format msgid "%s failed\n" msgstr "" -#: build/files.c:2335 +#: build/files.c:2336 #, c-format msgid "failed to write all data to %s\n" msgstr "" -#: build/files.c:2471 +#: build/files.c:2472 #, c-format msgid "Finding %s: (using %s)...\n" msgstr "" -#: build/files.c:2497 build/files.c:2511 +#: build/files.c:2498 build/files.c:2512 #, c-format msgid "Failed to find %s:\n" msgstr "" -#: build/files.c:2632 +#: build/files.c:2633 #, c-format msgid "Processing files: %s-%s-%s\n" msgstr "" @@ -816,7 +816,7 @@ msgstr "" msgid "Could not open %s: %s\n" msgstr "" -#: build/pack.c:603 lib/psm.c:2101 +#: build/pack.c:603 lib/psm.c:1920 #, c-format msgid "Unable to write package: %s\n" msgstr "" @@ -846,7 +846,7 @@ msgstr "" msgid "Unable to write payload to %s: %s\n" msgstr "" -#: build/pack.c:683 lib/psm.c:2366 +#: build/pack.c:683 lib/psm.c:2185 #, c-format msgid "Wrote: %s\n" msgstr "" @@ -1354,17 +1354,17 @@ msgstr "" msgid "lookup i18N strings in specfile catalog" msgstr "" -#: build/spec.c:230 +#: build/spec.c:232 #, c-format msgid "line %d: Bad number: %s\n" msgstr "" -#: build/spec.c:236 +#: build/spec.c:238 #, c-format msgid "line %d: Bad no%s number: %d\n" msgstr "" -#: build/spec.c:297 +#: build/spec.c:299 #, c-format msgid "line %d: Bad %s number: %s\n" msgstr "" @@ -1415,78 +1415,78 @@ msgstr "" msgid "cannot open Packages database in %s\n" msgstr "" -#: lib/depends.c:414 +#: lib/depends.c:421 #, c-format msgid "package %s was already added, replacing with %s\n" msgstr "" -#: lib/depends.c:683 +#: lib/depends.c:690 msgid "(cached)" msgstr "" -#: lib/depends.c:708 +#: lib/depends.c:715 msgid "(rpmrc provides)" msgstr "" -#: lib/depends.c:724 +#: lib/depends.c:731 msgid "(rpmlib provides)" msgstr "" -#: lib/depends.c:745 +#: lib/depends.c:752 msgid "(db files)" msgstr "" -#: lib/depends.c:757 +#: lib/depends.c:764 msgid "(db provides)" msgstr "" -#: lib/depends.c:770 +#: lib/depends.c:777 msgid "(db package)" msgstr "" -#: lib/depends.c:809 +#: lib/depends.c:816 #, c-format msgid "%9s: (%s, %s) added to Depends cache.\n" msgstr "" -#: lib/depends.c:811 lib/rpmds.c:569 lib/rpmds.c:727 +#: lib/depends.c:818 lib/rpmds.c:667 lib/rpmds.c:825 msgid "NO " msgstr "" -#: lib/depends.c:811 lib/rpmds.c:569 lib/rpmds.c:727 +#: lib/depends.c:818 lib/rpmds.c:667 lib/rpmds.c:825 msgid "YES" msgstr "" -#: lib/depends.c:1153 +#: lib/depends.c:1160 #, c-format msgid "removing %s \"%s\" from tsort relations.\n" msgstr "" #. Record all relations. -#: lib/depends.c:1386 +#: lib/depends.c:1393 msgid "========== recording tsort relations\n" msgstr "" #. T4. Scan for zeroes. -#: lib/depends.c:1457 +#: lib/depends.c:1464 msgid "" "========== tsorting packages (order, #predecessors, #succesors, depth)\n" msgstr "" -#: lib/depends.c:1532 +#: lib/depends.c:1539 msgid "========== successors only (presentation order)\n" msgstr "" -#: lib/depends.c:1592 +#: lib/depends.c:1599 msgid "LOOP:\n" msgstr "" -#: lib/depends.c:1627 +#: lib/depends.c:1634 msgid "========== continuing tsort ...\n" msgstr "" #. Return no. of packages that could not be ordered. -#: lib/depends.c:1632 +#: lib/depends.c:1639 #, c-format msgid "rpmdepOrder failed, %d elements remain\n" msgstr "" @@ -1588,7 +1588,7 @@ msgid "dataLength() RPM_STRING_TYPE count must be 1.\n" msgstr "" #. @-modfilesys@ -#: lib/header.c:384 lib/header_internal.c:161 lib/psm.c:922 +#: lib/header.c:384 lib/header_internal.c:161 lib/psm.c:730 #, c-format msgid "Data type %d not supported\n" msgstr "" @@ -2207,74 +2207,74 @@ msgstr "" msgid "relocating directory %s to %s\n" msgstr "" -#: lib/psm.c:1119 +#: lib/psm.c:927 #, c-format msgid "cannot create %%%s %s\n" msgstr "" -#: lib/psm.c:1125 +#: lib/psm.c:933 #, c-format msgid "cannot write to %%%s %s\n" msgstr "" -#: lib/psm.c:1165 +#: lib/psm.c:974 msgid "source package expected, binary found\n" msgstr "" -#: lib/psm.c:1280 +#: lib/psm.c:1095 msgid "source package contains no .spec file\n" msgstr "" -#: lib/psm.c:1392 +#: lib/psm.c:1211 #, c-format msgid "%s: running %s scriptlet\n" msgstr "" -#: lib/psm.c:1560 +#: lib/psm.c:1379 #, c-format msgid "execution of %s scriptlet from %s-%s-%s failed, waitpid returned %s\n" msgstr "" -#: lib/psm.c:1567 +#: lib/psm.c:1386 #, c-format msgid "execution of %s scriptlet from %s-%s-%s failed, exit status %d\n" msgstr "" -#: lib/psm.c:1909 +#: lib/psm.c:1728 #, c-format msgid "%s: %s has %d files, test = %d\n" msgstr "" -#: lib/psm.c:2026 +#: lib/psm.c:1845 #, c-format msgid "%s: %s scriptlet failed (%d), skipping %s\n" msgstr "" -#: lib/psm.c:2137 +#: lib/psm.c:1956 #, c-format msgid "user %s does not exist - using root\n" msgstr "" -#: lib/psm.c:2146 +#: lib/psm.c:1965 #, c-format msgid "group %s does not exist - using root\n" msgstr "" -#: lib/psm.c:2187 +#: lib/psm.c:2006 #, c-format msgid "unpacking of archive failed%s%s: %s\n" msgstr "" -#: lib/psm.c:2188 +#: lib/psm.c:2007 msgid " on file " msgstr "" -#: lib/psm.c:2374 +#: lib/psm.c:2193 #, c-format msgid "%s failed on file %s: %s\n" msgstr "" -#: lib/psm.c:2377 +#: lib/psm.c:2196 #, c-format msgid "%s failed: %s\n" msgstr "" @@ -2473,20 +2473,20 @@ msgid "OK" msgstr "" #. XXX legacy epoch-less requires/conflicts compatibility -#: lib/rpmds.c:697 +#: lib/rpmds.c:795 #, c-format msgid "" "the \"B\" dependency needs an epoch (assuming same as \"A\")\n" "\tA %s\tB %s\n" msgstr "" -#: lib/rpmds.c:726 +#: lib/rpmds.c:824 #, c-format msgid " %s A %s\tB %s\n" msgstr "" #. @=branchstate@ -#: lib/rpmds.c:750 +#: lib/rpmds.c:848 #, c-format msgid "package %s has unsatisfied %s: %s\n" msgstr "" @@ -2815,13 +2815,13 @@ msgstr "" msgid "Signature: UNKNOWN (%d)\n" msgstr "" -#: lib/transaction.c:209 +#: lib/transaction.c:211 #, c-format msgid "%s skipped due to missingok flag\n" msgstr "" #. @innercontinue@ -#: lib/transaction.c:880 +#: lib/transaction.c:882 #, c-format msgid "excluding directory %s\n" msgstr "" @@ -2834,17 +2834,17 @@ msgstr "" msgid "package lacks both group name and id lists (this should never happen)\n" msgstr "" -#: lib/verify.c:421 +#: lib/verify.c:435 #, c-format msgid "missing %s" msgstr "" -#: lib/verify.c:518 +#: lib/verify.c:532 #, c-format msgid "Unsatisifed dependencies for %s: " msgstr "" -#: lib/verify.c:556 +#: lib/verify.c:570 #, c-format msgid "%s-%s-%s: immutable header region digest check failed\n" msgstr "" diff --git a/python/rpmmodule.c b/python/rpmmodule.c index b4b63f5..6991e3b 100644 --- a/python/rpmmodule.c +++ b/python/rpmmodule.c @@ -1311,7 +1311,7 @@ static PyObject * rpmtransAdd(rpmtransObject * s, PyObject * args) { if (how && !strcmp(how, "a")) rpmtransAvailablePackage(s->ts, h->h, key); else - rpmtransAddPackage(s->ts, h->h, NULL, key, isUpgrade, NULL); + rpmtransAddPackage(s->ts, h->h, key, isUpgrade, NULL); /* This should increment the usage count for me */ if (key) { diff --git a/tools/rpmsort.c b/tools/rpmsort.c index f55575f..d8fefe8 100644 --- a/tools/rpmsort.c +++ b/tools/rpmsort.c @@ -157,7 +157,7 @@ restart: } if (rc == 0) { - rc = rpmtransAddPackage(ts, h, NULL, fileName, 0, NULL); + rc = rpmtransAddPackage(ts, h, (fnpyKey)fileName, 0, NULL); headerFree(h, "do_tsort"); continue; }