#include "rpmerr.h"
#include "debug.h"
-/*@access FSM_t @*/
/**
* Convert string to unsigned integer (with buffer size check).
* @param num max no. of bytes to read
* @return converted integer
*/
-static int strntoul(const char *str, /*@out@*/char **endptr, int base, int num)
- /*@modifies *endptr @*/
- /*@requires maxSet(endptr) >= 0 @*/
+static int strntoul(const char *str,char **endptr, int base, int num)
{
char * buf, * end;
unsigned long ret;
buf[num] = '\0';
ret = strtoul(buf, &end, base);
-/*@-boundsread@*/ /* LCL: strtoul annotations */
+/* LCL: strtoul annotations */
if (*end != '\0')
*endptr = ((char *)str) + (end - buf); /* XXX discards const */
else
*endptr = ((char *)str) + strlen(buf);
-/*@=boundsread@*/
return ret;
}
#define GET_NUM_FIELD(phys, log) \
- /*@-boundswrite@*/ \
+ \
log = strntoul(phys, &end, 16, sizeof(phys)); \
- /*@=boundswrite@*/ \
+ \
if ( (end - phys) != sizeof(phys) ) return CPIOERR_BAD_HEADER;
#define SET_NUM_FIELD(phys, val, space) \
sprintf(space, "%8.8lx", (unsigned long) (val)); \
- /*@-boundsread@*/ \
+ \
memcpy(phys, space, 8) \
- /*@=boundsread@*/
int cpioTrailerWrite(FSM_t fsm)
{
(struct cpioCrcPhysicalHeader *)fsm->rdbuf;
int rc;
-/*@-boundswrite@*/
memset(hdr, '0', PHYS_HDR_SIZE);
memcpy(hdr->magic, CPIO_NEWC_MAGIC, sizeof(hdr->magic));
memcpy(hdr->nlink, "00000001", 8);
memcpy(hdr->namesize, "0000000b", 8);
memcpy(fsm->rdbuf + PHYS_HDR_SIZE, CPIO_TRAILER, sizeof(CPIO_TRAILER));
-/*@=boundswrite@*/
/* XXX DWRITE uses rdnb for I/O length. */
fsm->rdnb = PHYS_HDR_SIZE + sizeof(CPIO_TRAILER);
len = strlen(fsm->path) + 1; SET_NUM_FIELD(hdr->namesize, len, field);
memcpy(hdr->checksum, "00000000", 8);
-/*@-boundswrite@*/
memcpy(fsm->rdbuf + PHYS_HDR_SIZE, fsm->path, len);
-/*@=boundswrite@*/
/* XXX DWRITE uses rdnb for I/O length. */
fsm->rdnb = PHYS_HDR_SIZE + len;
}
int cpioHeaderRead(FSM_t fsm, struct stat * st)
- /*@modifies fsm, *st @*/
{
struct cpioCrcPhysicalHeader hdr;
int nameSize;
if (!rc && fsm->rdnb != fsm->wrlen)
rc = CPIOERR_READ_FAILED;
if (rc) return rc;
-/*@-boundswrite@*/
memcpy(&hdr, fsm->wrbuf, fsm->rdnb);
-/*@=boundswrite@*/
if (strncmp(CPIO_CRC_MAGIC, hdr.magic, sizeof(CPIO_CRC_MAGIC)-1) &&
strncmp(CPIO_NEWC_MAGIC, hdr.magic, sizeof(CPIO_NEWC_MAGIC)-1))
GET_NUM_FIELD(hdr.devMajor, major);
GET_NUM_FIELD(hdr.devMinor, minor);
- /*@-shiftimplementation@*/
st->st_dev = makedev(major, minor);
- /*@=shiftimplementation@*/
GET_NUM_FIELD(hdr.rdevMajor, major);
GET_NUM_FIELD(hdr.rdevMinor, minor);
- /*@-shiftimplementation@*/
st->st_rdev = makedev(major, minor);
- /*@=shiftimplementation@*/
GET_NUM_FIELD(hdr.namesize, nameSize);
if (nameSize >= fsm->wrsize)
fsm->path = NULL;
return rc;
}
-/*@-boundswrite@*/
memcpy(t, fsm->wrbuf, fsm->rdnb);
t[nameSize] = '\0';
-/*@=boundswrite@*/
fsm->path = t;
}
int l, myerrno = errno;
strcpy(msg, "cpio: ");
- /*@-branchstate@*/
switch (rc) {
default:
s = msg + strlen(msg);
case CPIOERR_ENOENT: s = strerror(ENOENT); break;
case CPIOERR_ENOTEMPTY: s = strerror(ENOTEMPTY); break;
}
- /*@=branchstate@*/
l = sizeof(msg) - strlen(msg) - 1;
if (s != NULL) {
if (l > 0) strncat(msg, s, l);
l -= strlen(s);
}
- /*@-branchstate@*/
if ((rc & CPIOERR_CHECK_ERRNO) && myerrno) {
s = _(" failed - ");
if (l > 0) strncat(msg, s, l);
l -= strlen(s);
if (l > 0) strncat(msg, strerror(myerrno), l);
}
- /*@=branchstate@*/
return msg;
}
* @retval fsm file path and stat info
* @return 0 on success
*/
-int cpioTrailerWrite(FSM_t fsm)
- /*@globals h_errno, fileSystem, internalState @*/
- /*@modifies fsm, fileSystem, internalState @*/;
+int cpioTrailerWrite(FSM_t fsm);
/**
* Write cpio header.
* @param st
* @return 0 on success
*/
-int cpioHeaderWrite(FSM_t fsm, struct stat * st)
- /*@globals h_errno, fileSystem, internalState @*/
- /*@modifies fsm, fileSystem, internalState @*/;
+int cpioHeaderWrite(FSM_t fsm, struct stat * st);
/**
* Read cpio header.
* @retval st
* @return 0 on success
*/
-int cpioHeaderRead(FSM_t fsm, struct stat * st)
- /*@globals h_errno, fileSystem, internalState @*/
- /*@modifies fsm, *st, fileSystem, internalState @*/;
+int cpioHeaderRead(FSM_t fsm, struct stat * st);
/** \ingroup payload
* Return formatted error message on payload handling failure.
* @param rc error code
* @return formatted error string
*/
-/*@observer@*/ const char * cpioStrerror(int rc)
- /*@*/;
+const char * cpioStrerror(int rc);
#ifdef __cplusplus
}
#include "debug.h"
-/*@access tsortInfo @*/
-/*@access rpmts @*/
-
-/*@access dbiIndex @*/ /* XXX for dbi->dbi_txnid */
-
-/*@access alKey @*/ /* XXX for reordering and RPMAL_NOMATCH assign */
/**
*/
-typedef /*@abstract@*/ struct orderListIndex_s * orderListIndex;
-/*@access orderListIndex@*/
+typedef struct orderListIndex_s * orderListIndex;
/**
*/
struct orderListIndex_s {
-/*@dependent@*/
alKey pkgKey;
int orIndex;
};
-/*@unchecked@*/
int _cacheDependsRC = 1;
-/*@observer@*/ /*@unchecked@*/
const char *rpmNAME = PACKAGE;
-/*@observer@*/ /*@unchecked@*/
const char *rpmEVR = VERSION;
-/*@unchecked@*/
int rpmFLAGS = RPMSENSE_EQUAL;
/**
* @return result of comparison
*/
static int intcmp(const void * a, const void * b)
- /*@requires maxRead(a) == 0 /\ maxRead(b) == 0 @*/
{
const int * aptr = a;
const int * bptr = b;
* @return 0 on success
*/
static int removePackage(rpmts ts, Header h, int dboffset,
- /*@exposed@*/ /*@dependent@*/ /*@null@*/ alKey depends)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies ts, h, rpmGlobalMacroContext, fileSystem, internalState @*/
+ alKey depends)
{
rpmte p;
/* Filter out duplicate erasures. */
if (ts->numRemovedPackages > 0 && ts->removedPackages != NULL) {
-/*@-boundswrite@*/
if (bsearch(&dboffset, ts->removedPackages, ts->numRemovedPackages,
sizeof(*ts->removedPackages), intcmp) != NULL)
return 0;
-/*@=boundswrite@*/
}
if (ts->numRemovedPackages == ts->allocedRemovedPackages) {
}
if (ts->removedPackages != NULL) { /* XXX can't happen. */
-/*@-boundswrite@*/
ts->removedPackages[ts->numRemovedPackages] = dboffset;
ts->numRemovedPackages++;
-/*@=boundswrite@*/
if (ts->numRemovedPackages > 1)
qsort(ts->removedPackages, ts->numRemovedPackages,
sizeof(*ts->removedPackages), intcmp);
if (ts->orderCount >= ts->orderAlloced) {
ts->orderAlloced += (ts->orderCount - ts->orderAlloced) + ts->delta;
-/*@-type +voidabstract @*/
ts->order = xrealloc(ts->order, sizeof(*ts->order) * ts->orderAlloced);
-/*@=type =voidabstract @*/
}
p = rpmteNew(ts, h, TR_REMOVED, NULL, NULL, dboffset, depends);
-/*@-boundswrite@*/
ts->order[ts->orderCount] = p;
ts->orderCount++;
-/*@=boundswrite@*/
return 0;
}
addheader:
if (oc >= ts->orderAlloced) {
ts->orderAlloced += (oc - ts->orderAlloced) + ts->delta;
-/*@-type +voidabstract @*/
ts->order = xrealloc(ts->order, ts->orderAlloced * sizeof(*ts->order));
-/*@=type =voidabstract @*/
}
p = rpmteNew(ts, h, TR_ADDED, key, relocs, -1, pkgKey);
if (duplicate && oc < ts->orderCount) {
-/*@-type -unqualifiedtrans@*/
-/*@-boundswrite@*/
ts->order[oc] = rpmteFree(ts->order[oc]);
-/*@=boundswrite@*/
-/*@=type =unqualifiedtrans@*/
}
-/*@-boundswrite@*/
ts->order[oc] = p;
-/*@=boundswrite@*/
if (!duplicate) {
ts->orderCount++;
rpmcliPackagesTotal++;
rpmteDS(p, RPMTAG_PROVIDENAME),
rpmteFI(p, RPMTAG_BASENAMES), tscolor);
if (pkgKey == RPMAL_NOMATCH) {
-/*@-boundswrite@*/
ts->order[oc] = rpmteFree(ts->order[oc]);
-/*@=boundswrite@*/
ec = 1;
goto exit;
}
/* XXX provides *are* colored, effectively limiting Obsoletes:
to matching only colored Provides: based on pkg coloring. */
if (tscolor && hcolor && ohcolor && !(hcolor & ohcolor))
- /*@innercontinue@*/ continue;
+ continue;
/*
* Rpm prior to 3.0.3 does not have versioned obsoletes.
if (rpmVersionCompare(h, oh))
#endif
xx = removePackage(ts, oh, rpmdbGetIteratorOffset(mi), pkgKey);
-/*@-nullptrarith@*/
rpmMessage(RPMMESS_DEBUG, _(" Obsoletes: %s\t\terases %s\n"),
rpmdsDNEVR(obsoletes)+2, ohNEVRA);
-/*@=nullptrarith@*/
ohNEVRA = _free(ohNEVRA);
}
}
* @return 0 if satisfied, 1 if not satisfied, 2 if error
*/
static int unsatisfiedDepend(rpmts ts, rpmds dep, int adding)
- /*@globals _cacheDependsRC, rpmGlobalMacroContext, h_errno,
- fileSystem, internalState @*/
- /*@modifies ts, _cacheDependsRC, rpmGlobalMacroContext,
- fileSystem, internalState @*/
{
DBT * key = alloca(sizeof(*key));
DBT * data = alloca(sizeof(*data));
const char * DNEVR;
rc = -1;
-/*@-branchstate@*/
if ((DNEVR = rpmdsDNEVR(dep)) != NULL) {
DBC * dbcursor = NULL;
void * datap = NULL;
xx = dbiCopen(dbi, dbi->dbi_txnid, &dbcursor, 0);
memset(key, 0, sizeof(*key));
-/*@i@*/ key->data = (void *) DNEVR;
+ key->data = (void *) DNEVR;
key->size = DNEVRlen;
memset(data, 0, sizeof(*data));
data->data = datap;
data->size = datalen;
-/*@-nullstate@*/ /* FIX: data->data may be NULL */
+/* FIX: data->data may be NULL */
xx = dbiGet(dbi, dbcursor, key, data, DB_SET);
-/*@=nullstate@*/
DNEVR = key->data;
DNEVRlen = key->size;
datap = data->data;
datalen = data->size;
-/*@-boundswrite@*/
if (xx == 0 && datap && datalen == 4)
memcpy(&rc, datap, datalen);
-/*@=boundswrite@*/
xx = dbiCclose(dbi, dbcursor, 0);
}
-/*@=branchstate@*/
if (rc >= 0) {
rpmdsNotify(dep, _("(cached)"), rc);
rc = 0; /* assume dependency is satisfied */
#if defined(DYING)
- { static /*@observer@*/ const char noProvidesString[] = "nada";
- static /*@observer@*/ const char * rcProvidesString = noProvidesString;
+ { static const char noProvidesString[] = "nada";
+ static const char * rcProvidesString = noProvidesString;
int_32 Flags = rpmdsFlags(dep);
const char * start;
int i;
if (rcProvidesString != NULL && !(Flags & RPMSENSE_SENSEMASK)) {
i = strlen(Name);
- /*@-observertrans -mayaliasunique@*/
while ((start = strstr(rcProvidesString, Name))) {
- /*@=observertrans =mayaliasunique@*/
-/*@-boundsread@*/
if (xisspace(start[i]) || start[i] == '\0' || start[i] == ',') {
rpmdsNotify(dep, _("(rpmrc provides)"), rc);
goto exit;
}
-/*@=boundsread@*/
rcProvidesString = start + 1;
}
}
/* XXX only the installer does not have the database open here. */
if (rpmtsGetRdb(ts) != NULL) {
-/*@-boundsread@*/
if (Name[0] == '/') {
/* depFlags better be 0! */
}
mi = rpmdbFreeIterator(mi);
}
-/*@=boundsread@*/
mi = rpmtsInitIterator(ts, RPMTAG_PROVIDENAME, Name, 0);
(void) rpmdbPruneIterator(mi,
/*
* Search for an unsatisfied dependency.
*/
-/*@-boundsread@*/
if (adding && !retrying && !(rpmtsFlags(ts) & RPMTRANS_FLAG_NOSUGGEST)) {
if (ts->solve != NULL) {
xx = (*ts->solve) (ts, dep, ts->solveData);
}
}
}
-/*@=boundsread@*/
unsatisfied:
rc = 1; /* dependency is unsatisfied */
} else {
const char * DNEVR;
xx = 0;
- /*@-branchstate@*/
if ((DNEVR = rpmdsDNEVR(dep)) != NULL) {
DBC * dbcursor = NULL;
size_t DNEVRlen = strlen(DNEVR);
xx = dbiCopen(dbi, dbi->dbi_txnid, &dbcursor, DB_WRITECURSOR);
memset(key, 0, sizeof(*key));
-/*@i@*/ key->data = (void *) DNEVR;
+ key->data = (void *) DNEVR;
key->size = DNEVRlen;
memset(data, 0, sizeof(*data));
data->data = &rc;
data->size = sizeof(rc);
- /*@-compmempass@*/
xx = dbiPut(dbi, dbcursor, key, data, 0);
- /*@=compmempass@*/
xx = dbiCclose(dbi, dbcursor, DB_WRITECURSOR);
}
- /*@=branchstate@*/
if (xx)
_cacheDependsRC = 0;
}
* @return 0 no problems found
*/
static int checkPackageDeps(rpmts ts, const char * pkgNEVRA,
- /*@null@*/ rpmds requires, /*@null@*/ rpmds conflicts,
- /*@null@*/ const char * depName, uint_32 tscolor, int adding)
- /*@globals rpmGlobalMacroContext, h_errno,
- fileSystem, internalState @*/
- /*@modifies ts, requires, conflicts, rpmGlobalMacroContext,
- fileSystem, internalState */
+ rpmds requires, rpmds conflicts,
+ const char * depName, uint_32 tscolor, int adding)
{
uint_32 dscolor;
const char * Name;
switch (rc) {
case 0: /* requirements are satisfied. */
- /*@switchbreak@*/ break;
+ break;
case 1: /* requirements are not satisfied. */
{ fnpyKey * suggestedKeys = NULL;
- /*@-branchstate@*/
if (ts->availablePackages != NULL) {
suggestedKeys = rpmalAllSatisfiesDepend(ts->availablePackages,
requires, NULL);
}
- /*@=branchstate@*/
rpmdsProblem(ts->probs, pkgNEVRA, requires, suggestedKeys, adding);
}
- /*@switchbreak@*/ break;
+ break;
case 2: /* something went wrong! */
default:
ourrc = 1;
- /*@switchbreak@*/ break;
+ break;
}
}
switch (rc) {
case 0: /* conflicts exist. */
rpmdsProblem(ts->probs, pkgNEVRA, conflicts, NULL, adding);
- /*@switchbreak@*/ break;
+ break;
case 1: /* conflicts don't exist. */
- /*@switchbreak@*/ break;
+ break;
case 2: /* something went wrong! */
default:
ourrc = 1;
- /*@switchbreak@*/ break;
+ break;
}
}
* @return 0 no problems found
*/
static int checkPackageSet(rpmts ts, const char * dep,
- /*@only@*/ /*@null@*/ rpmdbMatchIterator mi, int adding)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies ts, mi, rpmGlobalMacroContext, fileSystem, internalState @*/
+ rpmdbMatchIterator mi, int adding)
{
int scareMem = 1;
Header h;
* @return 0 no problems found
*/
static int checkDependentPackages(rpmts ts, const char * dep)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/
{
rpmdbMatchIterator mi;
mi = rpmtsInitIterator(ts, RPMTAG_REQUIRENAME, dep, 0);
* @return 0 no problems found
*/
static int checkDependentConflicts(rpmts ts, const char * dep)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/
{
int rc = 0;
}
struct badDeps_s {
-/*@observer@*/ /*@owned@*/ /*@null@*/
const char * pname;
-/*@observer@*/ /*@dependent@*/ /*@null@*/
const char * qname;
};
#ifdef REFERENCE
static struct badDeps_s {
-/*@observer@*/ /*@null@*/ const char * pname;
-/*@observer@*/ /*@null@*/ const char * qname;
+const char * pname;
+const char * qname;
} badDeps[] = {
{ NULL, NULL }
};
#else
-/*@unchecked@*/
static int badDepsInitialized = 0;
-/*@unchecked@*/ /*@only@*/ /*@null@*/
static struct badDeps_s * badDeps = NULL;
#endif
/**
*/
-/*@-modobserver -observertrans @*/
static void freeBadDeps(void)
- /*@globals badDeps, badDepsInitialized @*/
- /*@modifies badDeps, badDepsInitialized @*/
{
if (badDeps) {
struct badDeps_s * bdp;
}
badDepsInitialized = 0;
}
-/*@=modobserver =observertrans @*/
/**
* Check for dependency relations to be ignored.
* @param q predecessor element (i.e. with Provides: )
* @return 1 if dependency is to be ignored.
*/
-/*@-boundsread@*/
static int ignoreDep(const rpmts ts, const rpmte p, const rpmte q)
- /*@globals badDeps, badDepsInitialized,
- rpmGlobalMacroContext, h_errno @*/
- /*@modifies badDeps, badDepsInitialized,
- rpmGlobalMacroContext @*/
{
struct badDeps_s * bdp;
if ((qname = strchr(pname, '>')) != NULL)
*qname++ = '\0';
bdp->pname = pname;
- /*@-usereleased@*/
bdp->qname = qname;
- /*@=usereleased@*/
rpmMessage(msglvl,
_("ignore package name relation(s) [%d]\t%s -> %s\n"),
i, bdp->pname, (bdp->qname ? bdp->qname : "???"));
badDepsInitialized++;
}
- /*@-compdef@*/
if (badDeps != NULL)
for (bdp = badDeps; bdp->pname != NULL && bdp->qname != NULL; bdp++) {
if (!strcmp(rpmteN(p), bdp->pname) && !strcmp(rpmteN(q), bdp->qname))
return 1;
}
return 0;
- /*@=compdef@*/
}
-/*@=boundsread@*/
/**
* Recursively mark all nodes with their predecessors.
* @param tsi successor chain
* @param q predecessor
*/
-static void markLoop(/*@special@*/ tsortInfo tsi, rpmte q)
- /*@globals internalState @*/
- /*@uses tsi @*/
- /*@modifies internalState @*/
+static void markLoop(tsortInfo tsi, rpmte q)
{
rpmte p;
- /*@-branchstate@*/ /* FIX: q is kept */
+ /* FIX: q is kept */
while (tsi != NULL && (p = tsi->tsi_suc) != NULL) {
tsi = tsi->tsi_next;
if (rpmteTSI(p)->tsi_chain != NULL)
continue;
- /*@-assignexpose -temptrans@*/
rpmteTSI(p)->tsi_chain = q;
- /*@=assignexpose =temptrans@*/
if (rpmteTSI(p)->tsi_next != NULL)
markLoop(rpmteTSI(p)->tsi_next, p);
}
- /*@=branchstate@*/
}
-static inline /*@observer@*/ const char * identifyDepend(int_32 f)
- /*@*/
+static inline const char * identifyDepend(int_32 f)
{
if (isLegacyPreReq(f))
return "PreReq:";
* @param msglvl message level at which to spew
* @return (possibly NULL) formatted "q <- p" releation (malloc'ed)
*/
-/*@-boundswrite@*/
-/*@-mustmod@*/ /* FIX: hack modifies, but -type disables */
-static /*@owned@*/ /*@null@*/ const char *
+/* FIX: hack modifies, but -type disables */
+static const char *
zapRelation(rpmte q, rpmte p,
- /*@null@*/ rpmds requires,
- int zap, /*@in@*/ /*@out@*/ int * nzaps, int msglvl)
- /*@modifies q, p, requires, *nzaps @*/
+ rpmds requires,
+ int zap, int * nzaps, int msglvl)
{
tsortInfo tsi_prev;
tsortInfo tsi;
for (tsi_prev = rpmteTSI(q), tsi = rpmteTSI(q)->tsi_next;
tsi != NULL;
/* XXX Note: the loop traverses "not found", break on "found". */
- /*@-nullderef@*/
tsi_prev = tsi, tsi = tsi->tsi_next)
- /*@=nullderef@*/
{
int_32 Flags;
- /*@-abstractcompare@*/
if (tsi->tsi_suc != p)
continue;
- /*@=abstractcompare@*/
if (requires == NULL) continue; /* XXX can't happen */
/*
* Attempt to unravel a dependency loop by eliminating Requires's.
*/
- /*@-branchstate@*/
if (zap && !(Flags & RPMSENSE_PREREQ)) {
rpmMessage(msglvl,
_("removing %s \"%s\" from tsort relations.\n"),
if (zap)
zap--;
}
- /*@=branchstate@*/
/* XXX Note: the loop traverses "not found", get out now! */
break;
}
return dp;
}
-/*@=mustmod@*/
-/*@=boundswrite@*/
/**
* Record next "q <- p" relation (i.e. "p" requires "q").
* @param requires relation
* @return 0 always
*/
-/*@-mustmod@*/
static inline int addRelation(rpmts ts,
- /*@dependent@*/ rpmte p,
+ rpmte p,
unsigned char * selected,
rpmds requires)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies ts, p, *selected, rpmGlobalMacroContext,
- fileSystem, internalState @*/
{
rpmtsi qi; rpmte q;
tsortInfo tsi;
/* Avoid redundant relations. */
/* XXX TODO: add control bit. */
-/*@-boundsread@*/
if (selected[i] != 0)
return 0;
-/*@=boundsread@*/
-/*@-boundswrite@*/
selected[i] = 1;
-/*@=boundswrite@*/
/* T3. Record next "q <- p" relation (i.e. "p" requires "q"). */
rpmteTSI(p)->tsi_count++; /* bump p predecessor count */
rpmteTSI(q)->tsi_qcnt++; /* bump q successor count */
return 0;
}
-/*@=mustmod@*/
/**
* Compare ordered list entries by index (qsort/bsearch).
* @param two 2nd ordered list entry
* @return result of comparison
*/
-static int orderListIndexCmp(const void * one, const void * two) /*@*/
+static int orderListIndexCmp(const void * one, const void * two)
{
- /*@-castexpose@*/
long a = (long) ((const orderListIndex)one)->pkgKey;
long b = (long) ((const orderListIndex)two)->pkgKey;
- /*@=castexpose@*/
return (a - b);
}
* @retval qp address of first element
* @retval rp address of last element
*/
-/*@-boundswrite@*/
-/*@-mustmod@*/
-static void addQ(/*@dependent@*/ rpmte p,
- /*@in@*/ /*@out@*/ rpmte * qp,
- /*@in@*/ /*@out@*/ rpmte * rp,
+static void addQ(rpmte p,
+ rpmte * qp,
+ rpmte * rp,
uint_32 prefcolor)
- /*@modifies p, *qp, *rp @*/
{
rpmte q, qprev;
rpmteTSI(p)->tsi_reqx = 1;
if ((*rp) == NULL) { /* 1st element */
- /*@-dependenttrans@*/ /* FIX: double indirection */
+ /* FIX: double indirection */
(*rp) = (*qp) = p;
- /*@=dependenttrans@*/
return;
}
if (qprev == NULL) { /* insert at beginning of list */
rpmteTSI(p)->tsi_suc = q;
- /*@-dependenttrans@*/
(*qp) = p; /* new head */
- /*@=dependenttrans@*/
} else if (q == NULL) { /* insert at end of list */
rpmteTSI(qprev)->tsi_suc = p;
- /*@-dependenttrans@*/
(*rp) = p; /* new tail */
- /*@=dependenttrans@*/
} else { /* insert between qprev and q */
rpmteTSI(p)->tsi_suc = q;
rpmteTSI(qprev)->tsi_suc = p;
}
}
-/*@=mustmod@*/
-/*@=boundswrite@*/
-/*@-bounds@*/
int rpmtsOrder(rpmts ts)
{
rpmds requires;
case TR_REMOVED:
/* Skip if not %preun/%postun requires or legacy prereq. */
if (!( isErasePreReq(Flags) || isLegacyPreReq(Flags) ) )
- /*@innercontinue@*/ continue;
- /*@switchbreak@*/ break;
+ continue;
+ break;
case TR_ADDED:
/* Skip if not %pre/%post requires or legacy prereq. */
if (!( isInstallPreReq(Flags) || isLegacyPreReq(Flags) ) )
- /*@innercontinue@*/ continue;
- /*@switchbreak@*/ break;
+ continue;
+ break;
}
/* T3. Record next "q <- p" relation (i.e. "p" requires "q"). */
/* Skip if %preun/%postun requires or legacy prereq. */
if (isInstallPreReq(Flags)
|| ( isErasePreReq(Flags) || isLegacyPreReq(Flags) ) )
- /*@innercontinue@*/ continue;
- /*@switchbreak@*/ break;
+ continue;
+ break;
case TR_ADDED:
/* Skip if %pre/%post requires or legacy prereq. */
if (isErasePreReq(Flags)
|| ( isInstallPreReq(Flags) || isLegacyPreReq(Flags) ) )
- /*@innercontinue@*/ continue;
- /*@switchbreak@*/ break;
+ continue;
+ break;
}
/* T3. Record next "q <- p" relation (i.e. "p" requires "q"). */
case TR_ADDED:
if (!(oType & TR_ADDED))
continue;
- /*@switchbreak@*/ break;
+ break;
case TR_REMOVED:
if (!(oType & TR_REMOVED))
continue;
- /*@switchbreak@*/ break;
+ break;
default:
continue;
- /*@notreached@*/ /*@switchbreak@*/ break;
+ break;
}
deptypechar = (rpmteType(q) == TR_REMOVED ? '-' : '+');
switch (rpmteType(q)) {
case TR_ADDED:
ordering[orderingCount] = rpmteAddedKey(q);
- /*@switchbreak@*/ break;
+ break;
case TR_REMOVED:
ordering[orderingCount] = RPMAL_NOMATCH;
- /*@switchbreak@*/ break;
+ break;
}
orderingCount++;
qlen--;
while ((p = rpmtsiNext(pi, oType)) != NULL) {
/* Is this element in the queue? */
if (rpmteTSI(p)->tsi_reqx == 0)
- /*@innercontinue@*/ continue;
+ continue;
tsi->tsi_suc = p;
tsi = rpmteTSI(p);
}
q = rpmteTSI(q)->tsi_chain)
{
if (rpmteTSI(q)->tsi_reqx)
- /*@innerbreak@*/ break;
+ break;
rpmteTSI(q)->tsi_reqx = 1;
}
requires = rpmteDS(p, RPMTAG_REQUIRENAME);
requires = rpmdsInit(requires);
if (requires == NULL)
- /*@innercontinue@*/ continue; /* XXX can't happen */
+ continue; /* XXX can't happen */
dp = zapRelation(q, p, requires, 1, &nzaps, msglvl);
/* Print next member of loop. */
switch (rpmteType(p)) {
case TR_ADDED:
orderList[j].pkgKey = rpmteAddedKey(p);
- /*@switchbreak@*/ break;
+ break;
case TR_REMOVED:
orderList[j].pkgKey = RPMAL_NOMATCH;
- /*@switchbreak@*/ break;
+ break;
}
orderList[j].orIndex = rpmtsiOc(pi);
j++;
qsort(orderList, numOrderList, sizeof(*orderList), orderListIndexCmp);
-/*@-type@*/
newOrder = xcalloc(ts->orderCount, sizeof(*newOrder));
-/*@=type@*/
- /*@-branchstate@*/
for (i = 0, newOrderCount = 0; i < orderingCount; i++)
{
struct orderListIndex_s key;
if (anaconda)
for (j = needle->orIndex + 1; j < ts->orderCount; j++) {
if ((q = ts->order[j]) == NULL)
- /*@innerbreak@*/ break;
+ break;
if (rpmteType(q) == TR_REMOVED
&& rpmteDependsOnKey(q) == needle->pkgKey)
{
newOrder[newOrderCount++] = q;
ts->order[j] = NULL;
} else
- /*@innerbreak@*/ break;
+ break;
}
}
- /*@=branchstate@*/
for (j = 0; j < ts->orderCount; j++) {
if ((p = ts->order[j]) == NULL)
}
assert(newOrderCount == ts->orderCount);
-/*@+voidabstract@*/
ts->order = _free(ts->order);
-/*@=voidabstract@*/
ts->order = newOrder;
ts->orderAlloced = ts->orderCount;
orderList = _free(orderList);
return 0;
}
-/*@=bounds@*/
int rpmtsCheck(rpmts ts)
{
while ((p = rpmtsiNext(pi, TR_ADDED)) != NULL) {
rpmds provides;
-/*@-nullpass@*/ /* FIX: rpmts{A,O} can return null. */
+ /* FIX: rpmts{A,O} can return null. */
rpmMessage(RPMMESS_DEBUG, "========== +++ %s %s/%s 0x%x\n",
rpmteNEVR(p), rpmteA(p), rpmteO(p), rpmteColor(p));
-/*@=nullpass@*/
rc = checkPackageDeps(ts, rpmteNEVRA(p),
rpmteDS(p, RPMTAG_REQUIRENAME),
rpmteDS(p, RPMTAG_CONFLICTNAME),
const char * Name;
if ((Name = rpmdsN(provides)) == NULL)
- /*@innercontinue@*/ continue; /* XXX can't happen */
+ continue; /* XXX can't happen */
/* Adding: check provides key against conflicts matches. */
if (!checkDependentConflicts(ts, Name))
- /*@innercontinue@*/ continue;
+ continue;
rc = 1;
- /*@innerbreak@*/ break;
+ break;
}
if (rc)
goto exit;
rpmds provides;
rpmfi fi;
-/*@-nullpass@*/ /* FIX: rpmts{A,O} can return null. */
+ /* FIX: rpmts{A,O} can return null. */
rpmMessage(RPMMESS_DEBUG, "========== --- %s %s/%s 0x%x\n",
rpmteNEVR(p), rpmteA(p), rpmteO(p), rpmteColor(p));
-/*@=nullpass@*/
#if defined(DYING)
/* XXX all packages now have Provides: name = version-release */
const char * Name;
if ((Name = rpmdsN(provides)) == NULL)
- /*@innercontinue@*/ continue; /* XXX can't happen */
+ continue; /* XXX can't happen */
/* Erasing: check provides against requiredby matches. */
if (!checkDependentPackages(ts, Name))
- /*@innercontinue@*/ continue;
+ continue;
rc = 1;
- /*@innerbreak@*/ break;
+ break;
}
if (rc)
goto exit;
/* Erasing: check filename against requiredby matches. */
if (!checkDependentPackages(ts, fn))
- /*@innercontinue@*/ continue;
+ continue;
rc = 1;
- /*@innerbreak@*/ break;
+ break;
}
if (rc)
goto exit;
(void) rpmswExit(rpmtsOp(ts, RPMTS_OP_CHECK), 0);
- /*@-branchstate@*/
if (closeatexit)
xx = rpmtsCloseDB(ts);
else if (_cacheDependsRC)
xx = rpmdbCloseDBI(rpmtsGetRdb(ts), RPMDBI_DEPENDS);
- /*@=branchstate@*/
return rc;
}
#include "debug.h"
-/*@access pgpDig @*/
-/*@access pgpDigParams @*/
/**
* Identify type of trigger.
* @param element (unused)
* @return formatted string
*/
-static /*@only@*/ char * triggertypeFormat(int_32 type, const void * data,
- /*@unused@*/ char * formatPrefix, /*@unused@*/ int padding,
- /*@unused@*/ int element)
- /*@requires maxRead(data) >= 0 @*/
+static char * triggertypeFormat(int_32 type, const void * data,
+ char * formatPrefix, int padding,
+ int element)
{
const int_32 * item = data;
char * val;
* @param element (unused)
* @return formatted string
*/
-static /*@only@*/ char * permsFormat(int_32 type, const void * data,
- char * formatPrefix, int padding, /*@unused@*/ int element)
- /*@modifies formatPrefix @*/
- /*@requires maxRead(data) >= 0 @*/
+static char * permsFormat(int_32 type, const void * data,
+ char * formatPrefix, int padding, int element)
{
char * val;
char * buf;
val = xstrdup(_("(not a number)"));
} else {
val = xmalloc(15 + padding);
-/*@-boundswrite@*/
strcat(formatPrefix, "s");
-/*@=boundswrite@*/
buf = rpmPermsString(*((int_32 *) data));
- /*@-formatconst@*/
sprintf(val, formatPrefix, buf);
- /*@=formatconst@*/
buf = _free(buf);
}
* @param element (unused)
* @return formatted string
*/
-static /*@only@*/ char * fflagsFormat(int_32 type, const void * data,
- char * formatPrefix, int padding, /*@unused@*/ int element)
- /*@modifies formatPrefix @*/
- /*@requires maxRead(data) >= 0 @*/
+static char * fflagsFormat(int_32 type, const void * data,
+ char * formatPrefix, int padding, int element)
{
char * val;
char buf[15];
val = xstrdup(_("(not a number)"));
} else {
buf[0] = '\0';
-/*@-boundswrite@*/
if (anint & RPMFILE_DOC)
strcat(buf, "d");
if (anint & RPMFILE_CONFIG)
strcat(buf, "l");
if (anint & RPMFILE_README)
strcat(buf, "r");
-/*@=boundswrite@*/
val = xmalloc(5 + padding);
-/*@-boundswrite@*/
strcat(formatPrefix, "s");
-/*@=boundswrite@*/
- /*@-formatconst@*/
sprintf(val, formatPrefix, buf);
- /*@=formatconst@*/
}
return val;
* @param element no. bytes of binary data
* @return formatted string
*/
-static /*@only@*/ char * armorFormat(int_32 type, const void * data,
- /*@unused@*/ char * formatPrefix, /*@unused@*/ int padding,
+static char * armorFormat(int_32 type, const void * data,
+ char * formatPrefix, int padding,
int element)
- /*@*/
{
const char * enc;
const unsigned char * s;
case RPM_I18NSTRING_TYPE:
default:
return xstrdup(_("(invalid type)"));
- /*@notreached@*/ break;
+ break;
}
/* XXX this doesn't use padding directly, assumes enough slop in retval. */
* @param element
* @return formatted string
*/
-static /*@only@*/ char * base64Format(int_32 type, const void * data,
- /*@unused@*/ char * formatPrefix, int padding, int element)
- /*@*/
+static char * base64Format(int_32 type, const void * data,
+ char * formatPrefix, int padding, int element)
{
char * val;
size_t ns = element;
size_t nt = ((ns + 2) / 3) * 4;
-/*@-boundswrite@*/
- /*@-globs@*/
/* Add additional bytes necessary for eol string(s). */
if (b64encode_chars_per_line > 0 && b64encode_eolstr != NULL) {
lc = (nt + b64encode_chars_per_line - 1) / b64encode_chars_per_line;
++lc;
nt += lc * strlen(b64encode_eolstr);
}
- /*@=globs@*/
val = t = xmalloc(nt + padding + 1);
t = stpcpy(t, enc);
enc = _free(enc);
}
-/*@=boundswrite@*/
}
return val;
/**
*/
static size_t xmlstrlen(const char * s)
- /*@*/
{
size_t len = 0;
int c;
-/*@-boundsread@*/
while ((c = *s++) != '\0')
-/*@=boundsread@*/
{
switch (c) {
- case '<': case '>': len += 4; /*@switchbreak@*/ break;
- case '&': len += 5; /*@switchbreak@*/ break;
- default: len += 1; /*@switchbreak@*/ break;
+ case '<': case '>': len += 4; break;
+ case '&': len += 5; break;
+ default: len += 1; break;
}
}
return len;
/**
*/
-static char * xmlstrcpy(/*@returned@*/ char * t, const char * s)
- /*@modifies t @*/
+static char * xmlstrcpy(char * t, const char * s)
{
char * te = t;
int c;
-/*@-bounds@*/
while ((c = *s++) != '\0') {
switch (c) {
- case '<': te = stpcpy(te, "<"); /*@switchbreak@*/ break;
- case '>': te = stpcpy(te, ">"); /*@switchbreak@*/ break;
- case '&': te = stpcpy(te, "&"); /*@switchbreak@*/ break;
- default: *te++ = c; /*@switchbreak@*/ break;
+ case '<': te = stpcpy(te, "<"); break;
+ case '>': te = stpcpy(te, ">"); break;
+ case '&': te = stpcpy(te, "&"); break;
+ default: *te++ = c; break;
}
}
*te = '\0';
-/*@=bounds@*/
return t;
}
* @param element (unused)
* @return formatted string
*/
-/*@-bounds@*/
-static /*@only@*/ char * xmlFormat(int_32 type, const void * data,
+static char * xmlFormat(int_32 type, const void * data,
char * formatPrefix, int padding,
- /*@unused@*/ int element)
- /*@modifies formatPrefix @*/
+ int element)
{
const char * xtag = NULL;
size_t nb;
unsigned long anint = 0;
int xx;
-/*@-branchstate@*/
switch (type) {
case RPM_I18NSTRING_TYPE:
case RPM_STRING_TYPE:
break;
case RPM_BIN_TYPE:
{ int cpl = b64encode_chars_per_line;
-/*@-mods@*/
b64encode_chars_per_line = 0;
-/*@=mods@*/
-/*@-formatconst@*/
s = base64Format(type, data, formatPrefix, padding, element);
-/*@=formatconst@*/
-/*@-mods@*/
b64encode_chars_per_line = cpl;
-/*@=mods@*/
xtag = "base64";
} break;
case RPM_CHAR_TYPE:
case RPM_STRING_ARRAY_TYPE:
default:
return xstrdup(_("(invalid xml type)"));
- /*@notreached@*/ break;
+ break;
}
-/*@=branchstate@*/
-/*@-branchstate@*/
if (s == NULL) {
int tlen = 32;
t = memset(alloca(tlen+1), 0, tlen+1);
s = t;
xtag = "integer";
}
-/*@=branchstate@*/
nb = xmlstrlen(s);
if (nb == 0) {
}
/* XXX s was malloc'd */
-/*@-branchstate@*/
if (!strcmp(xtag, "base64"))
s = _free(s);
-/*@=branchstate@*/
nb += padding;
val = xmalloc(nb+1);
-/*@-boundswrite@*/
strcat(formatPrefix, "s");
-/*@=boundswrite@*/
-/*@-formatconst@*/
xx = snprintf(val, nb, formatPrefix, t);
-/*@=formatconst@*/
val[nb] = '\0';
return val;
}
-/*@=bounds@*/
/**
* Display signature fingerprint and time.
* @param element (unused)
* @return formatted string
*/
-static /*@only@*/ char * pgpsigFormat(int_32 type, const void * data,
- /*@unused@*/ char * formatPrefix, /*@unused@*/ int padding,
- /*@unused@*/ int element)
- /*@globals fileSystem, internalState @*/
- /*@modifies fileSystem, internalState @*/
+static char * pgpsigFormat(int_32 type, const void * data,
+ char * formatPrefix, int padding,
+ int element)
{
char * val, * t;
} else {
unsigned char * pkt = (byte *) data;
unsigned int pktlen = 0;
-/*@-boundsread@*/
unsigned int v = *pkt;
-/*@=boundsread@*/
pgpTag tag = 0;
unsigned int plen;
unsigned int hlen = 0;
nb += 100;
val = t = xrealloc(val, nb + 1);
-/*@-boundswrite@*/
switch (sigp->pubkey_algo) {
case PGPPUBKEYALGO_DSA:
t = stpcpy(t, "DSA");
if (t + strlen (tempstr) > val + nb)
goto again;
t = stpcpy(t, tempstr);
-/*@=boundswrite@*/
dig = pgpFreeDig(dig);
}
* @param element (unused)
* @return formatted string
*/
-static /*@only@*/ char * depflagsFormat(int_32 type, const void * data,
- char * formatPrefix, int padding, /*@unused@*/ int element)
- /*@modifies formatPrefix @*/
- /*@requires maxRead(data) >= 0 @*/
+static char * depflagsFormat(int_32 type, const void * data,
+ char * formatPrefix, int padding, int element)
{
char * val;
char buf[10];
anint = *((int_32 *) data);
buf[0] = '\0';
-/*@-boundswrite@*/
if (anint & RPMSENSE_LESS)
strcat(buf, "<");
if (anint & RPMSENSE_GREATER)
strcat(buf, ">");
if (anint & RPMSENSE_EQUAL)
strcat(buf, "=");
-/*@=boundswrite@*/
val = xmalloc(5 + padding);
-/*@-boundswrite@*/
strcat(formatPrefix, "s");
-/*@=boundswrite@*/
- /*@-formatconst@*/
sprintf(val, formatPrefix, buf);
- /*@=formatconst@*/
}
return val;
* @retval *freeData data-was-malloc'ed indicator
* @return 0 on success
*/
-static int fsnamesTag( /*@unused@*/ Header h, /*@out@*/ int_32 * type,
- /*@out@*/ void ** data, /*@out@*/ int_32 * count,
- /*@out@*/ int * freeData)
- /*@globals fileSystem, internalState @*/
- /*@modifies *type, *data, *count, *freeData,
- fileSystem, internalState @*/
- /*@requires maxSet(type) >= 0 /\ maxSet(data) >= 0
- /\ maxSet(count) >= 0 /\ maxSet(freeData) >= 0 @*/
+static int fsnamesTag( Header h, int_32 * type,
+ void ** data, int_32 * count,
+ int * freeData)
{
const char ** list;
-/*@-boundswrite@*/
if (rpmGetFilesystemList(&list, count))
return 1;
-/*@=boundswrite@*/
if (type) *type = RPM_STRING_ARRAY_TYPE;
if (data) *((const char ***) data) = list;
* @retval *freeData data-was-malloc'ed indicator
* @return 0 on success
*/
-static int instprefixTag(Header h, /*@null@*/ /*@out@*/ rpmTagType * type,
- /*@null@*/ /*@out@*/ const void ** data,
- /*@null@*/ /*@out@*/ int_32 * count,
- /*@null@*/ /*@out@*/ int * freeData)
- /*@modifies *type, *data, *freeData @*/
- /*@requires maxSet(type) >= 0 /\ maxSet(data) >= 0
- /\ maxSet(count) >= 0 /\ maxSet(freeData) >= 0 @*/
+static int instprefixTag(Header h, rpmTagType * type,
+ const void ** data,
+ int_32 * count,
+ int * freeData)
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
HFD_t hfd = headerFreeData;
return 0;
} else if (hge(h, RPMTAG_INSTPREFIXES, &ipt, (void **) &array, count)) {
if (type) *type = RPM_STRING_TYPE;
-/*@-boundsread@*/
if (data) *data = xstrdup(array[0]);
-/*@=boundsread@*/
if (freeData) *freeData = 1;
array = hfd(array, ipt);
return 0;
* @retval *freeData data-was-malloc'ed indicator
* @return 0 on success
*/
-static int fssizesTag(Header h, /*@out@*/ rpmTagType * type,
- /*@out@*/ const void ** data, /*@out@*/ int_32 * count,
- /*@out@*/ int * freeData)
- /*@globals rpmGlobalMacroContext, h_errno,
- fileSystem, internalState @*/
- /*@modifies *type, *data, *count, *freeData, rpmGlobalMacroContext,
- fileSystem, internalState @*/
- /*@requires maxSet(type) >= 0 /\ maxSet(data) >= 0
- /\ maxSet(count) >= 0 /\ maxSet(freeData) >= 0 @*/
+static int fssizesTag(Header h, rpmTagType * type,
+ const void ** data, int_32 * count,
+ int * freeData)
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
const char ** filenames;
rpmfiBuildFNames(h, RPMTAG_BASENAMES, &filenames, &numFiles);
}
-/*@-boundswrite@*/
if (rpmGetFilesystemList(NULL, count))
return 1;
-/*@=boundswrite@*/
*type = RPM_INT32_TYPE;
*freeData = 1;
return 0;
}
-/*@-boundswrite@*/
if (rpmGetFilesystemUsage(filenames, filesizes, numFiles, &usages, 0))
return 1;
-/*@=boundswrite@*/
*data = usages;
* @retval *freeData data-was-malloc'ed indicator
* @return 0 on success
*/
-static int triggercondsTag(Header h, /*@out@*/ rpmTagType * type,
- /*@out@*/ const void ** data, /*@out@*/ int_32 * count,
- /*@out@*/ int * freeData)
- /*@modifies *type, *data, *count, *freeData @*/
- /*@requires maxSet(type) >= 0 /\ maxSet(data) >= 0
- /\ maxSet(count) >= 0 /\ maxSet(freeData) >= 0 @*/
+static int triggercondsTag(Header h, rpmTagType * type,
+ const void ** data, int_32 * count,
+ int * freeData)
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
HFD_t hfd = headerFreeData;
*data = conds = xmalloc(sizeof(*conds) * numScripts);
*count = numScripts;
*type = RPM_STRING_ARRAY_TYPE;
-/*@-bounds@*/
for (i = 0; i < numScripts; i++) {
chptr = xstrdup("");
for (j = 0; j < numNames; j++) {
if (indices[j] != i)
- /*@innercontinue@*/ continue;
+ continue;
item = xmalloc(strlen(names[j]) + strlen(versions[j]) + 20);
if (flags[j] & RPMSENSE_SENSEMASK) {
conds[i] = chptr;
}
-/*@=bounds@*/
names = hfd(names, tnt);
versions = hfd(versions, tvt);
* @retval *freeData data-was-malloc'ed indicator
* @return 0 on success
*/
-static int triggertypeTag(Header h, /*@out@*/ rpmTagType * type,
- /*@out@*/ const void ** data, /*@out@*/ int_32 * count,
- /*@out@*/ int * freeData)
- /*@modifies *type, *data, *count, *freeData @*/
- /*@requires maxSet(type) >= 0 /\ maxSet(data) >= 0
- /\ maxSet(count) >= 0 /\ maxSet(freeData) >= 0 @*/
+static int triggertypeTag(Header h, rpmTagType * type,
+ const void ** data, int_32 * count,
+ int * freeData)
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
HFD_t hfd = headerFreeData;
*data = conds = xmalloc(sizeof(*conds) * numScripts);
*count = numScripts;
*type = RPM_STRING_ARRAY_TYPE;
-/*@-bounds@*/
for (i = 0; i < numScripts; i++) {
for (j = 0; j < numNames; j++) {
if (indices[j] != i)
- /*@innercontinue@*/ continue;
+ continue;
if (flags[j] & RPMSENSE_TRIGGERPREIN)
conds[i] = xstrdup("prein");
conds[i] = xstrdup("postun");
else
conds[i] = xstrdup("");
- /*@innerbreak@*/ break;
+ break;
}
}
-/*@=bounds@*/
return 0;
}
* @retval *freeData data-was-malloc'ed indicator
* @return 0 on success
*/
-static int filenamesTag(Header h, /*@out@*/ rpmTagType * type,
- /*@out@*/ const void ** data, /*@out@*/ int_32 * count,
- /*@out@*/ int * freeData)
- /*@modifies *type, *data, *count, *freeData @*/
- /*@requires maxSet(type) >= 0 /\ maxSet(data) >= 0
- /\ maxSet(count) >= 0 /\ maxSet(freeData) >= 0 @*/
+static int filenamesTag(Header h, rpmTagType * type,
+ const void ** data, int_32 * count,
+ int * freeData)
{
*type = RPM_STRING_ARRAY_TYPE;
rpmfiBuildFNames(h, RPMTAG_BASENAMES, (const char ***) data, count);
* @retval *freeData data-was-malloc'ed indicator
* @return 0 on success
*/
-static int fileclassTag(Header h, /*@out@*/ rpmTagType * type,
- /*@out@*/ const void ** data, /*@out@*/ int_32 * count,
- /*@out@*/ int * freeData)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem @*/
- /*@modifies h, *type, *data, *count, *freeData,
- rpmGlobalMacroContext, fileSystem @*/
- /*@requires maxSet(type) >= 0 /\ maxSet(data) >= 0
- /\ maxSet(count) >= 0 /\ maxSet(freeData) >= 0 @*/
+static int fileclassTag(Header h, rpmTagType * type,
+ const void ** data, int_32 * count,
+ int * freeData)
{
*type = RPM_STRING_ARRAY_TYPE;
rpmfiBuildFClasses(h, (const char ***) data, count);
* @retval *freeData data-was-malloc'ed indicator
* @return 0 on success
*/
-static int fileprovideTag(Header h, /*@out@*/ rpmTagType * type,
- /*@out@*/ const void ** data, /*@out@*/ int_32 * count,
- /*@out@*/ int * freeData)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies h, *type, *data, *count, *freeData,
- rpmGlobalMacroContext, fileSystem, internalState @*/
- /*@requires maxSet(type) >= 0 /\ maxSet(data) >= 0
- /\ maxSet(count) >= 0 /\ maxSet(freeData) >= 0 @*/
+static int fileprovideTag(Header h, rpmTagType * type,
+ const void ** data, int_32 * count,
+ int * freeData)
{
*type = RPM_STRING_ARRAY_TYPE;
rpmfiBuildFDeps(h, RPMTAG_PROVIDENAME, (const char ***) data, count);
* @retval *freeData data-was-malloc'ed indicator
* @return 0 on success
*/
-static int filerequireTag(Header h, /*@out@*/ rpmTagType * type,
- /*@out@*/ const void ** data, /*@out@*/ int_32 * count,
- /*@out@*/ int * freeData)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies h, *type, *data, *count, *freeData,
- rpmGlobalMacroContext, fileSystem, internalState @*/
- /*@requires maxSet(type) >= 0 /\ maxSet(data) >= 0
- /\ maxSet(count) >= 0 /\ maxSet(freeData) >= 0 @*/
+static int filerequireTag(Header h, rpmTagType * type,
+ const void ** data, int_32 * count,
+ int * freeData)
{
*type = RPM_STRING_ARRAY_TYPE;
rpmfiBuildFDeps(h, RPMTAG_REQUIRENAME, (const char ***) data, count);
/* I18N look aside diversions */
#if defined(ENABLE_NLS)
-/*@-exportlocal -exportheadervar@*/
-/*@unchecked@*/
extern int _nl_msg_cat_cntr; /* XXX GNU gettext voodoo */
-/*@=exportlocal =exportheadervar@*/
#endif
-/*@observer@*/ /*@unchecked@*/
static const char * language = "LANGUAGE";
-/*@observer@*/ /*@unchecked@*/
static const char * _macro_i18ndomains = "%{?_i18ndomains}";
/**
* @retval *freeData data-was-malloc'ed indicator
* @return 0 on success
*/
-static int i18nTag(Header h, int_32 tag, /*@out@*/ rpmTagType * type,
- /*@out@*/ const void ** data, /*@out@*/ int_32 * count,
- /*@out@*/ int * freeData)
- /*@globals rpmGlobalMacroContext, h_errno @*/
- /*@modifies *type, *data, *count, *freeData, rpmGlobalMacroContext @*/
- /*@requires maxSet(type) >= 0 /\ maxSet(data) >= 0
- /\ maxSet(count) >= 0 /\ maxSet(freeData) >= 0 @*/
+static int i18nTag(Header h, int_32 tag, rpmTagType * type,
+ const void ** data, int_32 * count,
+ int * freeData)
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
char * dstring = rpmExpand(_macro_i18ndomains, NULL);
langval = getenv(language);
(void) setenv(language, "en_US", 1);
#if defined(ENABLE_NLS)
-/*@i@*/ ++_nl_msg_cat_cntr;
+ ++_nl_msg_cat_cntr;
#endif
msgid = NULL;
- /*@-branchstate@*/
for (domain = dstring; domain != NULL; domain = de) {
de = strchr(domain, ':');
if (de) *de++ = '\0';
- msgid = /*@-unrecog@*/ dgettext(domain, msgkey) /*@=unrecog@*/;
+ msgid = dgettext(domain, msgkey);
if (msgid != msgkey) break;
}
- /*@=branchstate@*/
/* restore previous environment for msgid -> msgstr resolution */
if (langval)
else
unsetenv(language);
#if defined(ENABLE_NLS)
-/*@i@*/ ++_nl_msg_cat_cntr;
+ ++_nl_msg_cat_cntr;
#endif
if (domain && msgid) {
- *data = /*@-unrecog@*/ dgettext(domain, msgid) /*@=unrecog@*/;
+ *data = dgettext(domain, msgid);
*data = xstrdup(*data); /* XXX xstrdup has side effects. */
*count = 1;
*freeData = 1;
* @retval *freeData data-was-malloc'ed indicator
* @return 0 on success
*/
-static int summaryTag(Header h, /*@out@*/ rpmTagType * type,
- /*@out@*/ const void ** data, /*@out@*/ int_32 * count,
- /*@out@*/ int * freeData)
- /*@globals rpmGlobalMacroContext, h_errno @*/
- /*@modifies *type, *data, *count, *freeData, rpmGlobalMacroContext @*/
- /*@requires maxSet(type) >= 0 /\ maxSet(data) >= 0
- /\ maxSet(count) >= 0 /\ maxSet(freeData) >= 0 @*/
+static int summaryTag(Header h, rpmTagType * type,
+ const void ** data, int_32 * count,
+ int * freeData)
{
return i18nTag(h, RPMTAG_SUMMARY, type, data, count, freeData);
}
* @retval *freeData data-was-malloc'ed indicator
* @return 0 on success
*/
-static int descriptionTag(Header h, /*@out@*/ rpmTagType * type,
- /*@out@*/ const void ** data, /*@out@*/ int_32 * count,
- /*@out@*/ int * freeData)
- /*@globals rpmGlobalMacroContext, h_errno @*/
- /*@modifies *type, *data, *count, *freeData, rpmGlobalMacroContext @*/
- /*@requires maxSet(type) >= 0 /\ maxSet(data) >= 0
- /\ maxSet(count) >= 0 /\ maxSet(freeData) >= 0 @*/
+static int descriptionTag(Header h, rpmTagType * type,
+ const void ** data, int_32 * count,
+ int * freeData)
{
return i18nTag(h, RPMTAG_DESCRIPTION, type, data, count, freeData);
}
* @retval *freeData data-was-malloc'ed indicator
* @return 0 on success
*/
-static int groupTag(Header h, /*@out@*/ rpmTagType * type,
- /*@out@*/ const void ** data, /*@out@*/ int_32 * count,
- /*@out@*/ int * freeData)
- /*@globals rpmGlobalMacroContext, h_errno @*/
- /*@modifies *type, *data, *count, *freeData, rpmGlobalMacroContext @*/
- /*@requires maxSet(type) >= 0 /\ maxSet(data) >= 0
- /\ maxSet(count) >= 0 /\ maxSet(freeData) >= 0 @*/
+static int groupTag(Header h, rpmTagType * type,
+ const void ** data, int_32 * count,
+ int * freeData)
{
return i18nTag(h, RPMTAG_GROUP, type, data, count, freeData);
}
-/*@-type@*/ /* FIX: cast? */
+/* FIX: cast? */
const struct headerSprintfExtension_s rpmHeaderFormats[] = {
{ HEADER_EXT_TAG, "RPMTAG_GROUP", { groupTag } },
{ HEADER_EXT_TAG, "RPMTAG_DESCRIPTION", { descriptionTag } },
{ HEADER_EXT_FORMAT, "xml", { xmlFormat } },
{ HEADER_EXT_MORE, NULL, { (void *) headerDefaultFormats } }
} ;
-/*@=type@*/
#include <rpmmacro.h> /* XXX for rpmGetPath */
#include "debug.h"
-/*@-usereleased -onlytrans@*/
struct fsinfo {
-/*@only@*/ /*@relnull@*/
const char * mntPoint; /*!< path to mount point. */
dev_t dev; /*!< devno for mount point. */
int rdonly; /*!< is mount point read only? */
};
-/*@unchecked@*/
-/*@only@*/ /*@null@*/
static struct fsinfo * filesystems = NULL;
-/*@unchecked@*/
-/*@only@*/ /*@null@*/
static const char ** fsnames = NULL;
-/*@unchecked@*/
static int numFilesystems = 0;
void freeFilesystems(void)
- /*@globals filesystems, fsnames, numFilesystems @*/
- /*@modifies filesystems, fsnames, numFilesystems @*/
{
int i;
-/*@-boundswrite@*/
if (filesystems)
for (i = 0; i < numFilesystems; i++)
filesystems[i].mntPoint = _free(filesystems[i].mntPoint);
-/*@=boundswrite@*/
filesystems = _free(filesystems);
fsnames = _free(fsnames);
* @return 0 on success, 1 on error
*/
static int getFilesystemList(void)
- /*@*/
{
int size;
void * buf;
* @return 0 on success, 1 on error
*/
static int getFilesystemList(void)
- /*@globals filesystems, fsnames, numFilesystems,
- fileSystem, internalState @*/
- /*@modifies filesystems, fsnames, numFilesystems,
- fileSystem, internalState @*/
{
int numAlloced = 10;
struct stat sb;
while (1) {
# if GETMNTENT_ONE
/* this is Linux */
- /*@-modunconnomods -moduncon @*/
our_mntent * itemptr = getmntent(mtab);
if (!itemptr) break;
-/*@-boundsread@*/
item = *itemptr; /* structure assignment */
-/*@=boundsread@*/
mntdir = item.our_mntdir;
#if defined(MNTOPT_RO)
- /*@-compdef@*/
if (hasmntopt(itemptr, MNTOPT_RO) != NULL)
rdonly = 1;
- /*@=compdef@*/
#endif
- /*@=modunconnomods =moduncon @*/
# elif GETMNTENT_TWO
/* Solaris, maybe others */
if (getmntent(mtab, &item)) break;
filesystems[numFilesystems].mntPoint = NULL;
filesystems[numFilesystems].rdonly = 0;
-/*@-boundswrite@*/
fsnames = xcalloc((numFilesystems + 1), sizeof(*fsnames));
for (i = 0; i < numFilesystems; i++)
fsnames[i] = filesystems[i].mntPoint;
fsnames[numFilesystems] = NULL;
-/*@=boundswrite@*/
-/*@-nullstate@*/ /* FIX: fsnames[] may be NULL */
+/* FIX: fsnames[] may be NULL */
return 0;
-/*@=nullstate@*/
}
#endif /* HAVE_MNTCTL */
if (getFilesystemList())
return 1;
-/*@-boundswrite@*/
if (listptr) *listptr = fsnames;
if (num) *num = numFilesystems;
-/*@=boundswrite@*/
return 0;
}
int rpmGetFilesystemUsage(const char ** fileList, int_32 * fssizes, int numFiles,
- uint_32 ** usagesPtr, /*@unused@*/ int flags)
+ uint_32 ** usagesPtr, int flags)
{
uint_32 * usages;
int i, len, j;
sourceDir = rpmGetPath("%{_sourcedir}", NULL);
maxLen = strlen(sourceDir);
-/*@-boundsread@*/
for (i = 0; i < numFiles; i++) {
len = strlen(fileList[i]);
if (maxLen < len) maxLen = len;
}
-/*@=boundsread@*/
-/*@-boundswrite@*/
buf = alloca(maxLen + 1);
lastDir = alloca(maxLen + 1);
dirName = alloca(maxLen + 1);
if (lastDev != sb.st_dev) {
for (j = 0; j < numFilesystems; j++)
if (filesystems && filesystems[j].dev == sb.st_dev)
- /*@innerbreak@*/ break;
+ break;
if (j == numFilesystems) {
rpmError(RPMERR_BADDEV,
strcpy(lastDir, buf);
usages[lastfs] += fssizes[i];
}
-/*@=boundswrite@*/
sourceDir = _free(sourceDir);
-/*@-boundswrite@*/
- /*@-branchstate@*/
if (usagesPtr)
*usagesPtr = usages;
else
usages = _free(usages);
- /*@=branchstate@*/
-/*@=boundswrite@*/
return 0;
}
-/*@=usereleased =onlytrans@*/
#include "debug.h"
-/*@access FD_t @*/ /* XXX void ptr args */
-/*@access FSMI_t @*/
-/*@access FSM_t @*/
-
-/*@access rpmfi @*/
-
#define alloca_strdup(_s) strcpy(alloca(strlen(_s)+1), (_s))
#define _FSM_DEBUG 0
-/*@unchecked@*/
int _fsm_debug = _FSM_DEBUG;
-/*@-exportheadervar@*/
-/*@unchecked@*/
int _fsm_threads = 0;
-/*@=exportheadervar@*/
/* XXX Failure to remove is not (yet) cause for failure. */
-/*@-exportlocal -exportheadervar@*/
-/*@unchecked@*/
int strict_erasures = 0;
-/*@=exportlocal =exportheadervar@*/
rpmts fsmGetTs(const FSM_t fsm) {
const FSMI_t iter = fsm->iter;
- /*@-compdef -refcounttrans -retexpose -usereleased @*/
return (iter ? iter->ts : NULL);
- /*@=compdef =refcounttrans =retexpose =usereleased @*/
}
rpmfi fsmGetFi(const FSM_t fsm)
{
const FSMI_t iter = fsm->iter;
- /*@-compdef -refcounttrans -retexpose -usereleased @*/
return (iter ? iter->fi : NULL);
- /*@=compdef =refcounttrans =retexpose =usereleased @*/
}
#define SUFFIX_RPMORIG ".rpmorig"
* @param suffix suffix to use (NULL disables)
* @retval path to file
*/
-static /*@only@*//*@null@*/
-const char * fsmFsPath(/*@special@*/ /*@null@*/ const FSM_t fsm,
- /*@null@*/ const struct stat * st,
- /*@null@*/ const char * subdir,
- /*@null@*/ const char * suffix)
- /*@uses fsm->dirName, fsm->baseName */
- /*@*/
+static
+const char * fsmFsPath(const FSM_t fsm,
+ const struct stat * st,
+ const char * subdir,
+ const char * suffix)
{
const char * s = NULL;
(st && !S_ISDIR(st->st_mode) ? (subdir ? strlen(subdir) : 0) : 0) +
(st && !S_ISDIR(st->st_mode) ? (suffix ? strlen(suffix) : 0) : 0) +
strlen(fsm->baseName) + 1;
-/*@-boundswrite@*/
s = t = xmalloc(nb);
t = stpcpy(t, fsm->dirName);
if (st && !S_ISDIR(st->st_mode))
t = stpcpy(t, fsm->baseName);
if (st && !S_ISDIR(st->st_mode))
if (suffix) t = stpcpy(t, suffix);
-/*@=boundswrite@*/
}
return s;
}
* @param p file info iterator
* @retval NULL always
*/
-static /*@null@*/ void * mapFreeIterator(/*@only@*//*@null@*/ void * p)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/
+static void * mapFreeIterator(void * p)
{
FSMI_t iter = p;
if (iter) {
-/*@-internalglobs@*/ /* XXX rpmswExit() */
+/* XXX rpmswExit() */
iter->ts = rpmtsFree(iter->ts);
-/*@=internalglobs@*/
iter->fi = rpmfiUnlink(iter->fi, "mapIterator");
}
return _free(p);
*/
static void *
mapInitIterator(rpmts ts, rpmfi fi)
- /*@modifies ts, fi @*/
{
FSMI_t iter = NULL;
* @param a file info iterator
* @return next index, -1 on termination
*/
-static int mapNextIterator(/*@null@*/ void * a)
- /*@*/
+static int mapNextIterator(void * a)
{
FSMI_t iter = a;
int i = -1;
/** \ingroup payload
*/
-/*@-boundsread@*/
static int cpioStrCmp(const void * a, const void * b)
- /*@*/
{
const char * afn = *(const char **)a;
const char * bfn = *(const char **)b;
return strcmp(afn, bfn);
}
-/*@=boundsread@*/
/** \ingroup payload
* Locate archive path in file info.
* @param fsmPath archive path
* @return index into file info, -1 if archive path was not found
*/
-/*@-boundsread@*/
-static int mapFind(/*@null@*/ FSMI_t iter, const char * fsmPath)
- /*@modifies iter @*/
+static int mapFind(FSMI_t iter, const char * fsmPath)
{
int ix = -1;
if (fi && fi->fc > 0 && fi->apath && fsmPath && *fsmPath) {
const char ** p = NULL;
-/*@-boundswrite@*/
if (fi->apath != NULL)
p = bsearch(&fsmPath, fi->apath, fi->fc, sizeof(fsmPath),
cpioStrCmp);
-/*@=boundswrite@*/
if (p) {
iter->i = p - fi->apath;
ix = mapNextIterator(iter);
}
return ix;
}
-/*@=boundsread@*/
/** \ingroup payload
* Directory name iterator.
*/
typedef struct dnli_s {
rpmfi fi;
-/*@only@*/ /*@null@*/
char * active;
int reverse;
int isave;
* @param a directory name iterator
* @retval NULL always
*/
-static /*@null@*/ void * dnlFreeIterator(/*@only@*//*@null@*/ const void * a)
- /*@modifies a @*/
+static void * dnlFreeIterator(const void * a)
{
if (a) {
DNLI_t dnli = (void *)a;
/** \ingroup payload
*/
-static inline int dnlCount(/*@null@*/ const DNLI_t dnli)
- /*@*/
+static inline int dnlCount(const DNLI_t dnli)
{
return (dnli ? dnli->fi->dc : 0);
}
/** \ingroup payload
*/
-static inline int dnlIndex(/*@null@*/ const DNLI_t dnli)
- /*@*/
+static inline int dnlIndex(const DNLI_t dnli)
{
return (dnli ? dnli->isave : -1);
}
* @param reverse traverse directory names in reverse order?
* @return directory name iterator
*/
-/*@-boundsread@*/
-/*@-usereleased@*/
-static /*@only@*/ /*@null@*/
-void * dnlInitIterator(/*@special@*/ const FSM_t fsm,
+static
+void * dnlInitIterator(const FSM_t fsm,
int reverse)
- /*@uses fsm->iter @*/
- /*@*/
+
{
rpmfi fi = fsmGetFi(fsm);
DNLI_t dnli;
dnli = xcalloc(1, sizeof(*dnli));
dnli->fi = fi;
dnli->reverse = reverse;
- /*@-branchstate@*/
dnli->i = (reverse ? fi->dc : 0);
- /*@=branchstate@*/
if (fi->dc) {
dnli->active = xcalloc(fi->dc, sizeof(*dnli->active));
/* Identify parent directories not skipped. */
-/*@-boundswrite@*/
for (i = 0; i < fi->fc; i++)
if (!XFA_SKIPPING(fi->actions[i])) dnli->active[fi->dil[i]] = 1;
-/*@=boundswrite@*/
/* Exclude parent directories that are explicitly included. */
for (i = 0; i < fi->fc; i++) {
int jlen;
if (!dnli->active[j] || j == dil)
- /*@innercontinue@*/ continue;
+ continue;
dnl = fi->dnl[j];
jlen = strlen(dnl);
if (jlen != (dnlen+bnlen+1))
- /*@innercontinue@*/ continue;
+ continue;
if (strncmp(dnl, fi->dnl[dil], dnlen))
- /*@innercontinue@*/ continue;
+ continue;
if (strncmp(dnl+dnlen, fi->bnl[i], bnlen))
- /*@innercontinue@*/ continue;
+ continue;
if (dnl[dnlen+bnlen] != '/' || dnl[dnlen+bnlen+1] != '\0')
- /*@innercontinue@*/ continue;
+ continue;
/* This directory is included in the package. */
-/*@-boundswrite@*/
dnli->active[j] = 0;
-/*@=boundswrite@*/
- /*@innerbreak@*/ break;
+ break;
}
}
}
return dnli;
}
-/*@=usereleased@*/
-/*@=boundsread@*/
/** \ingroup payload
* Return next directory name (from file info).
* @param dnli directory name iterator
* @return next directory name
*/
-/*@-boundsread@*/
-static /*@observer@*/ /*@null@*/
-const char * dnlNextIterator(/*@null@*/ DNLI_t dnli)
- /*@modifies dnli @*/
+static
+const char * dnlNextIterator(DNLI_t dnli)
{
const char * dn = NULL;
}
return dn;
}
-/*@=boundsread@*/
static void * fsmThread(void * arg)
- /*@globals h_errno, fileSystem, internalState @*/
- /*@modifies arg, fileSystem, internalState @*/
{
FSM_t fsm = arg;
-/*@-unqualifiedtrans@*/
return ((void *) ((long) fsmStage(fsm, fsm->nstage)));
-/*@=unqualifiedtrans@*/
}
int fsmNext(FSM_t fsm, fileStage nstage)
- /*@globals h_errno, fileSystem, internalState @*/
- /*@modifies fsm, fileSystem, internalState @*/
{
fsm->nstage = nstage;
if (_fsm_threads)
* @param fsm file state machine data
* @return Is chain only partially filled?
*/
-/*@-boundsread@*/
-static int saveHardLink(/*@special@*/ /*@partial@*/ FSM_t fsm)
- /*@uses fsm->links, fsm->ix, fsm->sb, fsm->goal, fsm->nsuffix @*/
- /*@defines fsm->li @*/
- /*@releases fsm->path @*/
- /*@globals h_errno, fileSystem, internalState @*/
- /*@modifies fsm, fileSystem, internalState @*/
+static int saveHardLink(FSM_t fsm)
{
struct stat * st = &fsm->sb;
int rc = 0;
int j;
/* Find hard link set. */
- /*@-branchstate@*/
for (fsm->li = fsm->links; fsm->li; fsm->li = fsm->li->next) {
if (fsm->li->sb.st_ino == st->st_ino && fsm->li->sb.st_dev == st->st_dev)
break;
}
- /*@=branchstate@*/
/* New hard link encountered, add new link to set. */
-/*@-boundswrite@*/
- /*@-branchstate@*/
if (fsm->li == NULL) {
fsm->li = xcalloc(1, sizeof(*fsm->li));
fsm->li->next = NULL;
if (fsm->goal == FSM_PKGINSTALL)
fsm->li->linksLeft = 0;
- /*@-kepttrans@*/
fsm->li->next = fsm->links;
- /*@=kepttrans@*/
fsm->links = fsm->li;
}
- /*@=branchstate@*/
-/*@=boundswrite@*/
if (fsm->goal == FSM_PKGBUILD) --fsm->li->linksLeft;
-/*@-boundswrite@*/
fsm->li->filex[fsm->li->linksLeft] = fsm->ix;
- /*@-observertrans -dependenttrans@*/
fsm->li->nsuffix[fsm->li->linksLeft] = fsm->nsuffix;
- /*@=observertrans =dependenttrans@*/
-/*@=boundswrite@*/
if (fsm->goal == FSM_PKGINSTALL) fsm->li->linksLeft++;
if (fsm->goal == FSM_PKGBUILD)
rc = fsmNext(fsm, FSM_MAP);
return rc;
}
-/*@=boundsread@*/
/** \ingroup payload
* Destroy set of hard links.
* @param li set of hard links
* @return NULL always
*/
-static /*@null@*/ void * freeHardLink(/*@only@*/ /*@null@*/ struct hardLink_s * li)
- /*@modifies li @*/
+static void * freeHardLink(struct hardLink_s * li)
{
if (li) {
li->nsuffix = _free(li->nsuffix); /* XXX elements are shared */
{
if (fsm) {
fsm->path = _free(fsm->path);
- /*@-branchstate@*/
while ((fsm->li = fsm->links) != NULL) {
fsm->links = fsm->li->next;
fsm->li->next = NULL;
fsm->li = freeHardLink(fsm->li);
}
- /*@=branchstate@*/
fsm->dnlx = _free(fsm->dnlx);
fsm->ldn = _free(fsm->ldn);
fsm->iter = mapFreeIterator(fsm->iter);
RPMCALLBACK_INST_START, fi->archivePos, fi->archiveSize);
}
-/*@-boundswrite@*/
- /*@-assignexpose@*/
fsm->archiveSize = archiveSize;
if (fsm->archiveSize)
*fsm->archiveSize = 0;
fsm->failedFile = failedFile;
if (fsm->failedFile)
*fsm->failedFile = NULL;
- /*@=assignexpose@*/
-/*@=boundswrite@*/
memset(fsm->sufbuf, 0, sizeof(fsm->sufbuf));
if (fsm->goal == FSM_PKGINSTALL) {
rc = fsmUNSAFE(fsm, fsm->goal);
if (rc && !ec) ec = rc;
-/*@-boundswrite@*/
if (fsm->archiveSize && ec == 0)
*fsm->archiveSize = (fdGetCpioPos(fsm->cfd) - pos);
-/*@=boundswrite@*/
-/*@-nullstate@*/ /* FIX: *fsm->failedFile may be NULL */
+/* FIX: *fsm->failedFile may be NULL */
return ec;
-/*@=nullstate@*/
}
int fsmTeardown(FSM_t fsm)
}
static int fsmMapFContext(FSM_t fsm)
- /*@modifies fsm @*/
{
rpmts ts = fsmGetTs(fsm);
struct stat * st = &fsm->sb;
i = fsm->ix;
if (fi && i >= 0 && i < fi->fc) {
-/*@-boundsread@*/
fsm->astriplen = fi->astriplen;
fsm->action = (fi->actions ? fi->actions[i] : fi->action);
fsm->fflags = (fi->fflags ? fi->fflags[i] : fi->flags);
/* src rpms have simple base name in payload. */
fsm->dirName = fi->dnl[fi->dil[i]];
fsm->baseName = fi->bnl[i];
-/*@=boundsread@*/
-/*@-boundswrite@*/
switch (fsm->action) {
case FA_SKIP:
break;
switch (rpmteType(fi->te)) {
case TR_ADDED:
fsm->osuffix = SUFFIX_RPMORIG;
- /*@innerbreak@*/ break;
+ break;
case TR_REMOVED:
fsm->osuffix = SUFFIX_RPMSAVE;
- /*@innerbreak@*/ break;
+ break;
}
break;
default:
break;
}
-/*@=boundswrite@*/
if ((fsm->mapFlags & CPIO_MAP_PATH) || fsm->nsuffix) {
const struct stat * st = &fsm->sb;
* @param fsm file state machine data
* @return 0 on success
*/
-/*@-compdef@*/
-static int expandRegular(/*@special@*/ FSM_t fsm)
- /*@uses fsm->fmd5sum, fsm->md5sum, fsm->sb, fsm->wfd @*/
- /*@globals h_errno, fileSystem, internalState @*/
- /*@modifies fsm, fileSystem, internalState @*/
+static int expandRegular(FSM_t fsm)
{
const struct stat * st = &fsm->sb;
int left = st->st_size;
(void) fsmNext(fsm, FSM_WCLOSE);
return rc;
}
-/*@=compdef@*/
/** \ingroup payload
* Write next item to payload stream.
* @param writeData should data be written?
* @return 0 on success
*/
-/*@-compdef -compmempass@*/
-static int writeFile(/*@special@*/ /*@partial@*/ FSM_t fsm, int writeData)
- /*@uses fsm->path, fsm->opath, fsm->sb, fsm->osb, fsm->cfd @*/
- /*@globals h_errno, fileSystem, internalState @*/
- /*@modifies fsm, fileSystem, internalState @*/
+static int writeFile(FSM_t fsm, int writeData)
{
const char * path = fsm->path;
const char * opath = fsm->opath;
st->st_size = (writeData ? ost->st_size : 0);
- /*@-branchstate@*/
if (S_ISDIR(st->st_mode)) {
st->st_size = 0;
} else if (S_ISLNK(st->st_mode)) {
st->st_size = fsm->rdnb;
symbuf = alloca_strdup(fsm->rdbuf); /* XXX save readlink return. */
}
- /*@=branchstate@*/
if (fsm->mapFlags & CPIO_MAP_ABSOLUTE) {
-/*@-boundswrite@*/
int nb = strlen(fsm->dirName) + strlen(fsm->baseName) + sizeof(".");
char * t = alloca(nb);
*t = '\0';
if (fsm->mapFlags & CPIO_MAP_ADDDOT)
*t++ = '.';
t = stpcpy( stpcpy(t, fsm->dirName), fsm->baseName);
-/*@=boundswrite@*/
} else if (fsm->mapFlags & CPIO_MAP_PATH) {
rpmfi fi = fsmGetFi(fsm);
fsm->path =
}
#ifdef HAVE_MMAP
-/*@-branchstate@*/
if (mapped != (void *)-1) {
xx = msync(mapped, nmapped, MS_ASYNC);
#if defined(MADV_DONTNEED)
xx = madvise(mapped, nmapped, MADV_DONTNEED);
#endif
-/*@-noeffect@*/
xx = munmap(mapped, nmapped);
-/*@=noeffect@*/
fsm->rdbuf = rdbuf;
}
-/*@=branchstate@*/
#endif
} else if (writeData && S_ISLNK(st->st_mode)) {
/* XXX DWRITE uses rdnb for I/O length. */
-/*@-boundswrite@*/
strcpy(fsm->rdbuf, symbuf); /* XXX restore readlink buffer. */
-/*@=boundswrite@*/
fsm->rdnb = strlen(symbuf);
rc = fsmNext(fsm, FSM_DWRITE);
if (rc) goto exit;
exit:
if (fsm->rfd != NULL)
(void) fsmNext(fsm, FSM_RCLOSE);
-/*@-dependenttrans@*/
fsm->opath = opath;
fsm->path = path;
-/*@=dependenttrans@*/
return rc;
}
-/*@=compdef =compmempass@*/
/** \ingroup payload
* Write set of linked files to payload stream.
* @param fsm file state machine data
* @return 0 on success
*/
-static int writeLinkedFile(/*@special@*/ /*@partial@*/ FSM_t fsm)
- /*@uses fsm->path, fsm->nsuffix, fsm->ix, fsm->li, fsm->failedFile @*/
- /*@globals h_errno, fileSystem, internalState @*/
- /*@modifies fsm, fileSystem, internalState @*/
+static int writeLinkedFile(FSM_t fsm)
{
const char * path = fsm->path;
const char * nsuffix = fsm->nsuffix;
fsm->nsuffix = NULL;
fsm->ix = -1;
-/*@-boundswrite@*/
-/*@-branchstate@*/
for (i = fsm->li->nlink - 1; i >= 0; i--) {
if (fsm->li->filex[i] < 0) continue;
fsm->ix = fsm->li->filex[i];
-/*@-compdef@*/
rc = fsmNext(fsm, FSM_MAP);
-/*@=compdef@*/
/* Write data after last link. */
rc = writeFile(fsm, (i == 0));
fsm->path = _free(fsm->path);
fsm->li->filex[i] = -1;
}
-/*@=branchstate@*/
-/*@=boundswrite@*/
fsm->ix = iterIndex;
fsm->nsuffix = nsuffix;
* @param fsm file state machine data
* @return 0 on success
*/
-/*@-boundsread@*/
-/*@-compdef@*/
-static int fsmMakeLinks(/*@special@*/ /*@partial@*/ FSM_t fsm)
- /*@uses fsm->path, fsm->opath, fsm->nsuffix, fsm->ix, fsm->li @*/
- /*@globals h_errno, fileSystem, internalState @*/
- /*@modifies fsm, fileSystem, internalState @*/
+static int fsmMakeLinks(FSM_t fsm)
{
const char * path = fsm->path;
const char * opath = fsm->opath;
rc = fsmNext(fsm, FSM_MAP);
fsm->opath = fsm->path;
fsm->path = NULL;
- /*@-branchstate@*/
for (i = 0; i < fsm->li->nlink; i++) {
if (fsm->li->filex[i] < 0) continue;
if (fsm->li->createdPath == i) continue;
rc = fsmNext(fsm, FSM_LINK);
if (fsm->failedFile && rc != 0 && *fsm->failedFile == NULL) {
ec = rc;
-/*@-boundswrite@*/
*fsm->failedFile = xstrdup(fsm->path);
-/*@=boundswrite@*/
}
fsm->li->linksLeft--;
}
- /*@=branchstate@*/
fsm->path = _free(fsm->path);
fsm->opath = _free(fsm->opath);
fsm->opath = opath;
return ec;
}
-/*@=compdef@*/
-/*@=boundsread@*/
/** \ingroup payload
* Commit hard linked file set atomically.
* @param fsm file state machine data
* @return 0 on success
*/
-/*@-compdef@*/
-static int fsmCommitLinks(/*@special@*/ /*@partial@*/ FSM_t fsm)
- /*@uses fsm->path, fsm->nsuffix, fsm->ix, fsm->sb,
- fsm->li, fsm->links @*/
- /*@globals h_errno, fileSystem, internalState @*/
- /*@modifies fsm, fileSystem, internalState @*/
+static int fsmCommitLinks(FSM_t fsm)
{
const char * path = fsm->path;
const char * nsuffix = fsm->nsuffix;
fsm->nsuffix = NULL;
fsm->ix = -1;
- /*@-branchstate@*/
for (fsm->li = fsm->links; fsm->li; fsm->li = fsm->li->next) {
if (fsm->li->sb.st_ino == st->st_ino && fsm->li->sb.st_dev == st->st_dev)
break;
}
- /*@=branchstate@*/
-/*@-boundswrite@*/
for (i = 0; i < fsm->li->nlink; i++) {
if (fsm->li->filex[i] < 0) continue;
fsm->ix = fsm->li->filex[i];
fsm->path = _free(fsm->path);
fsm->li->filex[i] = -1;
}
-/*@=boundswrite@*/
fsm->ix = iterIndex;
fsm->nsuffix = nsuffix;
fsm->path = path;
return rc;
}
-/*@=compdef@*/
/**
* Remove (if created) directories not explicitly included in package.
* @param fsm file state machine data
* @return 0 on success
*/
-static int fsmRmdirs(/*@special@*/ /*@partial@*/ FSM_t fsm)
- /*@uses fsm->path, fsm->dnlx, fsm->ldn, fsm->rdbuf, fsm->iter @*/
- /*@globals h_errno, fileSystem, internalState @*/
- /*@modifies fsm, fileSystem, internalState @*/
+static int fsmRmdirs(FSM_t fsm)
{
const char * path = fsm->path;
void * dnli = dnlInitIterator(fsm, 1);
int rc = 0;
fsm->path = NULL;
-/*@-boundswrite@*/
dn[0] = '\0';
- /*@-observertrans -dependenttrans@*/
if (fsm->ldn != NULL && fsm->dnlx != NULL)
while ((fsm->path = dnlNextIterator(dnli)) != NULL) {
int dnlen = strlen(fsm->path);
fsm->path = dn;
/* Remove generated directories. */
- /*@-usereleased@*/ /* LCL: te used after release? */
+ /* LCL: te used after release? */
do {
if (*te == '/') {
*te = '\0';
-/*@-compdef@*/
rc = fsmNext(fsm, FSM_RMDIR);
-/*@=compdef@*/
*te = '/';
}
if (rc)
- /*@innerbreak@*/ break;
+ break;
te--;
} while ((te - fsm->path) > fsm->dnlx[dc]);
- /*@=usereleased@*/
}
-/*@=boundswrite@*/
dnli = dnlFreeIterator(dnli);
- /*@=observertrans =dependenttrans@*/
fsm->path = path;
return rc;
* @param fsm file state machine data
* @return 0 on success
*/
-static int fsmMkdirs(/*@special@*/ /*@partial@*/ FSM_t fsm)
- /*@uses fsm->path, fsm->sb, fsm->osb, fsm->rdbuf, fsm->iter,
- fsm->ldn, fsm->ldnlen, fsm->ldnalloc @*/
- /*@defines fsm->dnlx, fsm->ldn @*/
- /*@globals h_errno, fileSystem, internalState @*/
- /*@modifies fsm, fileSystem, internalState @*/
+static int fsmMkdirs(FSM_t fsm)
{
struct stat * st = &fsm->sb;
struct stat * ost = &fsm->osb;
int dc = dnlCount(dnli);
int rc = 0;
int i;
-/*@-compdef@*/
rpmts ts = fsmGetTs(fsm);
-/*@=compdef@*/
security_context_t scon = NULL;
fsm->path = NULL;
-/*@-boundswrite@*/
dn[0] = '\0';
fsm->dnlx = (dc ? xcalloc(dc, sizeof(*fsm->dnlx)) : NULL);
- /*@-observertrans -dependenttrans@*/
if (fsm->dnlx != NULL)
while ((fsm->path = dnlNextIterator(dnli)) != NULL) {
int dnlen = strlen(fsm->path);
if (dnlen <= 1)
continue;
- /*@-compdef -nullpass@*/ /* FIX: fsm->ldn not defined ??? */
if (dnlen <= fsm->ldnlen && !strcmp(fsm->path, fsm->ldn))
continue;
- /*@=compdef =nullpass@*/
/* Copy to avoid const on fsm->path. */
(void) stpcpy(dn, fsm->path);
/* Assume '/' directory exists, "mkdir -p" for others if non-existent */
for (i = 1, te = dn + 1; *te != '\0'; te++, i++) {
if (*te != '/')
- /*@innercontinue@*/ continue;
+ continue;
*te = '\0';
/* Already validated? */
- /*@-usedef -compdef -nullpass -nullderef@*/
if (i < fsm->ldnlen &&
(fsm->ldn[i] == '/' || fsm->ldn[i] == '\0') &&
!strncmp(fsm->path, fsm->ldn, i))
*te = '/';
/* Move pre-existing path marker forward. */
fsm->dnlx[dc] = (te - dn);
- /*@innercontinue@*/ continue;
+ continue;
}
- /*@=usedef =compdef =nullpass =nullderef@*/
/* Validate next component of path. */
rc = fsmUNSAFE(fsm, FSM_LSTAT);
*te = '/';
}
if (rc)
- /*@innerbreak@*/ break;
+ break;
}
if (rc) break;
/* Save last validated path. */
-/*@-compdef@*/ /* FIX: ldn/path annotations ? */
+/* FIX: ldn/path annotations ? */
if (fsm->ldnalloc < (dnlen + 1)) {
fsm->ldnalloc = dnlen + 100;
fsm->ldn = xrealloc(fsm->ldn, fsm->ldnalloc);
strcpy(fsm->ldn, fsm->path);
fsm->ldnlen = dnlen;
}
-/*@=compdef@*/
}
-/*@=boundswrite@*/
dnli = dnlFreeIterator(dnli);
- /*@=observertrans =dependenttrans@*/
fsm->path = path;
st->st_mode = st_mode; /* XXX restore st->st_mode */
-/*@-compdef@*/ /* FIX: ldn/path annotations ? */
+/* FIX: ldn/path annotations ? */
return rc;
-/*@=compdef@*/
}
#ifdef NOTYET
* @param fsm file state machine data
* @return 0 on success
*/
-static int fsmStat(/*@special@*/ /*@partial@*/ FSM_t fsm)
- /*@globals fileSystem, internalState @*/
- /*@modifies fsm, fileSystem, internalState @*/
+static int fsmStat(FSM_t fsm)
{
int rc = 0;
((_x)[sizeof("/dev/log")-1] == '\0' || \
(_x)[sizeof("/dev/log")-1] == ';'))
-/*@-boundsread@*/
-/*@-compmempass@*/
int fsmStage(FSM_t fsm, fileStage stage)
{
#ifdef UNUSED
}
#undef _fafilter
- /*@-branchstate@*/
switch (stage) {
case FSM_UNKNOWN:
break;
/* Exit on end-of-payload. */
if (rc == CPIOERR_HDR_TRAILER) {
rc = 0;
- /*@loopbreak@*/ break;
+ break;
}
/* Exit on error. */
if (rc) {
fsm->postpone = 1;
(void) fsmNext(fsm, FSM_UNDO);
- /*@loopbreak@*/ break;
+ break;
}
/* Extract file from archive. */
rc = fsmNext(fsm, FSM_PROCESS);
if (rc) {
(void) fsmNext(fsm, FSM_UNDO);
- /*@loopbreak@*/ break;
+ break;
}
/* Notify on success. */
rc = fsmNext(fsm, FSM_FINI);
if (rc) {
- /*@loopbreak@*/ break;
+ break;
}
}
break;
/* Exit on end-of-payload. */
if (rc == CPIOERR_HDR_TRAILER) {
rc = 0;
- /*@loopbreak@*/ break;
+ break;
}
/* Rename/erase next item. */
if (fsmNext(fsm, FSM_FINI))
- /*@loopbreak@*/ break;
+ break;
}
break;
case FSM_PKGBUILD:
/* Exit on end-of-payload. */
if (rc == CPIOERR_HDR_TRAILER) {
rc = 0;
- /*@loopbreak@*/ break;
+ break;
}
/* Exit on error. */
if (rc) {
fsm->postpone = 1;
(void) fsmNext(fsm, FSM_UNDO);
- /*@loopbreak@*/ break;
+ break;
}
/* Copy file into archive. */
rc = fsmNext(fsm, FSM_PROCESS);
if (rc) {
(void) fsmNext(fsm, FSM_UNDO);
- /*@loopbreak@*/ break;
+ break;
}
/* Notify on success. */
(void) fsmNext(fsm, FSM_NOTIFY);
if (fsmNext(fsm, FSM_FINI))
- /*@loopbreak@*/ break;
+ break;
}
/* Flush partial sets of hard linked files. */
/* Re-calculate link count for archive header. */
for (j = -1, nlink = 0, i = 0; i < fsm->li->nlink; i++) {
if (fsm->li->filex[i] < 0)
- /*@innercontinue@*/ continue;
+ continue;
nlink++;
if (j == -1) j = i;
}
/* XXX force the contents out as well. */
-/*@-boundswrite@*/
if (j != 0) {
fsm->li->filex[0] = fsm->li->filex[j];
fsm->li->filex[j] = -1;
}
-/*@=boundswrite@*/
fsm->li->sb.st_nlink = nlink;
fsm->sb = fsm->li->sb; /* structure assignment */
/* Detect and create directories not explicitly in package. */
if (fsm->goal == FSM_PKGINSTALL) {
-/*@-compdef@*/
rc = fsmNext(fsm, FSM_MKDIRS);
-/*@=compdef@*/
if (!rc) fsm->mkdirsdone = 1;
}
_("archive file %s was not found in header file list\n"),
fsm->path);
#endif
-/*@-boundswrite@*/
if (fsm->failedFile && *fsm->failedFile == NULL)
*fsm->failedFile = xstrdup(fsm->path);
-/*@=boundswrite@*/
rc = CPIOERR_UNMAPPED_FILE;
} else {
rc = CPIOERR_HDR_TRAILER;
if (rc) break;
/* On non-install, the disk file stat is what's remapped. */
-/*@-boundswrite@*/
if (fsm->goal != FSM_PKGINSTALL)
*st = *ost; /* structure assignment */
-/*@=boundswrite@*/
/* Remap file perms, owner, and group. */
rc = fsmMapAttrs(fsm);
fsm->postpone = XFA_SKIPPING(fsm->action);
if (fsm->goal == FSM_PKGINSTALL || fsm->goal == FSM_PKGBUILD) {
- /*@-evalorder@*/ /* FIX: saveHardLink can modify fsm */
+ /* FIX: saveHardLink can modify fsm */
if (!S_ISDIR(st->st_mode) && st->st_nlink > 1)
fsm->postpone = saveHardLink(fsm);
- /*@=evalorder@*/
}
break;
case FSM_PRE:
for (li = fsm->links, prev = NULL; li; prev = li, li = li->next)
if (li == fsm->li)
- /*@loopbreak@*/ break;
+ break;
if (prev == NULL)
fsm->links = fsm->li->next;
fsm->opath = opath;
}
- /*@-dependenttrans@*/
fsm->path = path;
- /*@=dependenttrans@*/
if (!(rc == CPIOERR_ENOENT)) return rc;
rc = expandRegular(fsm);
} else if (S_ISDIR(st->st_mode)) {
rc = CPIOERR_READ_FAILED;
if (rc) break;
-/*@-boundswrite@*/
fsm->wrbuf[st->st_size] = '\0';
-/*@=boundswrite@*/
/* XXX symlink(fsm->opath, fsm->path) */
- /*@-dependenttrans@*/
fsm->opath = fsm->wrbuf;
- /*@=dependenttrans@*/
rc = fsmUNSAFE(fsm, FSM_VERIFY);
if (rc == CPIOERR_ENOENT)
rc = fsmNext(fsm, FSM_SYMLINK);
}
} else if (S_ISCHR(st->st_mode) ||
S_ISBLK(st->st_mode) ||
- /*@-unrecog@*/ S_ISSOCK(st->st_mode) /*@=unrecog@*/)
+ S_ISSOCK(st->st_mode))
{
rc = fsmUNSAFE(fsm, FSM_VERIFY);
if (rc == CPIOERR_ENOENT)
#endif
errno = saveerrno;
}
-/*@-boundswrite@*/
if (fsm->failedFile && *fsm->failedFile == NULL)
*fsm->failedFile = xstrdup(fsm->path);
-/*@=boundswrite@*/
break;
case FSM_FINI:
if (!fsm->postpone && fsm->commit) {
}
fsm->path = _free(fsm->path);
fsm->opath = _free(fsm->opath);
-/*@-boundswrite@*/
memset(st, 0, sizeof(*st));
memset(ost, 0, sizeof(*ost));
-/*@=boundswrite@*/
break;
case FSM_COMMIT:
/* Rename pre-existing modified or unmanaged file. */
case CPIOERR_ENOTEMPTY:
/* XXX make sure that build side permits %missingok on directories. */
if (fsm->fflags & RPMFILE_MISSINGOK)
- /*@innerbreak@*/ break;
+ break;
/* XXX common error message. */
rpmError(
(strict_erasures ? RPMERR_RMDIR : RPMDEBUG_RMDIR),
_("%s rmdir of %s failed: Directory not empty\n"),
rpmfiTypeString(fi), fsm->path);
- /*@innerbreak@*/ break;
+ break;
default:
rpmError(
(strict_erasures ? RPMERR_RMDIR : RPMDEBUG_RMDIR),
_("%s rmdir of %s failed: %s\n"),
rpmfiTypeString(fi), fsm->path, strerror(errno));
- /*@innerbreak@*/ break;
+ break;
}
} else {
rc = fsmNext(fsm, FSM_UNLINK);
switch (rc) {
case CPIOERR_ENOENT:
if (fsm->fflags & RPMFILE_MISSINGOK)
- /*@innerbreak@*/ break;
- /*@fallthrough@*/
+ break;
default:
rpmError(
(strict_erasures ? RPMERR_UNLINK : RPMDEBUG_UNLINK),
_("%s unlink of %s failed: %s\n"),
rpmfiTypeString(fi), fsm->path, strerror(errno));
- /*@innerbreak@*/ break;
+ break;
}
}
}
/* Notify on success. */
if (!rc) rc = fsmNext(fsm, FSM_NOTIFY);
else if (fsm->failedFile && *fsm->failedFile == NULL) {
-/*@-boundswrite@*/
*fsm->failedFile = fsm->path;
-/*@=boundswrite@*/
fsm->path = NULL;
}
break;
{
for (i = 0 ; i < fsm->li->linksLeft; i++) {
if (fsm->li->filex[i] < 0)
- /*@innercontinue@*/ continue;
+ continue;
rc = CPIOERR_MISSING_HARDLINK;
if (fsm->failedFile && *fsm->failedFile == NULL) {
fsm->ix = fsm->li->filex[i];
if (!fsmNext(fsm, FSM_MAP)) {
-/*@-boundswrite@*/
*fsm->failedFile = fsm->path;
-/*@=boundswrite@*/
fsm->path = NULL;
}
}
- /*@loopbreak@*/ break;
+ break;
}
}
if (fsm->goal == FSM_PKGBUILD &&
}
if (S_ISREG(st->st_mode)) {
char * path = alloca(strlen(fsm->path) + sizeof("-RPMDELETE"));
-/*@-boundswrite@*/
(void) stpcpy( stpcpy(path, fsm->path), "-RPMDELETE");
-/*@=boundswrite@*/
/*
* XXX HP-UX (and other os'es) don't permit unlink on busy
* XXX files.
fsm->path = fsm->opath;
fsm->opath = NULL;
return (rc ? rc : CPIOERR_ENOENT); /* XXX HACK */
- /*@notreached@*/ break;
+ break;
} else if (S_ISDIR(st->st_mode)) {
if (S_ISDIR(ost->st_mode)) return 0;
if (S_ISLNK(ost->st_mode)) {
if (fsm->stage == FSM_PROCESS) rc = fsmNext(fsm, FSM_UNLINK);
if (rc == 0) rc = CPIOERR_ENOENT;
return (rc ? rc : CPIOERR_ENOENT); /* XXX HACK */
- /*@notreached@*/ break;
+ break;
case FSM_UNLINK:
if (fsm->mapFlags & CPIO_SBIT_CHECK) {
fsm->path, (rc < 0 ? strerror(errno) : ""));
if (rc < 0)
switch (errno) {
- case ENOENT: rc = CPIOERR_ENOENT; /*@switchbreak@*/ break;
- case ENOTEMPTY: rc = CPIOERR_ENOTEMPTY; /*@switchbreak@*/ break;
- default: rc = CPIOERR_RMDIR_FAILED; /*@switchbreak@*/ break;
+ case ENOENT: rc = CPIOERR_ENOENT; break;
+ case ENOTEMPTY: rc = CPIOERR_ENOTEMPTY; break;
+ default: rc = CPIOERR_RMDIR_FAILED; break;
}
break;
case FSM_LSETFCON:
if (rc < 0) rc = CPIOERR_MKFIFO_FAILED;
break;
case FSM_MKNOD:
- /*@-unrecog -portability @*/ /* FIX: check S_IFIFO or dev != 0 */
+ /* FIX: check S_IFIFO or dev != 0 */
rc = mknod(fsm->path, (st->st_mode & ~07777), st->st_rdev);
- /*@=unrecog =portability @*/
if (_fsm_debug && (stage & FSM_SYSCALL))
rpmMessage(RPMMESS_DEBUG, " %8s (%s, 0%o, 0x%x) %s\n", cur,
fsm->path, (unsigned)(st->st_mode & ~07777),
break;
case FSM_READLINK:
/* XXX NUL terminated result in fsm->rdbuf, len in fsm->rdnb. */
-/*@-boundswrite@*/
rc = Readlink(fsm->path, fsm->rdbuf, fsm->rdsize - 1);
-/*@=boundswrite@*/
if (_fsm_debug && (stage & FSM_SYSCALL))
rpmMessage(RPMMESS_DEBUG, " %8s (%s, rdbuf, %d) %s\n", cur,
fsm->path, (int)(fsm->rdsize -1), (rc < 0 ? strerror(errno) : ""));
if (rc < 0) rc = CPIOERR_READLINK_FAILED;
else {
fsm->rdnb = rc;
-/*@-boundswrite@*/
fsm->rdbuf[fsm->rdnb] = '\0';
-/*@=boundswrite@*/
rc = 0;
}
break;
fsm->wrlen = (left > fsm->wrsize ? fsm->wrsize : left);
rc = fsmNext(fsm, FSM_DREAD);
if (rc)
- /*@loopbreak@*/ break;
+ break;
}
break;
case FSM_POS:
case FSM_PAD:
left = (modulo - (fdGetCpioPos(fsm->cfd) % modulo)) % modulo;
if (left) {
-/*@-boundswrite@*/
memset(fsm->rdbuf, 0, left);
-/*@=boundswrite@*/
/* XXX DWRITE uses rdnb for I/O length. */
fsm->rdnb = left;
(void) fsmNext(fsm, FSM_DWRITE);
rc = cpioHeaderWrite(fsm, st); /* Write next payload header. */
break;
case FSM_DREAD:
-/*@-boundswrite@*/
fsm->rdnb = Fread(fsm->wrbuf, sizeof(*fsm->wrbuf), fsm->wrlen, fsm->cfd);
-/*@=boundswrite@*/
if (_fsm_debug && (stage & FSM_SYSCALL))
rpmMessage(RPMMESS_DEBUG, " %8s (%s, %d, cfd)\trdnb %d\n",
cur, (fsm->wrbuf == fsm->wrb ? "wrbuf" : "mmap"),
fsm->path, fsm->rfd, fsm->rdbuf);
break;
case FSM_READ:
-/*@-boundswrite@*/
fsm->rdnb = Fread(fsm->rdbuf, sizeof(*fsm->rdbuf), fsm->rdlen, fsm->rfd);
-/*@=boundswrite@*/
if (_fsm_debug && (stage & FSM_SYSCALL))
rpmMessage(RPMMESS_DEBUG, " %8s (rdbuf, %d, rfd)\trdnb %d\n",
cur, (int)fsm->rdlen, (int)fsm->rdnb);
default:
break;
}
- /*@=branchstate@*/
if (!(stage & FSM_INTERNAL)) {
fsm->rc = (rc == CPIOERR_HDR_TRAILER ? 0 : rc);
}
return rc;
}
-/*@=compmempass@*/
-/*@=boundsread@*/
-/*@obserever@*/ const char * fileActionString(fileAction a)
+const char * fileActionString(fileAction a)
{
switch (a) {
case FA_UNKNOWN: return "unknown";
case FA_SKIPCOLOR: return "skipcolor";
default: return "???";
}
- /*@notreached@*/
}
-/*@observer@*/ const char * fileStageString(fileStage a) {
+const char * fileStageString(fileStage a) {
switch(a) {
case FSM_UNKNOWN: return "unknown";
default: return "???";
}
- /*@noteached@*/
}
#include "cpio.h"
-/*@-exportlocal@*/
-/*@unchecked@*/
extern int _fsm_debug;
-/*@=exportlocal@*/
/**
*/
* Keeps track of the set of all hard links to a file in an archive.
*/
struct hardLink_s {
-/*@owned@*/ /*@relnull@*/
struct hardLink_s * next;
-/*@owned@*/
const char ** nsuffix;
-/*@owned@*/
int * filex;
struct stat sb;
int nlink;
* File name and stat information.
*/
struct fsm_s {
-/*@owned@*/ /*@relnull@*/
const char * path; /*!< Current file name. */
-/*@owned@*/ /*@relnull@*/
const char * opath; /*!< Original file name. */
-/*@relnull@*/
FD_t cfd; /*!< Payload file handle. */
-/*@relnull@*/
FD_t rfd; /*!< read: File handle. */
-/*@dependent@*/ /*@relnull@*/
char * rdbuf; /*!< read: Buffer. */
-/*@owned@*/ /*@relnull@*/
char * rdb; /*!< read: Buffer allocated. */
size_t rdsize; /*!< read: Buffer allocated size. */
size_t rdlen; /*!< read: Number of bytes requested.*/
size_t rdnb; /*!< read: Number of bytes returned. */
FD_t wfd; /*!< write: File handle. */
-/*@dependent@*/ /*@relnull@*/
char * wrbuf; /*!< write: Buffer. */
-/*@owned@*/ /*@relnull@*/
char * wrb; /*!< write: Buffer allocated. */
size_t wrsize; /*!< write: Buffer allocated size. */
size_t wrlen; /*!< write: Number of bytes requested.*/
size_t wrnb; /*!< write: Number of bytes returned. */
-/*@only@*/ /*@null@*/
FSMI_t iter; /*!< File iterator. */
int ix; /*!< Current file iterator index. */
-/*@only@*/ /*@relnull@*/
struct hardLink_s * links; /*!< Pending hard linked file(s). */
-/*@only@*/ /*@relnull@*/
struct hardLink_s * li; /*!< Current hard linked file(s). */
-/*@kept@*/ /*@null@*/
unsigned int * archiveSize; /*!< Pointer to archive size. */
-/*@kept@*/ /*@null@*/
const char ** failedFile; /*!< First file name that failed. */
-/*@shared@*/ /*@relnull@*/
const char * subdir; /*!< Current file sub-directory. */
-/*@unused@*/
char subbuf[64]; /* XXX eliminate */
-/*@observer@*/ /*@relnull@*/
const char * osuffix; /*!< Old, preserved, file suffix. */
-/*@observer@*/ /*@relnull@*/
const char * nsuffix; /*!< New, created, file suffix. */
-/*@shared@*/ /*@relnull@*/
const char * suffix; /*!< Current file suffix. */
char sufbuf[64]; /* XXX eliminate */
-/*@only@*/ /*@null@*/
short * dnlx; /*!< Last dirpath verified indexes. */
-/*@only@*/ /*@null@*/
char * ldn; /*!< Last dirpath verified. */
int ldnlen; /*!< Last dirpath current length. */
int ldnalloc; /*!< Last dirpath allocated length. */
int rc; /*!< External file stage return code. */
int commit; /*!< Commit synchronously? */
cpioMapFlags mapFlags; /*!< Bit(s) to control mapping. */
-/*@shared@*/ /*@relnull@*/
const char * dirName; /*!< File directory name. */
-/*@shared@*/ /*@relnull@*/
const char * baseName; /*!< File base name. */
-/*@shared@*/ /*@relnull@*/
const char * fmd5sum; /*!< Hex MD5 sum (NULL disables). */
-/*@shared@*/ /*@relnull@*/
const char * md5sum; /*!< Binary MD5 sum (NULL disables). */
-/*@dependent@*/ /*@observer@*/ /*@null@*/
const char * fcontext; /*!< File security context (NULL disables). */
unsigned fflags; /*!< File flags. */
extern "C" {
#endif
-/*@-exportlocal@*/
/**
* Return formatted string representation of file stages.
* @param a file stage
* @return formatted string
*/
-/*@observer@*/ const char * fileStageString(fileStage a) /*@*/;
+const char * fileStageString(fileStage a) ;
/**
* Return formatted string representation of file disposition.
* @param a file dispostion
* @return formatted string
*/
-/*@observer@*/ const char * fileActionString(fileAction a) /*@*/;
-/*@=exportlocal@*/
+const char * fileActionString(fileAction a) ;
/**
* Create file state machine instance.
* @return file state machine
*/
-/*@only@*/ FSM_t newFSM(void)
- /*@*/;
+FSM_t newFSM(void);
/**
* Destroy file state machine instance.
* @param fsm file state machine
* @return always NULL
*/
-/*@null@*/ FSM_t freeFSM(/*@only@*/ /*@null@*/ FSM_t fsm)
- /*@globals fileSystem @*/
- /*@modifies fsm, fileSystem @*/;
+FSM_t freeFSM(FSM_t fsm);
/**
* Load external data into file state machine.
const rpmts ts,
const rpmfi fi,
FD_t cfd,
- /*@out@*/ unsigned int * archiveSize,
- /*@out@*/ const char ** failedFile)
- /*@globals h_errno, fileSystem, internalState @*/
- /*@modifies fsm, ts, fi, *archiveSize, *failedFile,
- fileSystem, internalState @*/;
+ unsigned int * archiveSize,
+ const char ** failedFile);
/**
* Clean file state machine.
* @param fsm file state machine
* @return 0 on success
*/
-int fsmTeardown(FSM_t fsm)
- /*@globals h_errno, fileSystem, internalState @*/
- /*@modifies fsm, fileSystem, internalState @*/;
+int fsmTeardown(FSM_t fsm);
-/*@-exportlocal@*/
/**
* Retrieve transaction set from file state machine iterator.
* @param fsm file state machine
* @return transaction set
*/
-rpmts fsmGetTs(const FSM_t fsm)
- /*@*/;
+rpmts fsmGetTs(const FSM_t fsm);
/**
* Retrieve transaction element file info from file state machine iterator.
* @param fsm file state machine
* @return transaction element file info
*/
-rpmfi fsmGetFi(/*@partial@*/ const FSM_t fsm)
- /*@*/;
+rpmfi fsmGetFi(const FSM_t fsm);
/**
* Map next file path and action.
* @param fsm file state machine
*/
-int fsmMapPath(FSM_t fsm)
- /*@modifies fsm @*/;
+int fsmMapPath(FSM_t fsm);
/**
* Map file stat(2) info.
* @param fsm file state machine
*/
-int fsmMapAttrs(FSM_t fsm)
- /*@modifies fsm @*/;
-/*@=exportlocal@*/
+int fsmMapAttrs(FSM_t fsm);
/**
* File state machine driver.
* @param nstage next stage
* @return 0 on success
*/
-int fsmNext(FSM_t fsm, fileStage nstage)
- /*@globals errno, h_errno, fileSystem, internalState @*/
- /*@modifies fsm, errno, fileSystem, internalState @*/;
+int fsmNext(FSM_t fsm, fileStage nstage);
/**
* File state machine driver.
* @param stage next stage
* @return 0 on success
*/
-/*@-exportlocal@*/
-int fsmStage(/*@partial@*/ FSM_t fsm, fileStage stage)
- /*@globals errno, h_errno, fileSystem, internalState @*/
- /*@modifies fsm, errno, fileSystem, internalState @*/;
-/*@=exportlocal@*/
+int fsmStage(FSM_t fsm, fileStage stage);
#ifdef __cplusplus
}
#include "rpmts.h"
#include "rpmmacro.h"
-/*@unchecked@*/
static int reverse = -1;
/**
*/
static int IDTintcmp(const void * a, const void * b)
- /*@*/
{
- /*@-castexpose@*/
return ( reverse * (((IDT)a)->val.u32 - ((IDT)b)->val.u32) );
- /*@=castexpose@*/
}
IDTX IDTXfree(IDTX idtx)
HGE_t hge = (HGE_t) headerGetEntry;
Header h;
- /*@-branchstate@*/
mi = rpmtsInitIterator(ts, tag, NULL, 0);
#ifdef NOTYET
(void) rpmdbSetIteratorRE(mi, RPMTAG_NAME, RPMMIRE_DEFAULT, '!gpg-pubkey');
continue;
{ IDT idt;
- /*@-nullderef@*/
idt = idtx->idt + idtx->nidt;
- /*@=nullderef@*/
idt->h = headerLink(h);
idt->key = NULL;
idt->instance = rpmdbGetIteratorOffset(mi);
idtx->nidt++;
}
mi = rpmdbFreeIterator(mi);
- /*@=branchstate@*/
return IDTXsort(idtx);
}
switch (rpmrc) {
default:
goto bottom;
- /*@notreached@*/ /*@switchbreak@*/ break;
+ break;
case RPMRC_NOTTRUSTED:
case RPMRC_NOKEY:
case RPMRC_OK:
isSource = headerIsEntry(h, RPMTAG_SOURCEPACKAGE);
if (isSource)
goto bottom;
- /*@switchbreak@*/ break;
+ break;
}
tidp = NULL;
- /*@-branchstate@*/
if (hge(h, tag, &type, (void **) &tidp, &count) && tidp != NULL) {
idtx = IDTXgrow(idtx, 1);
}
idtx->nidt++;
}
- /*@=branchstate@*/
bottom:
h = headerFree(h);
}
/**
* * A rollback transaction id element.
* */
-/*@-fielduse@*/
-typedef /*@abstract@*/ struct IDT_s {
+typedef struct IDT_s {
unsigned int instance; /*!< installed package transaction id. */
-/*@owned@*/ /*@null@*/
const char * key; /*! removed package file name. */
Header h; /*!< removed package header. */
union {
uint_32 u32; /*!< install/remove transaction id */
} val;
} * IDT;
-/*@=fielduse@*/
/**
* A rollback transaction id index.
*/
-typedef /*@abstract@*/ struct IDTindex_s {
+typedef struct IDTindex_s {
int delta; /*!< no. elements to realloc as a chunk. */
int size; /*!< size of id index element. */
int alloced; /*!< current number of elements allocated. */
int nidt; /*!< current number of elements initialized. */
-/*@only@*/ /*@null@*/
IDT idt; /*!< id index elements. */
} * IDTX;
* @param idtx id index
* @return NULL always
*/
-/*@null@*/
-IDTX IDTXfree(/*@only@*/ /*@null@*/ IDTX idtx)
- /*@modifies idtx @*/;
+IDTX IDTXfree(IDTX idtx);
/**
* Create id index.
* @return new id index
*/
-/*@only@*/
-IDTX IDTXnew(void)
- /*@*/;
+IDTX IDTXnew(void);
/**
* Insure that index has room for "need" elements.
* @param need additional no. of elements needed
* @return id index (with room for "need" elements)
*/
-/*@only@*/ /*@null@*/
-IDTX IDTXgrow(/*@only@*/ /*@null@*/ IDTX idtx, int need)
- /*@modifies idtx @*/;
+IDTX IDTXgrow(IDTX idtx, int need);
/**
* Sort tag (instance,value) pairs.
* @param idtx id index
* @return id index
*/
-/*@only@*/ /*@null@*/
-IDTX IDTXsort(/*@only@*/ /*@null@*/ IDTX idtx)
- /*@modifies idtx @*/;
+IDTX IDTXsort(IDTX idtx);
/**
* Load tag (instance,value) pairs from rpm databse, and return sorted id index.
* @param tag rpm tag
* @return id index
*/
-/*@only@*/ /*@null@*/
-IDTX IDTXload(rpmts ts, rpmTag tag)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
+IDTX IDTXload(rpmts ts, rpmTag tag);
/**
* Load tag (instance,value) pairs from packages, and return sorted id index.
* @param tag rpm tag
* @return id index
*/
-/*@only@*/ /*@null@*/
-IDTX IDTXglob(rpmts ts, const char * globstr, rpmTag tag)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
+IDTX IDTXglob(rpmts ts, const char * globstr, rpmTag tag);
#endif /* H_RPMIDTX */
#include "misc.h"
#include "debug.h"
-/*@access StringBuf @*/
-/*@-boundswrite@*/
char * rpmPermsString(int mode)
{
char *perms = xstrdup("----------");
perms[0] = 'l';
else if (S_ISFIFO(mode))
perms[0] = 'p';
- /*@-unrecog@*/
else if (S_ISSOCK(mode))
perms[0] = 's';
- /*@=unrecog@*/
else if (S_ISCHR(mode))
perms[0] = 'c';
else if (S_ISBLK(mode))
return perms;
}
-/*@=boundswrite@*/
/**@todo Infinite loops through manifest files exist, operator error for now. */
-/*@-boundsread@*/
rpmRC rpmReadPackageManifest(FD_t fd, int * argcPtr, const char *** argvPtr)
{
StringBuf sb = newStringBuf();
const char ** av = NULL;
int argc = (argcPtr ? *argcPtr : 0);
const char ** argv = (argvPtr ? *argvPtr : NULL);
-/*@+voidabstract@*/
FILE * f = (FILE *) fdGetFp(fd);
-/*@=voidabstract@*/
rpmRC rpmrc = RPMRC_OK;
int i, j, next, npre;
-/*@-boundswrite@*/
if (f != NULL)
while (1) {
char line[BUFSIZ];
appendStringBuf(sb, s);
}
- /*@-branchstate@*/
if (s == NULL) /* XXX always true */
s = getStringBuf(sb);
- /*@=branchstate@*/
if (!(s && *s)) {
rpmrc = RPMRC_NOTFOUND;
}
if (argcPtr)
*argcPtr = ac;
-/*@=boundswrite@*/
exit:
- /*@-branchstate@*/
if (argvPtr == NULL || (rpmrc != RPMRC_OK && av)) {
if (av)
-/*@-boundswrite@*/
for (i = 0; i < ac; i++)
- /*@-unqualifiedtrans@*/av[i] = _free(av[i]); /*@=unqualifiedtrans@*/
-/*@=boundswrite@*/
- /*@-dependenttrans@*/ av = _free(av); /*@=dependenttrans@*/
+ av[i] = _free(av[i]);
+ av = _free(av);
}
- /*@=branchstate@*/
sb = freeStringBuf(sb);
- /*@-nullstate@*/ /* FIX: *argvPtr may be NULL. */
+ /* FIX: *argvPtr may be NULL. */
return rpmrc;
- /*@=nullstate@*/
}
-/*@=boundsread@*/
* @param mode file mode
* @return (malloc'd) formatted mode string
*/
-/*@-incondefs@*/
-/*@only@*/
char * rpmPermsString(int mode)
- /*@*/
- /*@ensures maxSet(result) == 10 /\ maxRead(result) == 10 @*/;
-/*@=incondefs@*/
+;
/**
* Read manifest, glob items, and append to existing args.
* @retval argvPtr args themselves
* @return RPMRC_OK on success
*/
-rpmRC rpmReadPackageManifest(FD_t fd, int * argcPtr, const char *** argvPtr)
- /*@globals fileSystem, internalState @*/
- /*@modifies fd, *argcPtr, *argvPtr, fileSystem, internalState @*/;
+rpmRC rpmReadPackageManifest(FD_t fd, int * argcPtr, const char *** argvPtr);
#ifdef __cplusplus
}
case URL_IS_UNKNOWN:
if (errno != ENOENT)
break;
- /*@fallthrough@*/
case URL_IS_HTTPS:
case URL_IS_HTTP:
case URL_IS_FTP:
return RPMRC_OK;
}
-/*@-bounds@*/
char ** splitString(const char * str, int length, char sep)
{
const char * source;
list[i] = NULL;
-/*@-nullret@*/ /* FIX: list[i] is NULL */
+/* FIX: list[i] is NULL */
return list;
-/*@=nullret@*/
}
-/*@=bounds@*/
void freeSplitString(char ** list)
{
- /*@-unqualifiedtrans@*/
list[0] = _free(list[0]);
- /*@=unqualifiedtrans@*/
list = _free(list);
}
FD_t fd = NULL;
int ran;
- /*@-branchstate@*/
if (!prefix) prefix = "";
- /*@=branchstate@*/
/* Create the temp directory if it doesn't already exist. */
- /*@-branchstate@*/
if (!_initialized) {
_initialized = 1;
tempfn = rpmGenPath(prefix, tpmacro, NULL);
if (rpmioMkpath(tempfn, 0755, (uid_t) -1, (gid_t) -1))
goto errxit;
}
- /*@=branchstate@*/
/* XXX should probably use mkstemp here */
srand(time(NULL));
case URL_IS_DASH:
case URL_IS_HKP:
goto errxit;
- /*@notreached@*/ /*@switchbreak@*/ break;
+ break;
case URL_IS_HTTPS:
case URL_IS_HTTP:
case URL_IS_FTP:
default:
- /*@switchbreak@*/ break;
+ break;
}
fd = Fopen(tempfn, "w+x.ufdio");
break;
}
- /*@-branchstate@*/
if (fnptr)
*fnptr = tempfn;
else
tempfn = _free(tempfn);
- /*@=branchstate@*/
*fdptr = fd;
return 0;
errxit:
tempfn = _free(tempfn);
- /*@-usereleased@*/
if (fd != NULL) (void) Fclose(fd);
- /*@=usereleased@*/
return 1;
}
}
if (c) *c = 0;
return 0;
- } /*@notreached@*/ break;
+ } break;
case RPMTAG_GROUP:
case RPMTAG_DESCRIPTION:
if (c) *c = 0;
return 0;
}
- } /*@notreached@*/ break;
+ } break;
default:
return headerGetEntry(h, tag, type, p, c);
- /*@notreached@*/ break;
+ break;
}
- /*@notreached@*/
}
* @param dname directory use string
* @return rpmRC return code
*/
-rpmRC rpmMkdirPath (const char * dpath, const char * dname)
- /*@globals h_errno, fileSystem, internalState @*/
- /*@modifies fileSystem, internalState @*/;
+rpmRC rpmMkdirPath (const char * dpath, const char * dname);
/**
* Split string into fields separated by a character.
* @param sep separator character
* @return (malloc'd) argv array
*/
-/*@only@*/ char ** splitString(const char * str, int length, char sep)
- /*@*/;
+char ** splitString(const char * str, int length, char sep);
/**
* Free split string argv array.
* @param list argv array
*/
-void freeSplitString( /*@only@*/ char ** list)
- /*@modifies list @*/;
+void freeSplitString( char ** list);
/**
* Remove occurences of trailing character from string.
* @param c character to strip
* @return string
*/
-/*@unused@*/ static inline
-/*@only@*/ char * stripTrailingChar(/*@only@*/ char * s, char c)
- /*@modifies *s */
+static inline
+char * stripTrailingChar(char * s, char c)
{
char * t;
-/*@-boundswrite@*/
for (t = s + strlen(s) - 1; *t == c && t >= s; t--)
*t = '\0';
-/*@=boundswrite@*/
return s;
}
* @param overwrite should an existing variable be changed?
* @return 0 on success
*/
-int dosetenv(const char * name, const char * value, int overwrite)
- /*@globals environ@*/
- /*@modifies *environ @*/;
+int dosetenv(const char * name, const char * value, int overwrite);
/**
* Like the libc function, but malloc()'s the space needed.
* @param str "name=value" string
* @return 0 on success
*/
-int doputenv(const char * str)
- /*@globals environ@*/
- /*@modifies *environ @*/;
+int doputenv(const char * str);
/**
* Return file handle for a temporaray file.
* @retval fdptr temp file handle
* @return 0 on success
*/
-int makeTempFile(/*@null@*/ const char * prefix,
- /*@null@*/ /*@out@*/ const char ** fnptr,
- /*@out@*/ FD_t * fdptr)
- /*@globals rpmGlobalMacroContext, h_errno,
- fileSystem, internalState @*/
- /*@modifies *fnptr, *fdptr, rpmGlobalMacroContext,
- fileSystem, internalState @*/;
+int makeTempFile(const char * prefix,
+ const char ** fnptr,
+ FD_t * fdptr);
/**
* Return (malloc'd) current working directory.
* @return current working directory (malloc'ed)
*/
-/*@only@*/ char * currentDirectory(void)
- /*@*/;
+char * currentDirectory(void);
#ifdef __cplusplus
}
#define alloca_strdup(_s) strcpy(alloca(strlen(_s)+1), (_s))
-/*@access pgpDig @*/
-/*@access pgpDigParams @*/
-/*@access Header @*/ /* XXX compared with NULL */
-/*@access entryInfo @*/ /* XXX headerCheck */
-/*@access indexEntry @*/ /* XXX headerCheck */
-/*@access FD_t @*/ /* XXX stealing digests */
-
-/*@unchecked@*/
static int _print_pkts = 0;
-/*@unchecked@*/
static unsigned int nkeyids_max = 256;
-/*@unchecked@*/
static unsigned int nkeyids = 0;
-/*@unchecked@*/
static unsigned int nextkeyid = 0;
-/*@unchecked@*/ /*@only@*/ /*@null@*/
static unsigned int * keyids;
-/*@unchecked@*/
static unsigned char header_magic[8] = {
0x8e, 0xad, 0xe8, 0x01, 0x00, 0x00, 0x00, 0x00
};
/**
* Alignment needs (and sizeof scalars types) for internal rpm data types.
*/
-/*@observer@*/ /*@unchecked@*/
static int typeAlign[16] = {
1, /*!< RPM_NULL_TYPE */
1, /*!< RPM_CHAR_TYPE */
/* XXX Translate legacy signature tag values. */
case RPMSIGTAG_SIZE:
tag = RPMTAG_SIGSIZE;
- /*@switchbreak@*/ break;
+ break;
case RPMSIGTAG_LEMD5_1:
tag = RPMTAG_SIGLEMD5_1;
- /*@switchbreak@*/ break;
+ break;
case RPMSIGTAG_PGP:
tag = RPMTAG_SIGPGP;
- /*@switchbreak@*/ break;
+ break;
case RPMSIGTAG_LEMD5_2:
tag = RPMTAG_SIGLEMD5_2;
- /*@switchbreak@*/ break;
+ break;
case RPMSIGTAG_MD5:
tag = RPMTAG_SIGMD5;
- /*@switchbreak@*/ break;
+ break;
case RPMSIGTAG_GPG:
tag = RPMTAG_SIGGPG;
- /*@switchbreak@*/ break;
+ break;
case RPMSIGTAG_PGP5:
tag = RPMTAG_SIGPGP5;
- /*@switchbreak@*/ break;
+ break;
case RPMSIGTAG_PAYLOADSIZE:
tag = RPMTAG_ARCHIVESIZE;
- /*@switchbreak@*/ break;
+ break;
case RPMSIGTAG_SHA1:
case RPMSIGTAG_DSA:
case RPMSIGTAG_RSA:
default:
if (!(tag >= HEADER_SIGBASE && tag < HEADER_TAGBASE))
continue;
- /*@switchbreak@*/ break;
+ break;
}
if (ptr == NULL) continue; /* XXX can't happen */
if (!headerIsEntry(h, tag)) {
switch(type) {
case RPM_NULL_TYPE:
continue;
- /*@notreached@*/ /*@switchbreak@*/ break;
+ break;
case RPM_CHAR_TYPE:
case RPM_INT8_TYPE:
case RPM_INT16_TYPE:
case RPM_INT32_TYPE:
if (count != 1)
continue;
- /*@switchbreak@*/ break;
+ break;
case RPM_STRING_TYPE:
case RPM_BIN_TYPE:
if (count >= 16*1024)
continue;
- /*@switchbreak@*/ break;
+ break;
case RPM_STRING_ARRAY_TYPE:
case RPM_I18NSTRING_TYPE:
continue;
- /*@notreached@*/ /*@switchbreak@*/ break;
+ break;
}
xx = hae(h, tag, type, ptr, count);
}
/* XXX Translate legacy signature tag values. */
case RPMTAG_SIGSIZE:
stag = RPMSIGTAG_SIZE;
- /*@switchbreak@*/ break;
+ break;
case RPMTAG_SIGLEMD5_1:
stag = RPMSIGTAG_LEMD5_1;
- /*@switchbreak@*/ break;
+ break;
case RPMTAG_SIGPGP:
stag = RPMSIGTAG_PGP;
- /*@switchbreak@*/ break;
+ break;
case RPMTAG_SIGLEMD5_2:
stag = RPMSIGTAG_LEMD5_2;
- /*@switchbreak@*/ break;
+ break;
case RPMTAG_SIGMD5:
stag = RPMSIGTAG_MD5;
- /*@switchbreak@*/ break;
+ break;
case RPMTAG_SIGGPG:
stag = RPMSIGTAG_GPG;
- /*@switchbreak@*/ break;
+ break;
case RPMTAG_SIGPGP5:
stag = RPMSIGTAG_PGP5;
- /*@switchbreak@*/ break;
+ break;
case RPMTAG_ARCHIVESIZE:
/* XXX rpm-4.1 and later has archive size in signature header. */
if (noArchiveSize)
continue;
stag = RPMSIGTAG_PAYLOADSIZE;
- /*@switchbreak@*/ break;
+ break;
case RPMTAG_SHA1HEADER:
case RPMTAG_DSAHEADER:
case RPMTAG_RSAHEADER:
if (!(tag >= HEADER_SIGBASE && tag < HEADER_TAGBASE))
continue;
stag = tag;
- /*@switchbreak@*/ break;
+ break;
}
if (ptr == NULL) continue; /* XXX can't happen */
if (!headerIsEntry(sigh, stag))
* @return 0 if new keyid, otherwise 1
*/
static int rpmtsStashKeyid(rpmts ts)
- /*@globals nextkeyid, nkeyids, keyids @*/
- /*@modifies nextkeyid, nkeyids, keyids @*/
{
const void * sig = rpmtsSig(ts);
pgpDig dig = rpmtsDig(ts);
if (keyids != NULL)
for (i = 0; i < nkeyids; i++) {
-/*@-boundsread@*/
if (keyid == keyids[i])
return 1;
-/*@=boundsread@*/
}
if (nkeyids < nkeyids_max) {
nkeyids++;
keyids = xrealloc(keyids, nkeyids * sizeof(*keyids));
}
-/*@-boundswrite@*/
if (keyids) /* XXX can't happen */
keyids[nextkeyid] = keyid;
-/*@=boundswrite@*/
nextkeyid++;
nextkeyid %= nkeyids_max;
int headerVerifyInfo(int il, int dl, const void * pev, void * iv, int negate)
{
-/*@-castexpose@*/
entryInfo pe = (entryInfo) pev;
-/*@=castexpose@*/
entryInfo info = iv;
int i;
-/*@-boundsread@*/
for (i = 0; i < il; i++) {
info->tag = ntohl(pe[i].tag);
info->type = ntohl(pe[i].type);
return i;
}
-/*@=boundsread@*/
return -1;
}
pgpDig dig;
char buf[8*BUFSIZ];
int_32 * ei = (int_32 *) uh;
-/*@-boundsread@*/
int_32 il = ntohl(ei[0]);
int_32 dl = ntohl(ei[1]);
-/*@-castexpose@*/
entryInfo pe = (entryInfo) &ei[2];
-/*@=castexpose@*/
-/*@=boundsread@*/
int_32 ildl[2];
int_32 pvlen = sizeof(ildl) + (il * sizeof(*pe)) + dl;
unsigned char * dataStart = (unsigned char *) (pe + il);
static int hclvl;
hclvl++;
-/*@-boundswrite@*/
buf[0] = '\0';
-/*@=boundswrite@*/
/* Is the blob the right size? */
if (uc > 0 && pvlen != uc) {
}
/* Is there an immutable header region tag? */
-/*@-sizeoftype@*/
if (!(entry->info.tag == RPMTAG_HEADERIMMUTABLE
&& entry->info.type == RPM_BIN_TYPE
&& entry->info.count == REGION_TAG_COUNT))
rc = RPMRC_NOTFOUND;
goto exit;
}
-/*@=sizeoftype@*/
/* Is the offset within the data area? */
if (entry->info.offset >= dl) {
/* Is there an immutable header region tag trailer? */
regionEnd = dataStart + entry->info.offset;
-/*@-sizeoftype@*/
-/*@-bounds@*/
(void) memcpy(info, regionEnd, REGION_TAG_COUNT);
-/*@=bounds@*/
regionEnd += REGION_TAG_COUNT;
xx = headerVerifyInfo(1, dl, info, &entry->info, 1);
entry->info.offset, entry->info.count);
goto exit;
}
-/*@=sizeoftype@*/
-/*@-boundswrite@*/
memset(info, 0, sizeof(*info));
-/*@=boundswrite@*/
/* Is the no. of tags in the region less than the total no. of tags? */
ril = entry->info.offset/sizeof(*pe);
switch (entry->info.tag) {
case RPMTAG_SHA1HEADER:
if (vsflags & RPMVSF_NOSHA1HEADER)
- /*@switchbreak@*/ break;
+ break;
blen = 0;
-/*@-boundsread@*/
for (b = dataStart + entry->info.offset; *b != '\0'; b++) {
if (strchr("0123456789abcdefABCDEF", *b) == NULL)
- /*@innerbreak@*/ break;
+ break;
blen++;
}
if (entry->info.type != RPM_STRING_TYPE || *b != '\0' || blen != 40)
(void) snprintf(buf, sizeof(buf), _("hdr SHA1: BAD, not hex\n"));
goto exit;
}
-/*@=boundsread@*/
if (info->tag == 0) {
-/*@-boundswrite@*/
*info = entry->info; /* structure assignment */
-/*@=boundswrite@*/
siglen = blen + 1;
}
- /*@switchbreak@*/ break;
+ break;
case RPMTAG_RSAHEADER:
if (vsflags & RPMVSF_NORSAHEADER)
- /*@switchbreak@*/ break;
+ break;
if (entry->info.type != RPM_BIN_TYPE) {
(void) snprintf(buf, sizeof(buf), _("hdr RSA: BAD, not binary\n"));
goto exit;
}
-/*@-boundswrite@*/
*info = entry->info; /* structure assignment */
-/*@=boundswrite@*/
siglen = info->count;
- /*@switchbreak@*/ break;
+ break;
case RPMTAG_DSAHEADER:
if (vsflags & RPMVSF_NODSAHEADER)
- /*@switchbreak@*/ break;
+ break;
if (entry->info.type != RPM_BIN_TYPE) {
(void) snprintf(buf, sizeof(buf), _("hdr DSA: BAD, not binary\n"));
goto exit;
}
-/*@-boundswrite@*/
*info = entry->info; /* structure assignment */
-/*@=boundswrite@*/
siglen = info->count;
- /*@switchbreak@*/ break;
+ break;
default:
- /*@switchbreak@*/ break;
+ break;
}
}
rc = RPMRC_NOTFOUND;
exit:
/* Return determined RPMRC_OK/RPMRC_FAIL conditions. */
if (rc != RPMRC_NOTFOUND) {
-/*@-boundswrite@*/
buf[sizeof(buf)-1] = '\0';
if (msg) *msg = xstrdup(buf);
-/*@=boundswrite@*/
hclvl--;
return rc;
}
(void) snprintf(buf, sizeof(buf), "Header sanity check: OK\n");
rc = RPMRC_OK;
}
-/*@-boundswrite@*/
buf[sizeof(buf)-1] = '\0';
if (msg) *msg = xstrdup(buf);
-/*@=boundswrite@*/
hclvl--;
return rc;
}
goto verifyinfo_exit;
dig->nbytes = 0;
-/*@-boundsread@*/
sig = memcpy(xmalloc(siglen), dataStart + info->offset, siglen);
-/*@=boundsread@*/
(void) rpmtsSetSig(ts, info->tag, info->type, sig, info->count);
switch (info->tag) {
rc = RPMRC_FAIL;
goto exit;
}
- /*@fallthrough@*/
case RPMTAG_SHA1HEADER:
-/*@-boundswrite@*/
ildl[0] = htonl(ril);
ildl[1] = (regionEnd - dataStart);
ildl[1] = htonl(ildl[1]);
-/*@=boundswrite@*/
(void) rpmswEnter(rpmtsOp(ts, RPMTS_OP_DIGEST), 0);
dig->hdrsha1ctx = rpmDigestInit(PGPHASHALGO_SHA1, RPMDIGEST_NONE);
break;
}
-/*@-boundswrite@*/
buf[0] = '\0';
-/*@=boundswrite@*/
rc = rpmVerifySignature(ts, buf);
-/*@-boundswrite@*/
buf[sizeof(buf)-1] = '\0';
if (msg) *msg = xstrdup(buf);
-/*@=boundswrite@*/
/* XXX headerCheck can recurse, free info only at top level. */
if (hclvl == 1)
rpmRC rc = RPMRC_FAIL; /* assume failure */
int xx;
-/*@-boundswrite@*/
buf[0] = '\0';
if (hdrp)
*hdrp = NULL;
if (msg)
*msg = NULL;
-/*@=boundswrite@*/
memset(block, 0, sizeof(block));
if ((xx = timedRead(fd, (char *)block, sizeof(block))) != sizeof(block)) {
(void) snprintf(buf, sizeof(buf), _("hdr magic: BAD\n"));
goto exit;
}
-/*@-boundsread@*/
il = ntohl(block[2]);
-/*@=boundsread@*/
if (hdrchkTags(il)) {
(void) snprintf(buf, sizeof(buf),
_("hdr tags: BAD, no. of tags(%d) out of range\n"), il);
goto exit;
}
-/*@-boundsread@*/
dl = ntohl(block[3]);
-/*@=boundsread@*/
if (hdrchkData(dl)) {
(void) snprintf(buf, sizeof(buf),
_("hdr data: BAD, no. of bytes(%d) out of range\n"), dl);
goto exit;
}
-/*@-sizeoftype@*/
nb = (il * sizeof(struct entryInfo_s)) + dl;
-/*@=sizeoftype@*/
uc = sizeof(il) + sizeof(dl) + nb;
ei = xmalloc(uc);
-/*@-bounds@*/
ei[0] = block[2];
ei[1] = block[3];
if ((xx = timedRead(fd, (char *)&ei[2], nb)) != nb) {
_("hdr blob(%d): BAD, read returned %d\n"), nb, xx);
goto exit;
}
-/*@=bounds@*/
/* Sanity check header tags */
rc = headerCheck(ts, ei, uc, msg);
ei = NULL; /* XXX will be freed with header */
exit:
-/*@-boundswrite@*/
if (hdrp && h && rc == RPMRC_OK)
*hdrp = headerLink(h);
-/*@=boundswrite@*/
ei = _free(ei);
h = headerFree(h);
-/*@-boundswrite@*/
if (msg != NULL && *msg == NULL && buf[0] != '\0') {
buf[sizeof(buf)-1] = '\0';
*msg = xstrdup(buf);
}
-/*@=boundswrite@*/
return rc;
}
-/*@-bounds@*/ /* LCL: segfault */
rpmRC rpmReadPackageFile(rpmts ts, FD_t fd, const char * fn, Header * hdrp)
{
pgpDig dig;
#ifdef DYING
{ struct stat st;
-/*@-boundswrite@*/
memset(&st, 0, sizeof(st));
-/*@=boundswrite@*/
(void) fstat(Fileno(fd), &st);
/* if fd points to a socket, pipe, etc, st.st_size is *always* zero */
if (S_ISREG(st.st_mode) && st.st_size < sizeof(*l)) {
_("packaging version 1 is not supported by this version of RPM\n"));
rc = RPMRC_NOTFOUND;
goto exit;
- /*@notreached@*/ break;
+ break;
case 2:
case 3:
case 4:
"is supported by this version of RPM\n"));
rc = RPMRC_NOTFOUND;
goto exit;
- /*@notreached@*/ break;
+ break;
}
/* Read the signature header. */
(msg && *msg ? msg : "\n"));
msg = _free(msg);
goto exit;
- /*@notreached@*/ break;
+ break;
case RPMRC_OK:
if (sigh == NULL) {
rpmError(RPMERR_SIGGEN, _("%s: No signature available\n"), fn);
/* XXX repackaged packages have appended tags, legacy dig/sig check fails */
if (opx > 0)
(void) rpmswEnter(rpmtsOp(ts, opx), 0);
-/*@-type@*/ /* XXX arrow access of non-pointer (FDSTAT_t) */
nb = -fd->stats->ops[FDSTAT_READ].bytes;
rc = rpmReadHeader(ts, fd, &h, &msg);
nb += fd->stats->ops[FDSTAT_READ].bytes;
-/*@=type@*/
if (opx > 0)
(void) rpmswExit(rpmtsOp(ts, opx), nb);
rc = RPMRC_FAIL;
goto exit;
}
- /*@fallthrough@*/
case RPMSIGTAG_SHA1:
{ void * uh = NULL;
int_32 uht;
rc = RPMRC_FAIL;
goto exit;
}
- /*@fallthrough@*/
case RPMSIGTAG_MD5:
/* Legacy signatures need the compressed payload in the digest too. */
(void) rpmswEnter(rpmtsOp(ts, RPMTS_OP_DIGEST), 0);
case PGPHASHALGO_MD5:
dig->md5ctx = fddig->hashctx;
fddig->hashctx = NULL;
- /*@switchbreak@*/ break;
+ break;
case PGPHASHALGO_SHA1:
#if HAVE_BEECRYPT_API_H
case PGPHASHALGO_SHA256:
#endif
dig->sha1ctx = fddig->hashctx;
fddig->hashctx = NULL;
- /*@switchbreak@*/ break;
+ break;
default:
- /*@switchbreak@*/ break;
+ break;
}
}
break;
/** @todo Implement disable/enable/warn/error/anal policy. */
-/*@-boundswrite@*/
buf[0] = '\0';
-/*@=boundswrite@*/
rc = rpmVerifySignature(ts, buf);
switch (rc) {
case RPMRC_OK: /* Signature is OK. */
headerMergeLegacySigs(h, sigh);
/* Bump reference count for return. */
-/*@-boundswrite@*/
*hdrp = headerLink(h);
-/*@=boundswrite@*/
}
h = headerFree(h);
rpmtsCleanDig(ts);
}
-/*@=bounds@*/
#define POPT_RCFILE -995
#endif
-/*@unchecked@*/
static int _debug = 0;
-/*@-exportheadervar@*/
-/*@unchecked@*/
extern int _rpmds_nopromote;
-/*@unchecked@*/
extern int _fps_debug;
-/*@unchecked@*/
extern int _fsm_debug;
-/*@unchecked@*/
extern int _fsm_threads;
-/*@unchecked@*/
extern int _hdr_debug;
-/*@unchecked@*/
extern int _print_pkts;
-/*@unchecked@*/
extern int _psm_debug;
-/*@unchecked@*/
extern int _psm_threads;
-/*@unchecked@*/
extern int _rpmal_debug;
-/*@unchecked@*/
extern int _rpmdb_debug;
-/*@unchecked@*/
extern int _rpmds_debug;
/* XXX avoid -lrpmbuild linkage. */
-/*@unchecked@*/
int _rpmfc_debug;
-/*@unchecked@*/
extern int _rpmfi_debug;
-/*@unchecked@*/
extern int _rpmgi_debug;
-/*@unchecked@*/
extern int _rpmps_debug;
-/*@unchecked@*/
extern int _rpmsq_debug;
-/*@unchecked@*/
extern int _rpmte_debug;
-/*@unchecked@*/
extern int _rpmts_debug;
-/*@unchecked@*/
extern int _rpmts_stats;
-/*@unchecked@*/
extern int noLibio;
-/*@=exportheadervar@*/
-/*@unchecked@*/
const char * rpmcliPipeOutput = NULL;
-/*@unchecked@*/
const char * rpmcliRcfile = NULL;
-/*@unchecked@*/
const char * rpmcliRootDir = "/";
-/*@unchecked@*/
rpmQueryFlags rpmcliQueryFlags;
-/*@-exportheadervar@*/
-/*@unchecked@*/
extern int _ftp_debug;
-/*@unchecked@*/
extern int _av_debug;
-/*@unchecked@*/
extern int _dav_debug;
-/*@unchecked@*/
extern int noLibio;
-/*@unchecked@*/
extern int _rpmio_debug;
-/*@=exportheadervar@*/
-/*@unchecked@*/
static int rpmcliInitialized = -1;
/**
* Display rpm version.
*/
static void printVersion(FILE * fp)
- /*@globals rpmEVR, fileSystem @*/
- /*@modifies *fp, fileSystem @*/
{
fprintf(fp, _("RPM version %s\n"), rpmEVR);
}
* Make sure that config files have been read.
* @warning Options like --rcfile and --verbose must precede callers option.
*/
-/*@mayexit@*/
void rpmcliConfigured(void)
- /*@globals rpmcliInitialized, rpmCLIMacroContext, rpmGlobalMacroContext,
- h_errno, fileSystem, internalState @*/
- /*@modifies rpmcliInitialized, rpmCLIMacroContext, rpmGlobalMacroContext,
- fileSystem, internalState @*/
{
if (rpmcliInitialized < 0)
/**
*/
-/*@-bounds@*/
-static void rpmcliAllArgCallback( /*@unused@*/ poptContext con,
- /*@unused@*/ enum poptCallbackReason reason,
+static void rpmcliAllArgCallback( poptContext con,
+ enum poptCallbackReason reason,
const struct poptOption * opt, const char * arg,
- /*@unused@*/ const void * data)
- /*@globals rpmcliQueryFlags, rpmCLIMacroContext, rpmGlobalMacroContext,
- h_errno, fileSystem, internalState @*/
- /*@modifies rpmcliQueryFlags, rpmCLIMacroContext, rpmGlobalMacroContext,
- fileSystem, internalState @*/
+ const void * data)
{
/* XXX avoid accidental collisions with POPT_BIT_SET for flags */
- /*@-branchstate@*/
if (opt->arg == NULL)
switch (opt->val) {
case 'q':
if (rpmcliInitialized < 0)
(void) rpmDefineMacro(NULL, arg, RMIL_CMDLINE);
rpmcliConfigured();
-/*@-type@*/
(void) rpmDefineMacro(NULL, arg, RMIL_CMDLINE);
(void) rpmDefineMacro(rpmCLIMacroContext, arg, RMIL_CMDLINE);
-/*@=type@*/
break;
case 'E':
rpmcliConfigured();
case POPT_SHOWVERSION:
printVersion(stdout);
exit(EXIT_SUCCESS);
- /*@notreached@*/ break;
+ break;
case POPT_SHOWRC:
rpmcliConfigured();
(void) rpmShowRC(stdout);
exit(EXIT_SUCCESS);
- /*@notreached@*/ break;
+ break;
case POPT_QUERYTAGS:
rpmDisplayQueryTags(stdout);
exit(EXIT_SUCCESS);
- /*@notreached@*/ break;
+ break;
#if defined(POPT_RCFILE)
case POPT_RCFILE: /* XXX FIXME: noop for now */
break;
rpmcliQueryFlags |= VERIFY_HDRCHK;
break;
}
- /*@=branchstate@*/
}
-/*@unchecked@*/
int ftsOpts = 0;
-/*@unchecked@*/
struct poptOption rpmcliFtsPoptTable[] = {
{ "comfollow", '\0', POPT_BIT_SET, &ftsOpts, FTS_COMFOLLOW,
N_("FTS_COMFOLLOW: follow command line symlinks"), NULL },
POPT_TABLEEND
};
-/*@-bitwisesigned -compmempass @*/
-/*@unchecked@*/
struct poptOption rpmcliAllPoptTable[] = {
-/*@-type@*/ /* FIX: cast? */
+/* FIX: cast? */
{ NULL, '\0', POPT_ARG_CALLBACK | POPT_CBFLAG_INC_DATA | POPT_CBFLAG_CONTINUE,
rpmcliAllArgCallback, 0, NULL, NULL },
-/*@=type@*/
{ "debug", 'd', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_debug, -1,
NULL, NULL },
POPT_TABLEEND
};
-/*@=bitwisesigned =compmempass @*/
poptContext
rpmcliFini(poptContext optCon)
optCon = poptFreeContext(optCon);
#if HAVE_MCHECK_H && HAVE_MTRACE
- /*@-noeffect@*/
muntrace(); /* Trace malloc only if MALLOC_TRACE=mtrace-output-file. */
- /*@=noeffect@*/
#endif
return NULL;
}
-/*@-globstate@*/
poptContext
rpmcliInit(int argc, char *const argv[], struct poptOption * optionsTable)
{
int rc;
#if HAVE_MCHECK_H && HAVE_MTRACE
- /*@-noeffect@*/
mtrace(); /* Trace malloc only if MALLOC_TRACE=mtrace-output-file. */
- /*@=noeffect@*/
#endif
-/*@-globs -mods@*/
setprogname(argv[0]); /* Retrofit glibc __progname */
/* XXX glibc churn sanity */
if ((__progname = strrchr(argv[0], '/')) != NULL) __progname++;
else __progname = argv[0];
}
-/*@=globs =mods@*/
#if defined(ENABLE_NLS)
(void) setlocale(LC_ALL, "" );
return NULL;
}
-/*@-nullpass -temptrans@*/
optCon = poptGetContext(__progname, argc, (const char **)argv, optionsTable, 0);
-/*@=nullpass =temptrans@*/
(void) poptReadConfigFile(optCon, LIBRPMALIAS_FILENAME);
(void) poptReadDefaultConfig(optCon, 1);
poptSetExecPath(optCon, RPMCONFIGDIR, 1);
optArg = poptGetOptArg(optCon);
switch (rc) {
default:
-/*@-nullpass@*/
fprintf(stderr, _("%s: option table misconfigured (%d)\n"),
__progname, rc);
-/*@=nullpass@*/
exit(EXIT_FAILURE);
- /*@notreached@*/ /*@switchbreak@*/ break;
+ break;
}
}
if (rc < -1) {
-/*@-nullpass@*/
fprintf(stderr, "%s: %s: %s\n", __progname,
poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
poptStrerror(rc));
-/*@=nullpass@*/
exit(EXIT_FAILURE);
}
return optCon;
}
-/*@=globstate@*/
#include "debug.h"
-/*@-redecl@*/
extern time_t get_date(const char * p, void * now); /* XXX expedient lies */
-/*@=redecl@*/
-/*@unchecked@*/
struct rpmInstallArguments_s rpmIArgs = {
0, /* transFlags */
0, /* probFilter */
#define POPT_EXCLUDEPATH -1022
#define POPT_ROLLBACK -1023
-/*@exits@*/
static void argerror(const char * desc)
- /*@globals stderr, fileSystem @*/
- /*@modifies stderr, fileSystem @*/
{
- /*@-modfilesys -globs @*/
fprintf(stderr, _("%s: %s\n"), __progname, desc);
- /*@=modfilesys =globs @*/
exit(EXIT_FAILURE);
}
/**
*/
-/*@-bounds@*/
-static void installArgCallback( /*@unused@*/ poptContext con,
- /*@unused@*/ enum poptCallbackReason reason,
+static void installArgCallback( poptContext con,
+ enum poptCallbackReason reason,
const struct poptOption * opt, const char * arg,
- /*@unused@*/ const void * data)
- /*@globals rpmIArgs, stderr, fileSystem @*/
- /*@modifies rpmIArgs, stderr, fileSystem @*/
+ const void * data)
{
struct rpmInstallArguments_s * ia = &rpmIArgs;
/* XXX avoid accidental collisions with POPT_BIT_SET for flags */
- /*@-branchstate@*/
if (opt->arg == NULL)
switch (opt->val) {
argerror(_("exclude paths must begin with a /"));
ia->relocations = xrealloc(ia->relocations,
sizeof(*ia->relocations) * (ia->numRelocations + 1));
-/*@-temptrans@*/
ia->relocations[ia->numRelocations].oldPath = xstrdup(arg);
-/*@=temptrans@*/
ia->relocations[ia->numRelocations].newPath = NULL;
ia->numRelocations++;
break;
argerror(_("relocations must have a / following the ="));
ia->relocations = xrealloc(ia->relocations,
sizeof(*ia->relocations) * (ia->numRelocations + 1));
-/*@-temptrans@*/
ia->relocations[ia->numRelocations].oldPath = oldPath;
-/*@=temptrans@*/
-/*@-kepttrans -usereleased @*/
ia->relocations[ia->numRelocations].newPath = newPath;
-/*@=kepttrans =usereleased @*/
ia->numRelocations++;
} break;
if (arg == NULL)
argerror(_("rollback takes a time/date stamp argument"));
- /*@-moduncon@*/
tid = get_date(arg, NULL);
- /*@=moduncon@*/
if (tid == (time_t)-1 || tid == (time_t)0)
argerror(_("malformed rollback time/date stamp argument"));
break;
}
- /*@=branchstate@*/
}
-/*@=bounds@*/
/**
*/
-/*@-bitwisesigned -compmempass @*/
-/*@unchecked@*/
struct poptOption rpmInstallPoptTable[] = {
-/*@-type@*/ /* FIX: cast? */
+/* FIX: cast? */
{ NULL, '\0', POPT_ARG_CALLBACK | POPT_CBFLAG_INC_DATA | POPT_CBFLAG_CONTINUE,
installArgCallback, 0, NULL, NULL },
-/*@=type@*/
{ "aid", '\0', POPT_BIT_SET, &rpmIArgs.transFlags, RPMTRANS_FLAG_ADDINDEPS,
N_("add suggested packages to transaction"), NULL },
POPT_TABLEEND
};
-/*@=bitwisesigned =compmempass @*/
#include "debug.h"
-/*@unchecked@*/
struct rpmQVKArguments_s rpmQVKArgs;
-/*@unchecked@*/
int specedit = 0;
#define POPT_QUERYFORMAT -1000
#define POPT_FTSWALK -1012
/* ========== Query/Verify/Signature source args */
-static void rpmQVSourceArgCallback( /*@unused@*/ poptContext con,
- /*@unused@*/ enum poptCallbackReason reason,
- const struct poptOption * opt, /*@unused@*/ const char * arg,
- /*@unused@*/ const void * data)
- /*@globals rpmQVKArgs @*/
- /*@modifies rpmQVKArgs @*/
+static void rpmQVSourceArgCallback( poptContext con,
+ enum poptCallbackReason reason,
+ const struct poptOption * opt, const char * arg,
+ const void * data)
{
QVA_t qva = &rpmQVKArgs;
/**
* Common query/verify mode options.
*/
-/*@unchecked@*/
struct poptOption rpmQVSourcePoptTable[] = {
-/*@-type@*/ /* FIX: cast? */
+/* FIX: cast? */
{ NULL, '\0', POPT_ARG_CALLBACK | POPT_CBFLAG_INC_DATA,
rpmQVSourceArgCallback, 0, NULL, NULL },
-/*@=type@*/
{ "all", 'a', 0, 0, 'a',
N_("query/verify all packages"), NULL },
{ "checksig", 'K', POPT_ARGFLAG_DOC_HIDDEN, NULL, 'K',
/* ========== Query specific popt args */
static void queryArgCallback(poptContext con,
- /*@unused@*/enum poptCallbackReason reason,
+ enum poptCallbackReason reason,
const struct poptOption * opt, const char * arg,
- /*@unused@*/ const void * data)
- /*@globals rpmQVKArgs @*/
- /*@modifies con, rpmQVKArgs @*/
+ const void * data)
{
QVA_t qva = &rpmQVKArgs;
case POPT_QUERYFORMAT:
if (arg) {
char * qf = (char *)qva->qva_queryFormat;
- /*@-branchstate@*/
if (qf) {
int len = strlen(qf) + strlen(arg) + 1;
qf = xrealloc(qf, len);
-/*@-boundswrite@*/
strcat(qf, arg);
-/*@=boundswrite@*/
} else {
qf = xmalloc(strlen(arg) + 1);
strcpy(qf, arg);
}
- /*@=branchstate@*/
qva->qva_queryFormat = qf;
}
break;
case 'i':
if (qva->qva_mode == 'q') {
- /*@-nullassign -readonlytrans@*/
const char * infoCommand[] = { "--info", NULL };
- /*@=nullassign =readonlytrans@*/
(void) poptStuffArgs(con, infoCommand);
}
break;
/**
* Query mode options.
*/
-/*@unchecked@*/
struct poptOption rpmQueryPoptTable[] = {
-/*@-type@*/ /* FIX: cast? */
+/* FIX: cast? */
{ NULL, '\0', POPT_ARG_CALLBACK | POPT_CBFLAG_INC_DATA | POPT_CBFLAG_CONTINUE,
queryArgCallback, 0, NULL, NULL },
-/*@=type@*/
{ NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmQVSourcePoptTable, 0,
NULL, NULL },
{ "configfiles", 'c', 0, 0, 'c',
* Verify mode options.
*/
struct poptOption rpmVerifyPoptTable[] = {
-/*@-type@*/ /* FIX: cast? */
+/* FIX: cast? */
{ NULL, '\0', POPT_ARG_CALLBACK | POPT_CBFLAG_INC_DATA | POPT_CBFLAG_CONTINUE,
queryArgCallback, 0, NULL, NULL },
-/*@=type@*/
{ NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmQVSourcePoptTable, 0,
NULL, NULL },
/**
* Signature mode options.
*/
-/*@unchecked@*/
struct poptOption rpmSignPoptTable[] = {
-/*@-type@*/ /* FIX: cast? */
+/* FIX: cast? */
{ NULL, '\0', POPT_ARG_CALLBACK | POPT_CBFLAG_INC_DATA | POPT_CBFLAG_CONTINUE,
rpmQVSourceArgCallback, 0, NULL, NULL },
-/*@=type@*/
{ "addsign", '\0', 0, NULL, 'A',
N_("sign package(s) (identical to --resign)"), NULL },
{ "checksig", 'K', 0, NULL, 'K',
#include "debug.h"
#define _PSM_DEBUG 0
-/*@unchecked@*/
int _psm_debug = _PSM_DEBUG;
-/*@unchecked@*/
int _psm_threads = 0;
/* Give access to the rpmte global tracking the last instance added
* to the database.
*/
-/*@-exportheadervar@*/
-/*@unchecked@*/
extern unsigned int myinstall_instance;
-/*@=exportheadervar@*/
-
-/*@access FD_t @*/ /* XXX void ptr args */
-/*@access rpmpsm @*/
-
-/*@access rpmfi @*/
-/*@access rpmte @*/ /* XXX rpmInstallSourcePackage */
-/*@access rpmts @*/ /* XXX ts->notify */
-
-/*@access rpmluav @*/
-/*@access rpmtsScore @*/
-/*@access rpmtsScoreEntry @*/
int rpmVersionCompare(Header first, Header second)
{
if (!headerGetEntry(second, RPMTAG_EPOCH, NULL, (void **) &epochTwo, NULL))
epochTwo = &zero;
-/*@-boundsread@*/
if (*epochOne < *epochTwo)
return -1;
else if (*epochOne > *epochTwo)
return 1;
-/*@=boundsread@*/
rc = headerGetEntry(first, RPMTAG_VERSION, NULL, (void **) &one, NULL);
rc = headerGetEntry(second, RPMTAG_VERSION, NULL, (void **) &two, NULL);
* Macros to be defined from per-header tag values.
* @todo Should other macros be added from header when installing a package?
*/
-/*@observer@*/ /*@unchecked@*/
static struct tagMacro {
-/*@observer@*/ /*@null@*/ const char * macroname; /*!< Macro name to define. */
+const char * macroname; /*!< Macro name to define. */
rpmTag tag; /*!< Header tag to use for value. */
} tagMacros[] = {
{ "name", RPMTAG_NAME },
* @return 0 always
*/
static int rpmInstallLoadMacros(rpmfi fi, Header h)
- /*@globals rpmGlobalMacroContext @*/
- /*@modifies rpmGlobalMacroContext @*/
{
HGE_t hge = (HGE_t) fi->hge;
struct tagMacro * tagm;
union {
-/*@unused@*/ void * ptr;
-/*@unused@*/ const char ** argv;
+void * ptr;
+const char ** argv;
const char * str;
int_32 * i32p;
} body;
continue;
switch (type) {
case RPM_INT32_TYPE:
-/*@-boundsread@*/
sprintf(numbuf, "%d", *body.i32p);
-/*@=boundsread@*/
addMacro(NULL, tagm->macroname, NULL, numbuf, -1);
- /*@switchbreak@*/ break;
+ break;
case RPM_STRING_TYPE:
addMacro(NULL, tagm->macroname, NULL, body.str, -1);
- /*@switchbreak@*/ break;
+ break;
case RPM_NULL_TYPE:
case RPM_CHAR_TYPE:
case RPM_INT8_TYPE:
case RPM_STRING_ARRAY_TYPE:
case RPM_I18NSTRING_TYPE:
default:
- /*@switchbreak@*/ break;
+ break;
}
}
return 0;
* @param psm package state machine data
* @return 0 always
*/
-/*@-bounds@*/
static rpmRC markReplacedFiles(const rpmpsm psm)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies psm, rpmGlobalMacroContext, fileSystem, internalState @*/
{
const rpmts ts = psm->ts;
rpmfi fi = psm->fi;
return RPMRC_OK;
}
-/*@=bounds@*/
rpmRC rpmInstallSourcePackage(rpmts ts, FD_t fd,
const char ** specFilePtr, const char ** cookie)
break;
default:
goto exit;
- /*@notreached@*/ break;
+ break;
}
if (h == NULL)
goto exit;
goto exit;
}
-/*@-onlytrans@*/ /* FIX: te reference */
fi->te = rpmtsElement(ts, 0);
-/*@=onlytrans@*/
if (fi->te == NULL) { /* XXX can't happen */
rpmrc = RPMRC_FAIL;
goto exit;
}
-/*@-nullpass@*/ /* FIX fi->h may be null */
fi->te->h = headerLink(fi->h);
-/*@=nullpass@*/
fi->te->fd = fdLink(fd, "installSourcePackage");
hge = fi->hge;
hfd = fi->hfd;
-/*@i@*/ (void) rpmInstallLoadMacros(fi, fi->h);
+(void) rpmInstallLoadMacros(fi, fi->h);
psm->fi = rpmfiLink(fi, NULL);
- /*@-assignexpose -usereleased @*/
psm->te = fi->te;
- /*@=assignexpose =usereleased @*/
if (cookie) {
*cookie = NULL;
}
/* XXX FIXME: can't do endian neutral MD5 verification yet. */
-/*@i@*/ fi->fmd5s = hfd(fi->fmd5s, -1);
+fi->fmd5s = hfd(fi->fmd5s, -1);
/* XXX FIXME: don't do per-file mapping, force global flags. */
fi->fmapflags = _free(fi->fmapflags);
int sourcelen = strlen(_sourcedir) + 2;
char * t;
-/*@i@*/ fi->dnl = hfd(fi->dnl, -1);
+ fi->dnl = hfd(fi->dnl, -1);
fi->dc = 2;
fi->dnl = xmalloc(fi->dc * sizeof(*fi->dnl)
+ fi->fc * sizeof(*fi->dil)
+ speclen + sourcelen);
- /*@-dependenttrans@*/
fi->dil = (unsigned int *)(fi->dnl + fi->dc);
- /*@=dependenttrans@*/
memset(fi->dil, 0, fi->fc * sizeof(*fi->dil));
fi->dil[i] = 1;
- /*@-dependenttrans@*/
fi->dnl[0] = t = (char *)(fi->dil + fi->fc);
fi->dnl[1] = t = stpcpy( stpcpy(t, _sourcedir), "/") + 1;
- /*@=dependenttrans@*/
(void) stpcpy( stpcpy(t, _specdir), "/");
t = xmalloc(speclen + strlen(fi->bnl[i]) + 1);
psm->goal = PSM_PKGINSTALL;
- /*@-compmempass@*/ /* FIX: psm->fi->dnl should be owned. */
+ /* FIX: psm->fi->dnl should be owned. */
rpmrc = rpmpsmStage(psm, PSM_PROCESS);
(void) rpmpsmStage(psm, PSM_FINI);
- /*@=compmempass@*/
if (rpmrc) rpmrc = RPMRC_FAIL;
if (h != NULL) h = headerFree(h);
- /*@-branchstate@*/
if (fi != NULL) {
fi->te->h = headerFree(fi->te->h);
if (fi->te->fd != NULL)
fi->te = NULL;
fi = rpmfiFree(fi);
}
- /*@=branchstate@*/
/* XXX nuke the added package(s). */
rpmtsClean(ts);
return rpmrc;
}
-/*@observer@*/ /*@unchecked@*/
static char * SCRIPT_PATH = "PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin";
/**
* @param tag scriptlet tag
* @return name of scriptlet
*/
-static /*@observer@*/ const char * tag2sln(int tag)
- /*@*/
+static const char * tag2sln(int tag)
{
switch (tag) {
case RPMTAG_PRETRANS: return "%pretrans";
* @return
*/
static pid_t psmWait(rpmpsm psm)
- /*@globals fileSystem, internalState @*/
- /*@modifies psm, fileSystem, internalState @*/
{
const rpmts ts = psm->ts;
rpmtime_t msecs;
static rpmRC runLuaScript(rpmpsm psm, Header h, const char *sln,
int progArgc, const char **progArgv,
const char *script, int arg1, int arg2)
- /*@globals fileSystem, internalState @*/
- /*@modifies psm, fileSystem, internalState @*/
{
const rpmts ts = psm->ts;
int rootFd = -1;
if (!rpmtsChrootDone(ts)) {
const char *rootDir = rpmtsRootDir(ts);
xx = chdir("/");
-/*@-nullpass@*/
rootFd = open(".", O_RDONLY, 0);
-/*@=nullpass@*/
if (rootFd >= 0) {
- /*@-superuser -noeffect @*/
if (rootDir != NULL && strcmp(rootDir, "/") && *rootDir == '/')
xx = chroot(rootDir);
- /*@=superuser =noeffect @*/
xx = rpmtsSetChrootDone(ts, 1);
}
}
rpmluaPushTable(lua, "arg");
var = rpmluavNew();
rpmluavSetListMode(var, 1);
-/*@+relaxtypes@*/
if (progArgv) {
for (i = 0; i < progArgc && progArgv[i]; i++) {
rpmluavSetValue(var, RPMLUAV_STRING, progArgv[i]);
rpmluavSetValueNum(var, arg2);
rpmluaSetVar(lua, var);
}
-/*@=relaxtypes@*/
-/*@-moduncon@*/
var = rpmluavFree(var);
-/*@=moduncon@*/
rpmluaPop(lua);
{
const char *rootDir = rpmtsRootDir(ts);
xx = fchdir(rootFd);
xx = close(rootFd);
- /*@-superuser -noeffect @*/
if (rootDir != NULL && strcmp(rootDir, "/") && *rootDir == '/')
xx = chroot(".");
- /*@=superuser =noeffect @*/
xx = rpmtsSetChrootDone(ts, 0);
}
/**
*/
-/*@unchecked@*/
static int ldconfig_done = 0;
-/*@unchecked@*/ /*@observer@*/ /*@null@*/
static const char * ldconfig_path = "/sbin/ldconfig";
/**
static rpmRC runScript(rpmpsm psm, Header h, const char * sln,
int progArgc, const char ** progArgv,
const char * script, int arg1, int arg2)
- /*@globals ldconfig_done, rpmGlobalMacroContext, h_errno,
- fileSystem, internalState@*/
- /*@modifies psm, ldconfig_done, rpmGlobalMacroContext,
- fileSystem, internalState @*/
{
const rpmts ts = psm->ts;
rpmfi fi = psm->fi;
const char * rootDir = rpmtsRootDir(ts);
FD_t fd;
- /*@-branchstate@*/
if (makeTempFile((!rpmtsChrootDone(ts) ? rootDir : "/"), &fn, &fd)) {
if (prefixes != NULL && freePrefixes) free(prefixes);
return RPMRC_FAIL;
}
- /*@=branchstate@*/
if (rpmIsDebug() &&
(!strcmp(argv[0], "/bin/sh") || !strcmp(argv[0], "/bin/bash")))
}
if (out == NULL) return RPMRC_FAIL; /* XXX can't happen */
- /*@-branchstate@*/
xx = rpmsqFork(&psm->sq);
if (psm->sq.child == 0) {
const char * rootDir;
path = ipath;
xx = doputenv(path);
- /*@-modobserver@*/
ipath = _free(ipath);
- /*@=modobserver@*/
}
if (prefixes != NULL)
case URL_IS_PATH:
rootDir += sizeof("file://") - 1;
rootDir = strchr(rootDir, '/');
- /*@fallthrough@*/
case URL_IS_UNKNOWN:
if (!rpmtsChrootDone(ts) &&
!(rootDir[0] == '/' && rootDir[1] == '\0'))
{
- /*@-superuser -noeffect @*/
xx = chroot(rootDir);
- /*@=superuser =noeffect @*/
}
xx = chdir("/");
rpmMessage(RPMMESS_DEBUG, _("%s: %s(%s-%s-%s.%s)\texecv(%s) pid %d\n"),
/* Permit libselinux to do the scriptlet exec. */
if (rpmtsSELinuxEnabled(ts) == 1) {
-/*@-moduncon@*/
xx = rpm_execcon(0, argv[0], (char ** const) argv, environ);
-/*@=moduncon@*/
if (xx != 0)
break;
}
-/*@-nullstate@*/
xx = execv(argv[0], (char *const *)argv);
-/*@=nullstate@*/
break;
case URL_IS_HTTPS:
case URL_IS_HTTP:
}
_exit(-1);
- /*@notreached@*/
}
- /*@=branchstate@*/
if (psm->sq.child == (pid_t)-1) {
rpmError(RPMERR_FORK, _("Couldn't fork %s: %s\n"), sln, strerror(errno));
xx = Fclose(out); /* XXX dup'd STDOUT_FILENO */
- /*@-branchstate@*/
if (script) {
if (!rpmIsDebug())
xx = unlink(fn);
fn = _free(fn);
}
- /*@=branchstate@*/
return rc;
}
* @return rpmRC return code
*/
static rpmRC runInstScript(rpmpsm psm)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies psm, rpmGlobalMacroContext, fileSystem, internalState @*/
{
rpmfi fi = psm->fi;
HGE_t hge = fi->hge;
if (progArgv == NULL && script == NULL)
goto exit;
- /*@-branchstate@*/
if (progArgv && ptt == RPM_STRING_TYPE) {
argv = alloca(sizeof(*argv));
*argv = (const char *) progArgv;
} else {
argv = (const char **) progArgv;
}
- /*@=branchstate@*/
if (fi->h != NULL) /* XXX can't happen */
rc = runScript(psm, fi->h, tag2sln(psm->scriptTag), progArgc, argv,
static rpmRC handleOneTrigger(const rpmpsm psm,
Header sourceH, Header triggeredH,
int arg2, unsigned char * triggersAlreadyRun)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState@*/
- /*@modifies psm, sourceH, triggeredH, *triggersAlreadyRun,
- rpmGlobalMacroContext, fileSystem, internalState @*/
{
int scareMem = 1;
const rpmts ts = psm->ts;
* @return 0 on success
*/
static rpmRC runTriggers(rpmpsm psm)
- /*@globals rpmGlobalMacroContext, h_errno,
- fileSystem, internalState @*/
- /*@modifies psm, rpmGlobalMacroContext,
- fileSystem, internalState @*/
{
const rpmts ts = psm->ts;
rpmfi fi = psm->fi;
* @return 0 on success
*/
static rpmRC runImmedTriggers(rpmpsm psm)
- /*@globals rpmGlobalMacroContext, h_errno,
- fileSystem, internalState @*/
- /*@modifies psm, rpmGlobalMacroContext,
- fileSystem, internalState @*/
{
const rpmts ts = psm->ts;
rpmfi fi = psm->fi;
return rc;
}
-/*@observer@*/ static const char * pkgStageString(pkgStage a)
- /*@*/
+static const char * pkgStageString(pkgStage a)
{
switch(a) {
case PSM_UNKNOWN: return "unknown";
default: return "???";
}
- /*@noteached@*/
}
rpmpsm XrpmpsmUnlink(rpmpsm psm, const char * msg, const char * fn, unsigned ln)
{
if (psm == NULL) return NULL;
-/*@-modfilesys@*/
if (_psm_debug && msg != NULL)
fprintf(stderr, "--> psm %p -- %d %s at %s:%u\n", psm, psm->nrefs, msg, fn, ln);
-/*@=modfilesys@*/
psm->nrefs--;
return NULL;
}
if (psm == NULL) return NULL;
psm->nrefs++;
-/*@-modfilesys@*/
if (_psm_debug && msg != NULL)
fprintf(stderr, "--> psm %p ++ %d %s at %s:%u\n", psm, psm->nrefs, msg, fn, ln);
-/*@=modfilesys@*/
- /*@-refcounttrans@*/ return psm; /*@=refcounttrans@*/
+ return psm;
}
rpmpsm rpmpsmFree(rpmpsm psm)
if (psm->nrefs > 1)
return rpmpsmUnlink(psm, msg);
-/*@-nullstate@*/
psm->fi = rpmfiFree(psm->fi);
#ifdef NOTYET
psm->te = rpmteFree(psm->te);
#else
psm->te = NULL;
#endif
-/*@-internalglobs@*/
psm->ts = rpmtsFree(psm->ts);
-/*@=internalglobs@*/
(void) rpmpsmUnlink(psm, msg);
- /*@-refcounttrans -usereleased@*/
-/*@-boundswrite@*/
memset(psm, 0, sizeof(*psm)); /* XXX trash and burn */
-/*@=boundswrite@*/
psm = _free(psm);
- /*@=refcounttrans =usereleased@*/
return NULL;
-/*@=nullstate@*/
}
rpmpsm rpmpsmNew(rpmts ts, rpmte te, rpmfi fi)
#ifdef NOTYET
if (te) psm->te = rpmteLink(te, msg);
#else
-/*@-assignexpose -temptrans @*/
if (te) psm->te = te;
-/*@=assignexpose =temptrans @*/
#endif
if (fi) psm->fi = rpmfiLink(fi, msg);
}
static void * rpmpsmThread(void * arg)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies arg, rpmGlobalMacroContext, fileSystem, internalState @*/
{
rpmpsm psm = arg;
-/*@-unqualifiedtrans@*/
return ((void *) rpmpsmStage(psm, psm->nstage));
-/*@=unqualifiedtrans@*/
}
static int rpmpsmNext(rpmpsm psm, pkgStage nstage)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies psm, rpmGlobalMacroContext, fileSystem, internalState @*/
{
psm->nstage = nstage;
if (_psm_threads)
* @todo Packages w/o files never get a callback, hence don't get displayed
* on install with -v.
*/
-/*@-bounds -nullpass@*/ /* FIX: testing null annotation for fi->h */
+/* FIX: testing null annotation for fi->h */
rpmRC rpmpsmStage(rpmpsm psm, pkgStage stage)
{
const rpmts ts = psm->ts;
int saveerrno;
int xx;
- /*@-branchstate@*/
switch (stage) {
case PSM_UNKNOWN:
break;
while ((psm->oh = rpmdbNextIterator(psm->mi)) != NULL) {
fi->record = rpmdbGetIteratorOffset(psm->mi);
psm->oh = NULL;
- /*@loopbreak@*/ break;
+ break;
}
psm->mi = rpmdbFreeIterator(psm->mi);
rc = RPMRC_OK;
/* XXX this is headerCopy w/o headerReload() */
psm->oh = headerNew();
- /*@-branchstate@*/
for (hi = headerInitIterator(oh);
headerNextIterator(hi, &tag, &type, &ptr, &count);
ptr = headerFreeData((void *)ptr, type))
if (ptr) (void) headerAddEntry(psm->oh, tag, type, ptr, count);
}
hi = headerFreeIterator(hi);
- /*@=branchstate@*/
oh = headerFree(oh);
uh = hfd(uh, uht);
}
/* Retrieve type of payload compression. */
- /*@-nullstate@*/ /* FIX: psm->oh may be NULL */
+ /* FIX: psm->oh may be NULL */
rc = rpmpsmNext(psm, PSM_RPMIO_FLAGS);
- /*@=nullstate@*/
/* Write the lead section into the package. */
{ int archnum = -1;
break;
}
- /*@-nullpass@*/ /* LCL: fi->fd != NULL here. */
+ /* LCL: fi->fd != NULL here. */
psm->cfd = Fdopen(fdDup(Fileno(rpmteFd(fi->te))), psm->rpmio_flags);
- /*@=nullpass@*/
if (psm->cfd == NULL) { /* XXX can't happen */
rc = RPMRC_FAIL;
break;
saveerrno = errno; /* XXX FIXME: Fclose with libio destroys errno */
xx = Fclose(psm->cfd);
psm->cfd = NULL;
- /*@-mods@*/
errno = saveerrno; /* XXX FIXME: Fclose with libio destroys errno */
- /*@=mods@*/
if (!rc)
rc = rpmpsmNext(psm, PSM_COMMIT);
rc = RPMRC_FAIL;
break;
}
- /*@-nullpass@*/ /* FIX: fdDup mey return NULL. */
+ /* FIX: fdDup mey return NULL. */
xx = Fflush(psm->fd);
psm->cfd = Fdopen(fdDup(Fileno(psm->fd)), psm->rpmio_flags);
- /*@=nullpass@*/
if (psm->cfd == NULL) { /* XXX can't happen */
rc = RPMRC_FAIL;
break;
saveerrno = errno; /* XXX FIXME: Fclose with libio destroys errno */
xx = Fclose(psm->cfd);
psm->cfd = NULL;
- /*@-mods@*/
errno = saveerrno;
- /*@=mods@*/
/* XXX make sure progress is closed out */
psm->what = RPMCALLBACK_INST_PROGRESS;
saveerrno = errno; /* XXX FIXME: Fclose with libio destroys errno */
xx = Fclose(psm->fd);
psm->fd = NULL;
- /*@-mods@*/
errno = saveerrno;
- /*@=mods@*/
}
if (psm->goal == PSM_PKGSAVE) {
psm->what = RPMCALLBACK_CPIO_ERROR;
psm->amount = 0;
psm->total = 0;
- /*@-nullstate@*/ /* FIX: psm->fd may be NULL. */
+ /* FIX: psm->fd may be NULL. */
xx = rpmpsmNext(psm, PSM_NOTIFY);
- /*@=nullstate@*/
}
-/*@-branchstate@*/
if (psm->goal == PSM_PKGERASE || psm->goal == PSM_PKGSAVE) {
if (psm->te != NULL)
if (psm->te->h != NULL)
if (fi->h != NULL)
fi->h = headerFree(fi->h);
}
-/*@=branchstate@*/
psm->oh = headerFree(psm->oh);
psm->pkgURL = _free(psm->pkgURL);
psm->rpmio_flags = _free(psm->rpmio_flags);
break;
case PSM_NOTIFY:
{ void * ptr;
-/*@-nullpass@*/ /* FIX: psm->te may be NULL */
+/* FIX: psm->te may be NULL */
ptr = rpmtsNotify(ts, psm->te, psm->what, psm->amount, psm->total);
-/*@-nullpass@*/
} break;
case PSM_DESTROY:
break;
}
xx = chdir("/");
- /*@-superuser@*/
if (rootDir != NULL && strcmp(rootDir, "/") && *rootDir == '/')
rc = chroot(rootDir);
- /*@=superuser@*/
psm->chrootDone = 1;
(void) rpmtsSetChrootDone(ts, 1);
}
if (psm->chrootDone) {
const char * rootDir = rpmtsRootDir(ts);
const char * currDir = rpmtsCurrDir(ts);
- /*@-superuser@*/
if (rootDir != NULL && strcmp(rootDir, "/") && *rootDir == '/')
rc = chroot(".");
- /*@=superuser@*/
psm->chrootDone = 0;
(void) rpmtsSetChrootDone(ts, 0);
if (currDir != NULL) /* XXX can't happen */
{ const char * payload_compressor = NULL;
char * t;
- /*@-branchstate@*/
if (!hge(fi->h, RPMTAG_PAYLOADCOMPRESSOR, NULL,
(void **) &payload_compressor, NULL))
payload_compressor = "gzip";
- /*@=branchstate@*/
psm->rpmio_flags = t = xmalloc(sizeof("w9.gzdio"));
*t = '\0';
t = stpcpy(t, ((psm->goal == PSM_PKGSAVE) ? "w9" : "r"));
default:
break;
-/*@i@*/ }
- /*@=branchstate@*/
+ }
- /*@-nullstate@*/ /* FIX: psm->oh and psm->fi->h may be NULL. */
+ /* FIX: psm->oh and psm->fi->h may be NULL. */
return rc;
- /*@=nullstate@*/
}
-/*@=bounds =nullpass@*/
#include <rpmsq.h>
-/*@-exportlocal@*/
-/*@unchecked@*/
extern int _psm_debug;
-/*@=exportlocal@*/
/**
*/
struct rpmpsm_s {
struct rpmsqElem sq; /*!< Scriptlet/signal queue element. */
-/*@refcounted@*/
rpmts ts; /*!< transaction set */
-/*@dependent@*/ /*@null@*/
rpmte te; /*!< current transaction element */
-/*@refcounted@*/ /*@relnull@*/
rpmfi fi; /*!< transaction element file info */
-/*@relnull@*/
FD_t cfd; /*!< Payload file handle. */
-/*@relnull@*/
FD_t fd; /*!< Repackage file handle. */
Header oh; /*!< Repackage header. */
-/*@null@*/
rpmdbMatchIterator mi;
-/*@observer@*/
const char * stepName;
-/*@only@*/ /*@null@*/
const char * rpmio_flags;
-/*@only@*/ /*@null@*/
const char * failedFile;
-/*@only@*/ /*@null@*/
const char * pkgURL; /*!< Repackage URL. */
-/*@dependent@*/
const char * pkgfn; /*!< Repackage file name. */
int scriptTag; /*!< Scriptlet data tag. */
int progTag; /*!< Scriptlet interpreter tag. */
unsigned long total; /*!< Callback total. */
rpmRC rc;
pkgStage goal;
-/*@unused@*/
pkgStage stage; /*!< Current psm stage. */
pkgStage nstage; /*!< Next psm stage. */
-/*@refs@*/
int nrefs; /*!< Reference count. */
};
* @param msg
* @return NULL always
*/
-/*@unused@*/ /*@null@*/
-rpmpsm rpmpsmUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmpsm psm,
- /*@null@*/ const char * msg)
- /*@modifies psm @*/;
+rpmpsm rpmpsmUnlink (rpmpsm psm,
+ const char * msg);
/** @todo Remove debugging entry from the ABI. */
-/*@-exportlocal@*/
-/*@null@*/
-rpmpsm XrpmpsmUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmpsm psm,
- /*@null@*/ const char * msg, const char * fn, unsigned ln)
- /*@modifies psm @*/;
-/*@=exportlocal@*/
+rpmpsm XrpmpsmUnlink (rpmpsm psm,
+ const char * msg, const char * fn, unsigned ln);
#define rpmpsmUnlink(_psm, _msg) XrpmpsmUnlink(_psm, _msg, __FILE__, __LINE__)
/**
* @param msg
* @return new package state machine reference
*/
-/*@unused@*/ /*@newref@*/ /*@null@*/
-rpmpsm rpmpsmLink (/*@null@*/ rpmpsm psm, /*@null@*/ const char * msg)
- /*@modifies psm @*/;
+rpmpsm rpmpsmLink (rpmpsm psm, const char * msg);
/** @todo Remove debugging entry from the ABI. */
-/*@-exportlocal@*/
-/*@newref@*/ /*@null@*/
-rpmpsm XrpmpsmLink (/*@null@*/ rpmpsm psm, /*@null@*/ const char * msg,
- const char * fn, unsigned ln)
- /*@modifies psm @*/;
-/*@=exportlocal@*/
+rpmpsm XrpmpsmLink (rpmpsm psm, const char * msg,
+ const char * fn, unsigned ln);
#define rpmpsmLink(_psm, _msg) XrpmpsmLink(_psm, _msg, __FILE__, __LINE__)
/**
* @param psm package state machine
* @return NULL always
*/
-/*@null@*/
-rpmpsm rpmpsmFree(/*@killref@*/ /*@only@*/ /*@null@*/ rpmpsm psm)
- /*@globals fileSystem @*/
- /*@modifies psm, fileSystem @*/;
+rpmpsm rpmpsmFree(rpmpsm psm);
/**
* Create and load a package state machine.
* @param fi file info set
* @return new package state machine
*/
-/*@null@*/
-rpmpsm rpmpsmNew(rpmts ts, /*@null@*/ rpmte te, rpmfi fi)
- /*@modifies ts, fi @*/;
+rpmpsm rpmpsmNew(rpmts ts, rpmte te, rpmfi fi);
/**
* Package state machine driver.
* @param stage next stage
* @return 0 on success
*/
-rpmRC rpmpsmStage(rpmpsm psm, pkgStage stage)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies psm, rpmGlobalMacroContext, fileSystem, internalState @*/;
+rpmRC rpmpsmStage(rpmpsm psm, pkgStage stage);
#define rpmpsmUNSAFE rpmpsmSTAGE
#ifdef __cplusplus
#include "system.h"
#ifndef PATH_MAX
-/*@-incondefs@*/ /* FIX: long int? */
# define PATH_MAX 255
-/*@=incondefs@*/
#endif
#include <rpmcli.h>
#include "debug.h"
#include "misc.h"
-/*@access rpmgi @*/
/**
*/
unsigned short rdev, unsigned int nlink,
const char * owner, const char * group,
const char * linkto)
- /*@modifies *te @*/
{
char sizefield[15];
char ownerfield[8+1], groupfield[8+1];
if (now == 0) {
now = time(NULL);
tm = localtime(&now);
-/*@-boundsread@*/
if (tm) nowtm = *tm; /* structure assignment */
-/*@=boundsread@*/
}
strncpy(ownerfield, owner, sizeof(ownerfield));
/**
*/
-static inline /*@null@*/ const char * queryHeader(Header h, const char * qfmt)
- /*@*/
+static inline const char * queryHeader(Header h, const char * qfmt)
{
const char * errstr = "(unkown error)";
const char * str;
-/*@-modobserver@*/
str = headerSprintf(h, qfmt, rpmTagTable, rpmHeaderFormats, &errstr);
-/*@=modobserver@*/
if (str == NULL)
rpmError(RPMERR_QFMT, _("incorrect format: %s\n"), errstr);
return str;
/**
*/
static void flushBuffer(char ** tp, char ** tep, int nonewline)
- /*@ modifies *tp, *tep @*/
{
char *t, *te;
int i;
te = t = xmalloc(tb);
-/*@-boundswrite@*/
*te = '\0';
-/*@=boundswrite@*/
if (qva->qva_queryFormat != NULL) {
const char * str = queryHeader(h, qva->qva_queryFormat);
- /*@-branchstate@*/
if (str) {
size_t tx = (te - t);
t = xrealloc(t, tb);
te = t + tx;
}
-/*@-boundswrite@*/
- /*@-usereleased@*/
te = stpcpy(te, str);
- /*@=usereleased@*/
-/*@=boundswrite@*/
str = _free(str);
flushBuffer(&t, &te, 1);
}
- /*@=branchstate@*/
}
if (!(qva->qva_flags & QUERY_FOR_LIST))
fi = rpmfiNew(ts, h, RPMTAG_BASENAMES, scareMem);
if (rpmfiFC(fi) <= 0) {
-/*@-boundswrite@*/
te = stpcpy(te, _("(contains no files)"));
-/*@=boundswrite@*/
goto exit;
}
fstate = rpmfiFState(fi);
fsize = rpmfiFSize(fi);
fn = rpmfiFN(fi);
-/*@-bounds@*/
{ static char hex[] = "0123456789abcdef";
unsigned const char * s = rpmfiMD5(fi);
char * p = fmd5;
}
*p = '\0';
}
-/*@=bounds@*/
fuser = rpmfiFUser(fi);
fgroup = rpmfiFGroup(fi);
flink = rpmfiFLink(fi);
te = t + tx;
}
-/*@-boundswrite@*/
if (!rpmIsVerbose() && prefix)
te = stpcpy(te, prefix);
switch (fstate) {
case RPMFILE_STATE_NORMAL:
te = stpcpy(te, _("normal "));
- /*@switchbreak@*/ break;
+ break;
case RPMFILE_STATE_REPLACED:
te = stpcpy(te, _("replaced "));
- /*@switchbreak@*/ break;
+ break;
case RPMFILE_STATE_NOTINSTALLED:
te = stpcpy(te, _("not installed "));
- /*@switchbreak@*/ break;
+ break;
case RPMFILE_STATE_NETSHARED:
te = stpcpy(te, _("net shared "));
- /*@switchbreak@*/ break;
+ break;
case RPMFILE_STATE_WRONGCOLOR:
te = stpcpy(te, _("wrong color "));
- /*@switchbreak@*/ break;
+ break;
case RPMFILE_STATE_MISSING:
te = stpcpy(te, _("(no state) "));
- /*@switchbreak@*/ break;
+ break;
default:
sprintf(te, _("(unknown %3d) "), fstate);
te += strlen(te);
- /*@switchbreak@*/ break;
+ break;
}
}
-/*@=boundswrite@*/
if (qva->qva_flags & QUERY_FOR_DUMPFILES) {
sprintf(te, "%s %d %d %s 0%o ", fn, (int)fsize, fmtime, fmd5, fmode);
te += strlen(te);
if (fuser && fgroup) {
-/*@-nullpass@*/
sprintf(te, "%s %s", fuser, fgroup);
-/*@=nullpass@*/
te += strlen(te);
} else {
rpmError(RPMERR_INTERNAL,
te += strlen(te);
} else
if (!rpmIsVerbose()) {
-/*@-boundswrite@*/
te = stpcpy(te, fn);
-/*@=boundswrite@*/
}
else {
}
if (fuser && fgroup) {
-/*@-nullpass@*/
printFileInfo(te, fn, fsize, fmode, fmtime, frdev, fnlink,
fuser, fgroup, flink);
-/*@=nullpass@*/
te += strlen(te);
} else {
rpmError(RPMERR_INTERNAL,
/* XXX don't print query tags twice. */
for (i = 0, t = rpmTagTable; i < rpmTagTableSize; i++, t++) {
if (t->name == NULL) /* XXX programmer error. */
- /*@innercontinue@*/ continue;
+ continue;
if (!strcmp(t->name, ext->name))
- /*@innerbreak@*/ break;
+ break;
}
if (i >= rpmTagTableSize && ext->type == HEADER_EXT_TAG)
fprintf(fp, "%s\n", ext->name + 7);
}
static int rpmgiShowMatches(QVA_t qva, rpmts ts)
- /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
- /*@modifies qva, rpmGlobalMacroContext, h_errno, internalState @*/
{
rpmgi gi = qva->qva_gi;
int ec = 0;
* @return binary nibble
*/
static inline unsigned char nibble(char c)
- /*@*/
{
if (c >= '0' && c <= '9')
return (c - '0');
return 0;
}
-/*@-bounds@*/ /* LCL: segfault (realpath annotation?) */
+/* LCL: segfault (realpath annotation?) */
int rpmQueryVerify(QVA_t qva, rpmts ts, const char * arg)
{
int res = 0;
if (qva->qva_showPackage == NULL)
return 1;
- /*@-branchstate@*/
switch (qva->qva_source) {
case RPMQV_RPM:
res = rpmgiShowMatches(qva, ts);
res = rpmcliShowMatches(qva, ts);
break;
}
- /*@fallthrough@*/
case RPMQV_PATH:
{ char * fn;
int myerrno = 0;
for (s = arg; *s != '\0'; s++)
if (!(*s == '.' || *s == '/'))
- /*@loopbreak@*/ break;
+ break;
if (*s == '\0') {
char fnbuf[PATH_MAX];
}
}
- /*@=branchstate@*/
return res;
}
-/*@=bounds@*/
int rpmcliArgIter(rpmts ts, QVA_t qva, ARGV_t argv)
{
if (rpmrc != RPMRC_NOTFOUND)
return 1; /* XXX should be no. of failures. */
- /*@-nullpass@*/ /* FIX: argv can be NULL, cast to pass argv array */
+ /* FIX: argv can be NULL, cast to pass argv array */
ec = rpmQueryVerify(qva, ts, (const char *) argv);
- /*@=nullpass@*/
rpmtsEmpty(ts);
break;
case RPMQV_RPM:
if (rpmrc != RPMRC_NOTFOUND)
return 1; /* XXX should be no. of failures. */
- /*@-nullpass@*/ /* FIX: argv can be NULL, cast to pass argv array */
+ /* FIX: argv can be NULL, cast to pass argv array */
ec = rpmQueryVerify(qva, ts, NULL);
- /*@=nullpass@*/
rpmtsEmpty(ts);
break;
case RPMQV_HDLIST:
if (rpmrc != RPMRC_NOTFOUND)
return 1; /* XXX should be no. of failures. */
- /*@-nullpass@*/ /* FIX: argv can be NULL, cast to pass argv array */
+ /* FIX: argv can be NULL, cast to pass argv array */
ec = rpmQueryVerify(qva, ts, NULL);
- /*@=nullpass@*/
rpmtsEmpty(ts);
break;
case RPMQV_FTSWALK:
if (rpmrc != RPMRC_NOTFOUND)
return 1; /* XXX should be no. of failures. */
- /*@-nullpass@*/ /* FIX: argv can be NULL, cast to pass argv array */
+ /* FIX: argv can be NULL, cast to pass argv array */
ec = rpmQueryVerify(qva, ts, NULL);
- /*@=nullpass@*/
rpmtsEmpty(ts);
break;
default:
#include "debug.h"
-typedef /*@abstract@*/ struct availablePackage_s * availablePackage;
+typedef struct availablePackage_s * availablePackage;
-/*@unchecked@*/
int _rpmal_debug = 0;
-/*@access alKey @*/
-/*@access alNum @*/
-/*@access rpmal @*/
-/*@access availablePackage @*/
-
-/*@access fnpyKey @*/ /* XXX suggestedKeys array */
/** \ingroup rpmdep
* Info about a single package to be installed.
*/
struct availablePackage_s {
-/*@refcounted@*/ /*@null@*/
rpmds provides; /*!< Provides: dependencies. */
-/*@refcounted@*/ /*@null@*/
rpmfi fi; /*!< File info set. */
uint_32 tscolor; /*!< Transaction color bits. */
-/*@exposed@*/ /*@dependent@*/ /*@null@*/
fnpyKey key; /*!< Associated file name/python object */
};
-typedef /*@abstract@*/ struct availableIndexEntry_s * availableIndexEntry;
-/*@access availableIndexEntry@*/
+typedef struct availableIndexEntry_s * availableIndexEntry;
/** \ingroup rpmdep
* A single available item (e.g. a Provides: dependency).
*/
struct availableIndexEntry_s {
-/*@exposed@*/ /*@dependent@*/ /*@null@*/
alKey pkgKey; /*!< Containing package. */
-/*@observer@*/
const char * entry; /*!< Dependency name. */
unsigned short entryLen; /*!< No. of bytes in name. */
unsigned short entryIx; /*!< Dependency index. */
} type; /*!< Type of available item. */
};
-typedef /*@abstract@*/ struct availableIndex_s * availableIndex;
-/*@access availableIndex@*/
+typedef struct availableIndex_s * availableIndex;
/** \ingroup rpmdep
* Index of all available items.
*/
struct availableIndex_s {
-/*@null@*/
availableIndexEntry index; /*!< Array of available items. */
int size; /*!< No. of available items. */
int k; /*!< Current index. */
};
-typedef /*@abstract@*/ struct fileIndexEntry_s * fileIndexEntry;
-/*@access fileIndexEntry@*/
+typedef struct fileIndexEntry_s * fileIndexEntry;
/** \ingroup rpmdep
* A file to be installed/removed.
*/
struct fileIndexEntry_s {
-/*@dependent@*/ /*@relnull@*/
const char * baseName; /*!< File basename. */
int baseNameLen;
alNum pkgNum; /*!< Containing package index. */
uint_32 ficolor;
};
-typedef /*@abstract@*/ struct dirInfo_s * dirInfo;
-/*@access dirInfo@*/
+typedef struct dirInfo_s * dirInfo;
/** \ingroup rpmdep
* A directory to be installed/removed.
*/
struct dirInfo_s {
-/*@owned@*/ /*@relnull@*/
const char * dirName; /*!< Directory path (+ trailing '/'). */
int dirNameLen; /*!< No. bytes in directory path. */
-/*@owned@*/
fileIndexEntry files; /*!< Array of files in directory. */
int numFiles; /*!< No. files in directory. */
};
* Set of available packages, items, and directories.
*/
struct rpmal_s {
-/*@owned@*/ /*@null@*/
availablePackage list; /*!< Set of packages. */
struct availableIndex_s index; /*!< Set of available items. */
int delta; /*!< Delta for pkg list reallocation. */
int alloced; /*!< No. of pkgs allocated for list. */
uint_32 tscolor; /*!< Transaction color. */
int numDirs; /*!< No. of directories. */
-/*@owned@*/ /*@null@*/
dirInfo dirs; /*!< Set of directories. */
};
* @param al available list
*/
static void rpmalFreeIndex(rpmal al)
- /*@modifies al @*/
{
availableIndex ai = &al->index;
if (ai->size > 0) {
* @param al available list
* @return no. of packages in list
*/
-static int alGetSize(/*@null@*/ const rpmal al)
- /*@*/
+static int alGetSize(const rpmal al)
{
return (al != NULL ? al->size : 0);
}
#endif
-static inline alNum alKey2Num(/*@unused@*/ /*@null@*/ const rpmal al,
- /*@null@*/ alKey pkgKey)
- /*@*/
+static inline alNum alKey2Num(const rpmal al,
+ alKey pkgKey)
{
- /*@-nullret -temptrans -retalias @*/
return ((alNum)pkgKey);
- /*@=nullret =temptrans =retalias @*/
}
-static inline alKey alNum2Key(/*@unused@*/ /*@null@*/ const rpmal al,
- /*@null@*/ alNum pkgNum)
- /*@*/
+static inline alKey alNum2Key(const rpmal al,
+ alNum pkgNum)
{
- /*@-nullret -temptrans -retalias @*/
return ((alKey)pkgNum);
- /*@=nullret =temptrans =retalias @*/
}
#ifdef DYING
* @param pkgKey available package key
* @return available package pointer
*/
-/*@dependent@*/ /*@null@*/
-static availablePackage alGetPkg(/*@null@*/ const rpmal al,
- /*@null@*/ alKey pkgKey)
- /*@*/
+static availablePackage alGetPkg(const rpmal al,
+ alKey pkgKey)
{
alNum pkgNum = alKey2Num(al, pkgKey);
availablePackage alp = NULL;
* @return result of comparison
*/
static int dieCompare(const void * one, const void * two)
- /*@*/
{
- /*@-castexpose@*/
const dirInfo a = (const dirInfo) one;
const dirInfo b = (const dirInfo) two;
- /*@=castexpose@*/
int lenchk = a->dirNameLen - b->dirNameLen;
if (lenchk || a->dirNameLen == 0)
* @return result of comparison
*/
static int fieCompare(const void * one, const void * two)
- /*@*/
{
- /*@-castexpose@*/
const fileIndexEntry a = (const fileIndexEntry) one;
const fileIndexEntry b = (const fileIndexEntry) two;
- /*@=castexpose@*/
int lenchk = a->baseNameLen - b->baseNameLen;
if (lenchk)
return lenchk;
#ifdef NOISY
-/*@-modfilesys@*/
if (_rpmal_debug) {
fprintf(stderr, "\t\tstrcmp(%p:%p, %p:%p)", a, a->baseName, b, b->baseName);
#if 0
fprintf(stderr, " b %s", a->baseName);
fprintf(stderr, "\n");
}
-/*@=modfilesys@*/
#endif
return strcmp(a->baseName, b->baseName);
alp = al->list + pkgNum;
-/*@-modfilesys@*/
if (_rpmal_debug)
fprintf(stderr, "*** del %p[%d]\n", al->list, (int) pkgNum);
-/*@=modfilesys@*/
/* Delete directory/file info entries from added package list. */
if ((fi = alp->fi) != NULL)
(void) rpmfiSetDX(fi, dx);
- /*@-assignexpose -dependenttrans -observertrans@*/
dieNeedle->dirName = (char *) rpmfiDN(fi);
- /*@=assignexpose =dependenttrans =observertrans@*/
dieNeedle->dirNameLen = (dieNeedle->dirName != NULL
? strlen(dieNeedle->dirName) : 0);
-/*@-boundswrite@*/
die = bsearch(dieNeedle, al->dirs, al->numDirs,
sizeof(*dieNeedle), dieCompare);
-/*@=boundswrite@*/
if (die == NULL)
continue;
-/*@-modfilesys@*/
if (_rpmal_debug)
fprintf(stderr, "--- die[%5ld] %p [%3d] %s\n", (die - al->dirs), die, die->dirNameLen, die->dirName);
-/*@=modfilesys@*/
last = die->numFiles;
fie = die->files + last - 1;
for (i = last - 1; i >= 0; i--, fie--) {
if (fie->pkgNum != pkgNum)
- /*@innercontinue@*/ continue;
+ continue;
die->numFiles--;
if (i < die->numFiles) {
-/*@-modfilesys@*/
if (_rpmal_debug)
fprintf(stderr, "\t%p[%3d] memmove(%p:%p,%p:%p,0x%lx) %s <- %s\n", die->files, die->numFiles, fie, fie->baseName, fie+1, (fie+1)->baseName, ((die->numFiles - i) * sizeof(*fie)), fie->baseName, (fie+1)->baseName);
-/*@=modfilesys@*/
-/*@-bounds@*/
memmove(fie, fie+1, (die->numFiles - i) * sizeof(*fie));
-/*@=bounds@*/
}
-/*@-modfilesys@*/
if (_rpmal_debug)
fprintf(stderr, "\t%p[%3d] memset(%p,0,0x%lx) %p [%3d] %s\n", die->files, die->numFiles, die->files + die->numFiles, sizeof(*fie), fie->baseName, fie->baseNameLen, fie->baseName);
-/*@=modfilesys@*/
memset(die->files + die->numFiles, 0, sizeof(*fie)); /* overkill */
}
die->dirName = _free(die->dirName);
al->numDirs--;
if ((die - al->dirs) < al->numDirs) {
-/*@-modfilesys@*/
if (_rpmal_debug)
fprintf(stderr, " die[%5ld] memmove(%p,%p,0x%lx)\n", (die - al->dirs), die, die+1, ((al->numDirs - (die - al->dirs)) * sizeof(*die)));
-/*@=modfilesys@*/
-/*@-bounds@*/
memmove(die, die+1, (al->numDirs - (die - al->dirs)) * sizeof(*die));
-/*@=bounds@*/
}
-/*@-modfilesys@*/
if (_rpmal_debug)
fprintf(stderr, " die[%5d] memset(%p,0,0x%lx)\n", al->numDirs, al->dirs + al->numDirs, sizeof(*die));
-/*@=modfilesys@*/
memset(al->dirs + al->numDirs, 0, sizeof(*al->dirs)); /* overkill */
}
alp->provides = rpmdsFree(alp->provides);
alp->fi = rpmfiFree(alp->fi);
-/*@-boundswrite@*/
memset(alp, 0, sizeof(*alp)); /* XXX trash and burn */
-/*@=boundswrite@*/
return;
}
-/*@-bounds@*/
alKey rpmalAdd(rpmal * alistp, alKey pkgKey, fnpyKey key,
rpmds provides, rpmfi fi, uint_32 tscolor)
{
alp->key = key;
alp->tscolor = tscolor;
-/*@-modfilesys@*/
if (_rpmal_debug)
fprintf(stderr, "*** add %p[%d] 0x%x\n", al->list, (int) pkgNum, tscolor);
-/*@=modfilesys@*/
alp->provides = rpmdsLink(provides, "Provides (rpmalAdd)");
alp->fi = rpmfiLink(fi, "Files (rpmalAdd)");
(void) rpmfiSetDX(fi, i);
iDN = rpmfiDN(fi);
if (iDN != NULL && !strcmp(DN, iDN))
- /*@innerbreak@*/ break;
+ break;
}
dirUnique[dx] = i;
}
/* Find global dirInfo mapping for first encounter. */
(void) rpmfiSetDX(fi, dx);
- /*@-assignexpose -dependenttrans -observertrans@*/
{ DN = rpmfiDN(fi);
#if defined(__ia64__)
#endif
dieNeedle->dirName = DN;
}
- /*@=assignexpose =dependenttrans =observertrans@*/
dieNeedle->dirNameLen = (dieNeedle->dirName != NULL
? strlen(dieNeedle->dirName) : 0);
die->dirNameLen = dieNeedle->dirNameLen;
die->files = NULL;
die->numFiles = 0;
-/*@-modfilesys@*/
if (_rpmal_debug)
fprintf(stderr, "+++ die[%5d] %p [%3d] %s\n", al->numDirs, die, die->dirNameLen, die->dirName);
-/*@=modfilesys@*/
al->numDirs++;
}
dx = rpmfiDX(fi);
while ((next = rpmfiNext(fi)) >= 0) {
if (dx != rpmfiDX(fi))
- /*@innerbreak@*/ break;
+ break;
}
if (next < 0) next = rpmfiFC(fi); /* XXX reset end-of-list */
fie = die->files + die->numFiles;
-/*@-modfilesys@*/
if (_rpmal_debug)
fprintf(stderr, " die[%5d] %p->files [%p[%d],%p) -> [%p[%d],%p)\n", dirMapping[dx], die,
die->files, die->numFiles, die->files+die->numFiles,
fie, (next - first), fie + (next - first));
-/*@=modfilesys@*/
/* Rewind to first file, generate file index entry for each file. */
fi = rpmfiInit(fi, first);
while ((first = rpmfiNext(fi)) >= 0 && first < next) {
- /*@-assignexpose -dependenttrans -observertrans @*/
fie->baseName = rpmfiBN(fi);
- /*@=assignexpose =dependenttrans =observertrans @*/
fie->baseNameLen = (fie->baseName ? strlen(fie->baseName) : 0);
fie->pkgNum = pkgNum;
fie->ficolor = rpmfiFColor(fi);
-/*@-modfilesys@*/
if (_rpmal_debug)
fprintf(stderr, "\t%p[%3d] %p:%p[%2d] %s\n", die->files, die->numFiles, fie, fie->baseName, fie->baseNameLen, rpmfiFN(fi));
-/*@=modfilesys@*/
die->numFiles++;
fie++;
assert(((alNum)(alp - al->list)) == pkgNum);
return ((alKey)(alp - al->list));
}
-/*@=bounds@*/
/**
* Compare two available index entries by name (qsort/bsearch).
* @return result of comparison
*/
static int indexcmp(const void * one, const void * two)
- /*@*/
{
- /*@-castexpose@*/
const availableIndexEntry a = (const availableIndexEntry) one;
const availableIndexEntry b = (const availableIndexEntry) two;
- /*@=castexpose@*/
int lenchk;
lenchk = a->entryLen - b->entryLen;
goto exit;
baseName++;
- /*@-branchstate@*/ /* FIX: ret is a problem */
+ /* FIX: ret is a problem */
for (found = 0, ret = NULL;
die < al->dirs + al->numDirs && dieCompare(die, dieNeedle) == 0;
die++)
{
-/*@-modfilesys@*/
if (_rpmal_debug)
fprintf(stderr, "==> die %p %s\n", die, (die->dirName ? die->dirName : "(nil)"));
-/*@=modfilesys@*/
-/*@-observertrans@*/
fieNeedle->baseName = baseName;
-/*@=observertrans@*/
fieNeedle->baseNameLen = strlen(fieNeedle->baseName);
fie = bsearch(fieNeedle, die->files, die->numFiles,
sizeof(*fieNeedle), fieCompare);
if (fie == NULL)
continue; /* XXX shouldn't happen */
-/*@-modfilesys@*/
if (_rpmal_debug)
fprintf(stderr, "==> fie %p %s\n", fie, (fie->baseName ? fie->baseName : "(nil)"));
-/*@=modfilesys@*/
alp = al->list + fie->pkgNum;
*keyp = alNum2Key(al, fie->pkgNum);
found++;
}
- /*@=branchstate@*/
exit:
dirName = _free(dirName);
return NULL;
needle = memset(alloca(sizeof(*needle)), 0, sizeof(*needle));
- /*@-assignexpose -temptrans@*/
needle->entry = KName;
- /*@=assignexpose =temptrans@*/
needle->entryLen = strlen(needle->entry);
match = bsearch(needle, ai->index, ai->size, sizeof(*ai->index), indexcmp);
if (rc)
rpmdsNotify(ds, _("(added provide)"), 0);
- /*@switchbreak@*/ break;
+ break;
}
- /*@-branchstate@*/
if (rc) {
ret = xrealloc(ret, (found + 2) * sizeof(*ret));
if (ret) /* can't happen */
ret[found] = alp->key;
-/*@-dependenttrans@*/
if (keyp)
*keyp = match->pkgKey;
-/*@=dependenttrans@*/
found++;
}
- /*@=branchstate@*/
}
if (ret)
ret[found] = NULL;
-/*@-nullstate@*/ /* FIX: *keyp may be NULL */
+/* FIX: *keyp may be NULL */
return ret;
-/*@=nullstate@*/
}
fnpyKey
* Structures used for managing added/available package lists.
*/
-/*@-exportlocal@*/
-/*@unchecked@*/
extern int _rpmal_debug;
-/*@=exportlocal@*/
/**
*/
-typedef /*@abstract@*/ struct rpmal_s * rpmal;
+typedef struct rpmal_s * rpmal;
#ifdef __cplusplus
extern "C" {
* @param delta no. of entries to add on each realloc
* @return al new available list
*/
-/*@-exportlocal@*/
-/*@only@*/
-rpmal rpmalCreate(int delta)
- /*@*/;
-/*@=exportlocal@*/
+rpmal rpmalCreate(int delta);
/**
* Free available packages, items, and directory members.
* @param al available list
* @return NULL always
*/
-/*@null@*/
-rpmal rpmalFree(/*@only@*/ /*@null@*/ rpmal al)
- /*@globals fileSystem @*/
- /*@modifies al, fileSystem @*/;
+rpmal rpmalFree(rpmal al);
/**
* Delete package from available list.
* @param al available list
* @param pkgKey package key
*/
-/*@-exportlocal@*/
-void rpmalDel(/*@null@*/ rpmal al, /*@null@*/ alKey pkgKey)
- /*@globals fileSystem @*/
- /*@modifies al, fileSystem @*/;
-/*@=exportlocal@*/
+void rpmalDel(rpmal al, alKey pkgKey);
/**
* Add package to available list.
* @return available package index
*/
alKey rpmalAdd(rpmal * alistp,
- /*@dependent@*/ /*@null@*/ alKey pkgKey,
- /*@dependent@*/ /*@null@*/ fnpyKey key,
- /*@null@*/ rpmds provides, /*@null@*/ rpmfi fi,
- uint_32 tscolor)
- /*@globals fileSystem @*/
- /*@modifies *alistp, provides, fi, fileSystem @*/;
+ alKey pkgKey,
+ fnpyKey key,
+ rpmds provides, rpmfi fi,
+ uint_32 tscolor);
/**
* Add package provides to available list index.
* @param provides added package provides
* @param tscolor transaction color bits
*/
-/*@-exportlocal@*/
void rpmalAddProvides(rpmal al,
- /*@dependent@*/ /*@null@*/ alKey pkgKey,
- /*@null@*/ rpmds provides, uint_32 tscolor)
- /*@modifies al, provides @*/;
-/*@=exportlocal@*/
+ alKey pkgKey,
+ rpmds provides, uint_32 tscolor);
/**
* Generate index for available list.
* @param al available list
*/
-void rpmalMakeIndex(/*@null@*/ rpmal al)
- /*@modifies al @*/;
+void rpmalMakeIndex(rpmal al);
/**
* Check added package file lists for package(s) that provide a file.
* @retval keyp added package key pointer (or NULL)
* @return associated package key(s), NULL if none
*/
-/*@-exportlocal@*/
-/*@only@*/ /*@null@*/
-fnpyKey * rpmalAllFileSatisfiesDepend(/*@null@*/ const rpmal al,
- /*@null@*/ const rpmds ds, /*@null@*/ alKey * keyp)
- /*@globals fileSystem @*/
- /*@modifies al, *keyp, fileSystem @*/;
-/*@=exportlocal@*/
+fnpyKey * rpmalAllFileSatisfiesDepend(const rpmal al,
+ const rpmds ds, alKey * keyp);
/**
* Check added package file lists for package(s) that have a provide.
* @retval keyp added package key pointer (or NULL)
* @return associated package key(s), NULL if none
*/
-/*@only@*/ /*@null@*/
fnpyKey * rpmalAllSatisfiesDepend(const rpmal al, const rpmds ds,
- /*@null@*/ alKey * keyp)
- /*@globals fileSystem @*/
- /*@modifies al, *keyp, fileSystem @*/;
+ alKey * keyp);
/**
* Check added package file lists for first package that has a provide.
* @retval keyp added package key pointer (or NULL)
* @return associated package key, NULL if none
*/
-/*@null@*/
fnpyKey rpmalSatisfiesDepend(const rpmal al, const rpmds ds,
- /*@null@*/ alKey * keyp)
- /*@globals fileSystem @*/
- /*@modifies al, *keyp, fileSystem @*/;
+ alKey * keyp);
#ifdef __cplusplus
}
#include "misc.h" /* XXX for makeTempFile() */
#include "debug.h"
-/*@access FD_t @*/ /* XXX stealing digests */
-/*@access pgpDig @*/
-/*@access pgpDigParams @*/
-
-/*@unchecked@*/
int _print_pkts = 0;
/**
*/
-/*@-boundsread@*/
-static int manageFile(/*@out@*/ FD_t *fdp,
- /*@null@*/ /*@out@*/ const char **fnp,
- int flags, /*@unused@*/ int rc)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies *fdp, *fnp, rpmGlobalMacroContext,
- fileSystem, internalState @*/
+static int manageFile(FD_t *fdp,
+ const char **fnp,
+ int flags, int rc)
{
const char *fn;
FD_t fd;
if (fdp == NULL) /* programmer error */
return 1;
-/*@-boundswrite@*/
/* close and reset *fdp to NULL */
if (*fdp && (fnp == NULL || *fnp == NULL)) {
(void) Fclose(*fdp);
fd = fdFree(fd, "manageFile return");
return 0;
}
-/*@=boundswrite@*/
/* no operation */
if (*fdp != NULL && fnp != NULL && *fnp != NULL)
/* XXX never reached */
return 1;
}
-/*@=boundsread@*/
/**
* Copy header+payload, calculating digest(s) on the fly.
*/
-/*@-boundsread@*/
static int copyFile(FD_t *sfdp, const char **sfnp,
FD_t *tfdp, const char **tfnp)
- /*@globals rpmGlobalMacroContext, h_errno,
- fileSystem, internalState @*/
- /*@modifies *sfdp, *sfnp, *tfdp, *tfnp, rpmGlobalMacroContext,
- fileSystem, internalState @*/
{
unsigned char buf[BUFSIZ];
ssize_t count;
if (*tfdp) (void) manageFile(tfdp, NULL, 0, rc);
return rc;
}
-/*@=boundsread@*/
/**
* Retrieve signer fingerprint from an OpenPGP signature tag.
* @return 0 on success
*/
static int getSignid(Header sig, int sigtag, unsigned char * signid)
- /*@globals fileSystem, internalState @*/
- /*@modifies *signid, fileSystem, internalState @*/
{
void * pkt = NULL;
int_32 pkttyp = 0;
pgpDig dig = pgpNewDig();
if (!pgpPrtPkts(pkt, pktlen, dig, 0)) {
-/*@-bounds@*/
memcpy(signid, dig->signature.signid, sizeof(dig->signature.signid));
-/*@=bounds@*/
rc = 0;
}
* @param argv array of package file names (NULL terminated)
* @return 0 on success
*/
-static int rpmReSign(/*@unused@*/ rpmts ts,
+static int rpmReSign(rpmts ts,
QVA_t qva, const char ** argv)
- /*@globals rpmGlobalMacroContext, h_errno,
- fileSystem, internalState @*/
- /*@modifies rpmGlobalMacroContext,
- fileSystem, internalState @*/
{
FD_t fd = NULL;
FD_t ofd = NULL;
int xx;
tmprpm[0] = '\0';
- /*@-branchstate@*/
-/*@-boundsread@*/
if (argv)
while ((rpm = *argv++) != NULL)
-/*@=boundsread@*/
{
fprintf(stdout, "%s:\n", rpm);
if (manageFile(&fd, &rpm, O_RDONLY, 0))
goto exit;
-/*@-boundswrite@*/
memset(l, 0, sizeof(*l));
-/*@=boundswrite@*/
rc = readLead(fd, l);
if (rc != RPMRC_OK) {
rpmError(RPMERR_READLEAD, _("%s: not an rpm package\n"), rpm);
case 1:
rpmError(RPMERR_BADSIGTYPE, _("%s: Can't sign v1 packaging\n"), rpm);
goto exit;
- /*@notreached@*/ /*@switchbreak@*/ break;
+ break;
case 2:
rpmError(RPMERR_BADSIGTYPE, _("%s: Can't re-sign v2 packaging\n"), rpm);
goto exit;
- /*@notreached@*/ /*@switchbreak@*/ break;
+ break;
default:
- /*@switchbreak@*/ break;
+ break;
}
msg = NULL;
(msg && *msg ? msg : "\n"));
msg = _free(msg);
goto exit;
- /*@notreached@*/ /*@switchbreak@*/ break;
+ break;
case RPMRC_OK:
if (sigh == NULL) {
rpmError(RPMERR_SIGGEN, _("%s: No signature available\n"), rpm);
goto exit;
}
- /*@switchbreak@*/ break;
+ break;
}
msg = _free(msg);
switch (sigtag) {
case RPMSIGTAG_DSA:
xx = headerRemoveEntry(sigh, RPMSIGTAG_GPG);
- /*@switchbreak@*/ break;
+ break;
case RPMSIGTAG_RSA:
xx = headerRemoveEntry(sigh, RPMSIGTAG_PGP);
- /*@switchbreak@*/ break;
+ break;
case RPMSIGTAG_GPG:
xx = headerRemoveEntry(sigh, RPMSIGTAG_DSA);
- /*@fallthrough@*/
case RPMSIGTAG_PGP5:
case RPMSIGTAG_PGP:
xx = headerRemoveEntry(sigh, RPMSIGTAG_RSA);
- /*@switchbreak@*/ break;
+ break;
}
xx = headerRemoveEntry(sigh, sigtag);
goto exit;
/* Write the lead/signature of the output rpm */
-/*@-boundswrite@*/
strcpy(tmprpm, rpm);
strcat(tmprpm, ".XXXXXX");
-/*@=boundswrite@*/
(void) mktemp(tmprpm);
trpm = tmprpm;
xx = unlink(sigtarget);
sigtarget = _free(sigtarget);
}
- /*@=branchstate@*/
res = 0;
|| pubp->userid == NULL)
goto exit;
-/*@-boundswrite@*/
v = t = xmalloc(16+1);
t = stpcpy(t, pgpHexStr(pubp->signid, sizeof(pubp->signid)));
n = t = xmalloc(sizeof("gpg()")+8);
t = stpcpy( stpcpy( stpcpy(t, "gpg("), v+8), ")");
- /*@-nullpass@*/ /* FIX: pubp->userid may be NULL */
+ /* FIX: pubp->userid may be NULL */
u = t = xmalloc(sizeof("gpg()")+strlen(pubp->userid));
t = stpcpy( stpcpy( stpcpy(t, "gpg("), pubp->userid), ")");
- /*@=nullpass@*/
evr = t = xmalloc(sizeof("4X:-")+strlen(v)+strlen(r));
t = stpcpy(t, (pubp->version == 4 ? "4:" : "3:"));
t = stpcpy( stpcpy( stpcpy(t, v), "-"), r);
-/*@=boundswrite@*/
/* Check for pre-existing header. */
* @return 0 on success
*/
static int rpmcliImportPubkeys(const rpmts ts,
- /*@unused@*/ QVA_t qva,
- /*@null@*/ const char ** argv)
- /*@globals RPMVERSION, rpmGlobalMacroContext, h_errno,
- fileSystem, internalState @*/
- /*@modifies ts, rpmGlobalMacroContext,
- fileSystem, internalState @*/
+ QVA_t qva,
+ const char ** argv)
{
const char * fn;
const unsigned char * pkt = NULL;
if (argv == NULL) return res;
- /*@-branchstate@*/
-/*@-boundsread@*/
while ((fn = *argv++) != NULL) {
-/*@=boundsread@*/
rpmtsClean(ts);
pkt = _free(pkt);
}
}
- /*@=branchstate@*/
rpmtsClean(ts);
pkt = _free(pkt);
return res;
}
-/*@unchecked@*/
static unsigned char header_magic[8] = {
0x8e, 0xad, 0xe8, 0x01, 0x00, 0x00, 0x00, 0x00
};
* @todo If the GPG key was known available, the md5 digest could be skipped.
*/
static int readFile(FD_t fd, const char * fn, pgpDig dig)
- /*@globals fileSystem, internalState @*/
- /*@modifies fd, *dig, fileSystem, internalState @*/
{
unsigned char buf[4*BUFSIZ];
ssize_t count;
assert(dig->md5ctx == NULL);
dig->md5ctx = fddig->hashctx;
fddig->hashctx = NULL;
- /*@switchbreak@*/ break;
+ break;
case PGPHASHALGO_SHA1:
#if HAVE_BEECRYPT_API_H
case PGPHASHALGO_SHA256:
assert(dig->sha1ctx == NULL);
dig->sha1ctx = fddig->hashctx;
fddig->hashctx = NULL;
- /*@switchbreak@*/ break;
+ break;
default:
- /*@switchbreak@*/ break;
+ break;
}
}
int nosignatures = !(qva->qva_flags & VERIFY_SIGNATURE);
{
-/*@-boundswrite@*/
memset(l, 0, sizeof(*l));
-/*@=boundswrite@*/
rc = readLead(fd, l);
if (rc != RPMRC_OK) {
rpmError(RPMERR_READLEAD, _("%s: not an rpm package\n"), fn);
rpmError(RPMERR_BADSIGTYPE, _("%s: No signature available (v1.0 RPM)\n"), fn);
res++;
goto exit;
- /*@notreached@*/ /*@switchbreak@*/ break;
+ break;
default:
- /*@switchbreak@*/ break;
+ break;
}
msg = NULL;
msg = _free(msg);
res++;
goto exit;
- /*@notreached@*/ /*@switchbreak@*/ break;
+ break;
case RPMRC_OK:
if (sigh == NULL) {
rpmError(RPMERR_SIGGEN, _("%s: No signature available\n"), fn);
res++;
goto exit;
}
- /*@switchbreak@*/ break;
+ break;
}
msg = _free(msg);
res++;
goto exit;
}
- /*@switchbreak@*/ break;
+ break;
case RPMSIGTAG_SHA1:
if (nodigests)
continue;
/* XXX Don't bother with header sha1 if header dsa. */
if (!nosignatures && sigtag == RPMSIGTAG_DSA)
continue;
- /*@switchbreak@*/ break;
+ break;
case RPMSIGTAG_LEMD5_2:
case RPMSIGTAG_LEMD5_1:
case RPMSIGTAG_MD5:
*/
if (!nosignatures && sigtag == RPMSIGTAG_PGP)
continue;
- /*@switchbreak@*/ break;
+ break;
default:
continue;
- /*@notreached@*/ /*@switchbreak@*/ break;
+ break;
}
res3 = rpmVerifySignature(ts, result);
-/*@-bounds@*/
if (res3) {
if (rpmIsVerbose()) {
b = stpcpy(b, " ");
case RPMSIGTAG_SIZE:
b = stpcpy(b, "SIZE ");
res2 = 1;
- /*@switchbreak@*/ break;
+ break;
case RPMSIGTAG_SHA1:
b = stpcpy(b, "SHA1 ");
res2 = 1;
- /*@switchbreak@*/ break;
+ break;
case RPMSIGTAG_LEMD5_2:
case RPMSIGTAG_LEMD5_1:
case RPMSIGTAG_MD5:
b = stpcpy(b, "MD5 ");
res2 = 1;
- /*@switchbreak@*/ break;
+ break;
case RPMSIGTAG_RSA:
b = stpcpy(b, "RSA ");
res2 = 1;
- /*@switchbreak@*/ break;
+ break;
case RPMSIGTAG_PGP5: /* XXX legacy */
case RPMSIGTAG_PGP:
switch (res3) {
case RPMRC_NOKEY:
res2 = 1;
- /*@fallthrough@*/
case RPMRC_NOTTRUSTED:
{ int offset = 6;
b = stpcpy(b, "(MD5) (PGP) ");
*u = '\0';
}
}
- } /*@innerbreak@*/ break;
+ } break;
default:
b = stpcpy(b, "MD5 PGP ");
res2 = 1;
- /*@innerbreak@*/ break;
+ break;
}
- /*@switchbreak@*/ break;
+ break;
case RPMSIGTAG_DSA:
b = stpcpy(b, "(SHA1) DSA ");
res2 = 1;
- /*@switchbreak@*/ break;
+ break;
case RPMSIGTAG_GPG:
/* Do not consider this a failure */
switch (res3) {
*m = '\0';
}
res2 = 1;
- /*@innerbreak@*/ break;
+ break;
default:
b = stpcpy(b, "GPG ");
res2 = 1;
- /*@innerbreak@*/ break;
+ break;
}
- /*@switchbreak@*/ break;
+ break;
default:
b = stpcpy(b, "?UnknownSignatureType? ");
res2 = 1;
- /*@switchbreak@*/ break;
+ break;
}
}
} else {
switch (sigtag) {
case RPMSIGTAG_SIZE:
b = stpcpy(b, "size ");
- /*@switchbreak@*/ break;
+ break;
case RPMSIGTAG_SHA1:
b = stpcpy(b, "sha1 ");
- /*@switchbreak@*/ break;
+ break;
case RPMSIGTAG_LEMD5_2:
case RPMSIGTAG_LEMD5_1:
case RPMSIGTAG_MD5:
b = stpcpy(b, "md5 ");
- /*@switchbreak@*/ break;
+ break;
case RPMSIGTAG_RSA:
b = stpcpy(b, "rsa ");
- /*@switchbreak@*/ break;
+ break;
case RPMSIGTAG_PGP5: /* XXX legacy */
case RPMSIGTAG_PGP:
b = stpcpy(b, "(md5) pgp ");
- /*@switchbreak@*/ break;
+ break;
case RPMSIGTAG_DSA:
b = stpcpy(b, "(sha1) dsa ");
- /*@switchbreak@*/ break;
+ break;
case RPMSIGTAG_GPG:
b = stpcpy(b, "gpg ");
- /*@switchbreak@*/ break;
+ break;
default:
b = stpcpy(b, "??? ");
- /*@switchbreak@*/ break;
+ break;
}
}
}
-/*@=bounds@*/
}
hi = headerFreeIterator(hi);
break;
case RPMSIGN_IMPORT_PUBKEY:
return rpmcliImportPubkeys(ts, qva, argv);
- /*@notreached@*/ break;
+ break;
case RPMSIGN_NEW_SIGNATURE:
case RPMSIGN_ADD_SIGNATURE:
case RPMSIGN_DEL_SIGNATURE:
return rpmReSign(ts, qva, argv);
- /*@notreached@*/ break;
+ break;
case RPMSIGN_NONE:
default:
return -1;
- /*@notreached@*/ break;
+ break;
}
while ((arg = *argv++) != NULL) {
/** \ingroup rpmcli
* Should version 3 packages be produced?
*/
-/*@-redecl@*/
-/*@unchecked@*/
extern int _noDirTokens;
-/*@=redecl@*/
#ifdef __cplusplus
extern "C" {
/** \ingroup rpmcli
* Popt option table for options shared by all modes and executables.
*/
-/*@unchecked@*/
extern struct poptOption rpmcliAllPoptTable[];
-/*@unchecked@*/
extern int ftsOpts;
-/*@unchecked@*/
extern struct poptOption rpmcliFtsPoptTable[];
-/*@unchecked@*/ /*@observer@*/ /*@null@*/
extern const char * rpmcliPipeOutput;
-/*@unchecked@*/ /*@observer@*/ /*@null@*/
extern const char * rpmcliRcfile;
-/*@unchecked@*/ /*@observer@*/ /*@null@*/
extern const char * rpmcliRootDir;
/**
* @param optionsTable popt option table
* @return popt context (or NULL)
*/
-/*@null@*/
poptContext
-rpmcliInit(int argc, char *const argv[], struct poptOption * optionsTable)
- /*@globals rpmCLIMacroContext, rpmGlobalMacroContext, h_errno, stderr,
- fileSystem, internalState @*/
- /*@modifies rpmCLIMacroContext, rpmGlobalMacroContext, stderr,
- fileSystem, internalState @*/;
+rpmcliInit(int argc, char *const argv[], struct poptOption * optionsTable);
/**
* Make sure that rpm configuration has been read.
* @warning Options like --rcfile and --verbose must precede callers option.
*/
-/*@mayexit@*/
-void rpmcliConfigured(void)
- /*@globals rpmCLIMacroContext, rpmGlobalMacroContext, h_errno,
- fileSystem, internalState @*/
- /*@modifies rpmCLIMacroContext, rpmGlobalMacroContext,
- fileSystem, internalState @*/;
+void rpmcliConfigured(void);
/**
* Destroy most everything needed by an rpm CLI executable context.
* @return NULL always
*/
poptContext
-rpmcliFini(/*@only@*/ /*@null@*/ poptContext optCon)
- /*@modifies optCon @*/;
+rpmcliFini(poptContext optCon);
/**
* Common/global popt tokens used for command line option tables.
/* ==================================================================== */
/** \name RPMQV */
-/*@{*/
/** \ingroup rpmcli
* Query/Verify argument qualifiers.
* @todo Merge rpmQueryFlags, rpmVerifyFlags, and rpmVerifyAttrs?.
*/
typedef enum rpmQueryFlags_e {
-/*@-enummemuse@*/
QUERY_FOR_DEFAULT = 0, /*!< */
QUERY_MD5 = (1 << 0), /*!< from --nomd5 */
QUERY_SIZE = (1 << 1), /*!< from --nosize */
QUERY_SIGNATURE = (1 << 20), /*!< verify: from --nosignature */
QUERY_PATCHES = (1 << 21), /*!< verify: from --nopatches */
QUERY_HDRCHK = (1 << 22), /*!< verify: from --nohdrchk */
-/*@=enummemuse@*/
QUERY_FOR_LIST = (1 << 23), /*!< query: from --list */
QUERY_FOR_STATE = (1 << 24), /*!< query: from --state */
QUERY_FOR_DOCS = (1 << 25), /*!< query: from --docfiles */
/** \ingroup rpmcli
* Bit(s) from common command line options.
*/
-/*@unchecked@*/
extern rpmQueryFlags rpmcliQueryFlags;
/** \ingroup rpmcli
* @todo Merge rpmQueryFlags, rpmVerifyFlags, and rpmVerifyAttrs values?.
*/
typedef enum rpmVerifyFlags_e {
-/*@-enummemuse@*/
VERIFY_DEFAULT = 0, /*!< */
-/*@=enummemuse@*/
VERIFY_MD5 = (1 << 0), /*!< from --nomd5 */
VERIFY_SIZE = (1 << 1), /*!< from --nosize */
VERIFY_LINKTO = (1 << 2), /*!< from --nolinkto */
VERIFY_SIGNATURE = (1 << 20), /*!< verify: from --nosignature */
VERIFY_PATCHES = (1 << 21), /*!< verify: from --nopatches */
VERIFY_HDRCHK = (1 << 22), /*!< verify: from --nohdrchk */
-/*@-enummemuse@*/
VERIFY_FOR_LIST = (1 << 23), /*!< query: from --list */
VERIFY_FOR_STATE = (1 << 24), /*!< query: from --state */
VERIFY_FOR_DOCS = (1 << 25), /*!< query: from --docfiles */
VERIFY_FOR_CONFIG = (1 << 26), /*!< query: from --configfiles */
VERIFY_FOR_DUMPFILES= (1 << 27) /*!< query: from --dump */
-/*@=enummemuse@*/
/* bits 28-31 used in rpmVerifyAttrs */
} rpmVerifyFlags;
* @param h header to use for query/verify
* @return 0 on success
*/
-typedef int (*QVF_t) (QVA_t qva, rpmts ts, Header h)
- /*@globals fileSystem @*/
- /*@modifies qva, ts, fileSystem @*/;
+typedef int (*QVF_t) (QVA_t qva, rpmts ts, Header h);
/** \ingroup rpmcli
* Function to query spec file.
* @param arg query argument
* @return 0 on success
*/
-typedef int (*QSpecF_t) (rpmts ts, QVA_t qva, const char * arg)
- /*@globals rpmGlobalMacroContext, h_errno,
- fileSystem, internalState @*/
- /*@modifies ts, qva, rpmGlobalMacroContext,
- fileSystem, internalState @*/;
+typedef int (*QSpecF_t) (rpmts ts, QVA_t qva, const char * arg);
/** \ingroup rpmcli
* Describe query/verify/signature command line operation.
int qva_sourceCount;/*!< Exclusive option check (>1 is error). */
rpmQueryFlags qva_flags; /*!< Bit(s) to control operation. */
rpmfileAttrs qva_fflags; /*!< Bit(s) to filter on attribute. */
-/*@only@*/ /*@null@*/
rpmdbMatchIterator qva_mi; /*!< Match iterator on selected headers. */
-/*@refccounted@*/ /*@relnull@*/
rpmgi qva_gi; /*!< Generalized iterator on args. */
rpmRC qva_rc; /*!< Current return code. */
-/*@null@*/
QVF_t qva_showPackage; /*!< Function to display iterator matches. */
-/*@null@*/
QSpecF_t qva_specQuery; /*!< Function to query spec file. */
-/*@unused@*/
int qva_verbose; /*!< (unused) */
-/*@only@*/ /*@null@*/
const char * qva_queryFormat;/*!< Format for headerSprintf(). */
int sign; /*!< Is a passphrase needed? */
-/*@observer@*/
const char * passPhrase; /*!< Pass phrase. */
-/*@observer@*/ /*@null@*/
const char * qva_prefix; /*!< Path to top of install tree. */
char qva_mode;
/*!<
/** \ingroup rpmcli
*/
-/*@unchecked@*/
extern struct rpmQVKArguments_s rpmQVKArgs;
/** \ingroup rpmcli
*/
-/*@unchecked@*/
extern struct poptOption rpmQVSourcePoptTable[];
/** \ingroup rpmcli
*/
-/*@unchecked@*/
extern int specedit;
/** \ingroup rpmcli
*/
-/*@unchecked@*/
extern struct poptOption rpmQueryPoptTable[];
/** \ingroup rpmcli
*/
-/*@unchecked@*/
extern struct poptOption rpmVerifyPoptTable[];
/** \ingroup rpmcli
* @param ts transaction set
* @return result of last non-zero showPackage() return
*/
-int rpmcliShowMatches(QVA_t qva, rpmts ts)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies qva, rpmGlobalMacroContext, fileSystem, internalState @*/;
+int rpmcliShowMatches(QVA_t qva, rpmts ts);
/** \ingroup rpmcli
* Display list of tags that can be used in --queryformat.
* @param fp file handle to use for display
*/
-void rpmDisplayQueryTags(FILE * fp)
- /*@globals fileSystem @*/
- /*@modifies *fp, fileSystem @*/;
+void rpmDisplayQueryTags(FILE * fp);
/** \ingroup rpmcli
* Common query/verify source interface, called once for each CLI arg.
* @param arg name of source to query/verify
* @return showPackage() result, 1 if rpmdbInitIterator() is NULL
*/
-int rpmQueryVerify(QVA_t qva, rpmts ts, const char * arg)
- /*@globals rpmGlobalMacroContext, h_errno,
- fileSystem, internalState @*/
- /*@modifies qva, ts, rpmGlobalMacroContext,
- fileSystem, internalState @*/;
+int rpmQueryVerify(QVA_t qva, rpmts ts, const char * arg);
/** \ingroup rpmcli
* Display results of package query.
* @param h header to use for query
* @return 0 always
*/
-int showQueryPackage(QVA_t qva, rpmts ts, Header h)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies ts, h, rpmGlobalMacroContext, fileSystem, internalState @*/;
+int showQueryPackage(QVA_t qva, rpmts ts, Header h);
/** \ingroup rpmcli
* Iterate over query/verify arg list.
* @param argv query argument(s) (or NULL)
* @return 0 on success, else no. of failures
*/
-int rpmcliArgIter(rpmts ts, QVA_t qva, /*@null@*/ ARGV_t argv)
- /*@globals ftsOpts, rpmGlobalMacroContext, h_errno,
- fileSystem, internalState @*/
- /*@modifies ts, qva, ftsOpts, rpmGlobalMacroContext,
- fileSystem, internalState @*/;
+int rpmcliArgIter(rpmts ts, QVA_t qva, ARGV_t argv);
/** \ingroup rpmcli
* Display package information.
* @param argv query argument(s) (or NULL)
* @return 0 on success, else no. of failures
*/
-int rpmcliQuery(rpmts ts, QVA_t qva, /*@null@*/ const char ** argv)
- /*@globals rpmGlobalMacroContext, h_errno,
- fileSystem, internalState @*/
- /*@modifies ts, qva, rpmGlobalMacroContext,
- fileSystem, internalState @*/;
+int rpmcliQuery(rpmts ts, QVA_t qva, const char ** argv);
/** \ingroup rpmcli
* Verify file attributes (including MD5 sum).
* @param omitMask bit(s) to disable verify checks
* @return 0 on success (or not installed), 1 on error
*/
-/*@-incondefs@*/
int rpmVerifyFile(const rpmts ts, rpmfi fi,
- /*@out@*/ rpmVerifyAttrs * res, rpmVerifyAttrs omitMask)
- /*@globals h_errno, fileSystem, internalState @*/
- /*@modifies ts, fi, *res, fileSystem, internalState @*/
- /*@requires maxSet(res) >= 0 @*/;
-/*@=incondefs@*/
+ rpmVerifyAttrs * res, rpmVerifyAttrs omitMask);
/** \ingroup rpmcli
* Display results of package verify.
* @param h header to use for verify
* @return result of last non-zero verify return
*/
-int showVerifyPackage(QVA_t qva, rpmts ts, Header h)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies ts, h, rpmGlobalMacroContext, fileSystem, internalState @*/;
+int showVerifyPackage(QVA_t qva, rpmts ts, Header h);
/**
* Check package and header signatures.
* @param fn package file name
* @return 0 on success, 1 on failure
*/
-int rpmVerifySignatures(QVA_t qva, rpmts ts, FD_t fd, const char * fn)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies qva, ts, fd, rpmGlobalMacroContext, h_errno,
- fileSystem, internalState @*/;
+int rpmVerifySignatures(QVA_t qva, rpmts ts, FD_t fd, const char * fn);
/** \ingroup rpmcli
* Verify package install.
* @param argv verify argument(s) (or NULL)
* @return 0 on success, else no. of failures
*/
-int rpmcliVerify(rpmts ts, QVA_t qva, /*@null@*/ const char ** argv)
- /*@globals rpmGlobalMacroContext, h_errno,
- fileSystem, internalState @*/
- /*@modifies ts, qva, rpmGlobalMacroContext,
- fileSystem, internalState @*/;
+int rpmcliVerify(rpmts ts, QVA_t qva, const char ** argv);
-/*@}*/
/* ==================================================================== */
/** \name RPMBT */
-/*@{*/
/** \ingroup rpmcli
* Describe build command line request.
struct rpmBuildArguments_s {
rpmQueryFlags qva_flags; /*!< Bit(s) to control verification. */
int buildAmount; /*!< Bit(s) to control operation. */
-/*@null@*/
const char * buildRootOverride; /*!< from --buildroot */
-/*@null@*/
char * targets; /*!< Target platform(s), comma separated. */
-/*@observer@*/
const char * passPhrase; /*!< Pass phrase. */
-/*@only@*/ /*@null@*/
const char * cookie; /*!< NULL for binary, ??? for source, rpm's */
int force; /*!< from --force */
int noBuild; /*!< from --nobuild */
int useCatalog; /*!< from --usecatalog */
char buildMode; /*!< Build mode (one of "btBC") */
char buildChar; /*!< Build stage (one of "abcilps ") */
-/*@observer@*/ /*@null@*/
const char * rootdir;
};
/** \ingroup rpmcli
*/
-/*@unchecked@*/
extern struct rpmBuildArguments_s rpmBTArgs;
/** \ingroup rpmcli
*/
-/*@unchecked@*/
extern struct poptOption rpmBuildPoptTable[];
-/*@}*/
/* ==================================================================== */
/** \name RPMEIU */
-/*@{*/
/* --- install/upgrade/erase modes */
-/*@unchecked@*/
extern int rpmcliPackagesTotal;
-/*@unchecked@*/
extern int rpmcliHashesCurrent;
-/*@unchecked@*/
extern int rpmcliHashesTotal;
-/*@unchecked@*/
extern int rpmcliProgressCurrent;
-/*@unchecked@*/
extern int rpmcliProgressTotal;
/** \ingroup rpmcli
* @param data private data (e.g. rpmInstallInterfaceFlags)
* @return per-callback data (e.g. an opened FD_t)
*/
-/*@null@*/
-void * rpmShowProgress(/*@null@*/ const void * arg,
+void * rpmShowProgress(const void * arg,
const rpmCallbackType what,
const unsigned long amount,
const unsigned long total,
- /*@null@*/ fnpyKey key,
- /*@null@*/ void * data)
- /*@globals rpmcliHashesCurrent,
- rpmcliProgressCurrent, rpmcliProgressTotal,
- h_errno, fileSystem, internalState @*/
- /*@modifies rpmcliHashesCurrent,
- rpmcliProgressCurrent, rpmcliProgressTotal,
- fileSystem, internalState @*/;
+ fnpyKey key,
+ void * data);
/** \ingroup rpmcli
* Install source rpm package.
* @return 0 on success
*/
int rpmInstallSource(rpmts ts, const char * arg,
- /*@null@*/ /*@out@*/ const char ** specFilePtr,
- /*@null@*/ /*@out@*/ const char ** cookie)
- /*@globals rpmGlobalMacroContext, h_errno,
- fileSystem, internalState@*/
- /*@modifies ts, *specFilePtr, *cookie, rpmGlobalMacroContext,
- fileSystem, internalState @*/;
+ const char ** specFilePtr,
+ const char ** cookie);
/** \ingroup rpmcli
* Describe database command line requests.
int numRelocations;
int noDeps;
int incldocs;
-/*@owned@*/ /*@null@*/
rpmRelocation * relocations;
-/*@null@*/
const char * prefix;
-/*@observer@*/ /*@null@*/
const char * rootdir;
};
* @return 0 on success
*/
int rpmInstall(rpmts ts, struct rpmInstallArguments_s * ia,
- /*@null@*/ const char ** fileArgv)
- /*@globals rpmcliPackagesTotal, rpmGlobalMacroContext, h_errno,
- fileSystem, internalState@*/
- /*@modifies ts, ia, rpmcliPackagesTotal, rpmGlobalMacroContext,
- fileSystem, internalState @*/;
+ const char ** fileArgv);
/** \ingroup rpmcli
* Erase binary rpm package.
*/
int rpmErase(rpmts ts, struct rpmInstallArguments_s * ia,
- /*@null@*/ const char ** argv)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies ts, ia, rpmGlobalMacroContext,
- fileSystem, internalState @*/;
+ const char ** argv);
/** \ingroup rpmcli
* Rollback transactions, erasing new, reinstalling old, package(s).
* @return 0 on success
*/
int rpmRollback(rpmts ts, struct rpmInstallArguments_s * ia,
- /*@null@*/ const char ** argv)
- /*@globals rpmcliPackagesTotal, rpmGlobalMacroContext, h_errno,
- fileSystem, internalState @*/
- /*@modifies ts, ia, rpmcliPackagesTotal, rpmGlobalMacroContext,
- fileSystem, internalState @*/;
+ const char ** argv);
/** \ingroup rpmcli
*/
-/*@unchecked@*/
extern struct rpmInstallArguments_s rpmIArgs;
/** \ingroup rpmcli
*/
-/*@unchecked@*/
extern struct poptOption rpmInstallPoptTable[];
-/*@}*/
/* ==================================================================== */
/** \name RPMDB */
-/*@{*/
/* --- database modes */
/** \ingroup rpmcli
/** \ingroup rpmcli
*/
-/*@unchecked@*/
extern struct rpmDatabaseArguments_s rpmDBArgs;
/** \ingroup rpmcli
*/
-/*@unchecked@*/
extern struct poptOption rpmDatabasePoptTable[];
-/*@}*/
/* ==================================================================== */
/** \name RPMK */
-/*@{*/
/** \ingroup rpmcli
* Import public key packet(s).
* @return RPMRC_OK/RPMRC_FAIL
*/
rpmRC rpmcliImportPubkey(const rpmts ts,
- const unsigned char * pkt, ssize_t pktlen)
- /*@globals RPMVERSION, rpmGlobalMacroContext, h_errno,
- fileSystem, internalState @*/
- /*@modifies ts, rpmGlobalMacroContext,
- fileSystem, internalState @*/;
+ const unsigned char * pkt, ssize_t pktlen);
/** \ingroup rpmcli
* Bit(s) to control rpmReSign() operation.
*/
-/*@-typeuse@*/
typedef enum rpmSignFlags_e {
RPMSIGN_NONE = 0,
RPMSIGN_CHK_SIGNATURE = 'K', /*!< from --checksig */
RPMSIGN_DEL_SIGNATURE = 'D', /*!< from --delsign */
RPMSIGN_IMPORT_PUBKEY = 'I', /*!< from --import */
} rpmSignFlags;
-/*@=typeuse@*/
/** \ingroup rpmcli
*/
-/*@unchecked@*/
extern struct poptOption rpmSignPoptTable[];
/** \ingroup rpmcli
* @param argv array of arguments (NULL terminated)
* @return 0 on success
*/
-int rpmcliSign(rpmts ts, QVA_t qva, /*@null@*/ const char ** argv)
- /*@globals RPMVERSION, rpmGlobalMacroContext, h_errno,
- fileSystem, internalState @*/
- /*@modifies ts, qva, rpmGlobalMacroContext,
- fileSystem, internalState @*/;
-
-/*@}*/
+int rpmcliSign(rpmts ts, QVA_t qva, const char ** argv);
#ifdef __cplusplus
}
/**
* Enable noisy range comparison debugging message?
*/
-/*@unchecked@*/
static int _noisy_range_comparison_debug_message = 0;
-/*@unchecked@*/
int _rpmds_debug = 0;
-/*@unchecked@*/
int _rpmds_nopromote = 1;
-/*@unchecked@*/
-/*@-exportheadervar@*/
int _rpmds_unspecified_epoch_noise = 0;
-/*@=exportheadervar@*/
rpmds XrpmdsUnlink(rpmds ds, const char * msg, const char * fn, unsigned ln)
{
if (ds == NULL) return NULL;
-/*@-modfilesys@*/
if (_rpmds_debug && msg != NULL)
fprintf(stderr, "--> ds %p -- %d %s at %s:%u\n", ds, ds->nrefs, msg, fn, ln);
-/*@=modfilesys@*/
ds->nrefs--;
return NULL;
}
if (ds == NULL) return NULL;
ds->nrefs++;
-/*@-modfilesys@*/
if (_rpmds_debug && msg != NULL)
fprintf(stderr, "--> ds %p ++ %d %s at %s:%u\n", ds, ds->nrefs, msg, fn, ln);
-/*@=modfilesys@*/
- /*@-refcounttrans@*/ return ds; /*@=refcounttrans@*/
+ return ds;
}
rpmds rpmdsFree(rpmds ds)
if (ds->nrefs > 1)
return rpmdsUnlink(ds, ds->Type);
-/*@-modfilesys@*/
if (_rpmds_debug < 0)
fprintf(stderr, "*** ds %p\t%s[%d]\n", ds, ds->Type, ds->Count);
-/*@=modfilesys@*/
if (ds->tagN == RPMTAG_PROVIDENAME) {
tagEVR = RPMTAG_PROVIDEVERSION;
} else
return NULL;
- /*@-branchstate@*/
if (ds->Count > 0) {
ds->N = hfd(ds->N, ds->Nt);
ds->EVR = hfd(ds->EVR, ds->EVRt);
- /*@-evalorder@*/
ds->Flags = (ds->h != NULL ? hfd(ds->Flags, ds->Ft) : _free(ds->Flags));
- /*@=evalorder@*/
ds->h = headerFree(ds->h);
}
- /*@=branchstate@*/
ds->DNEVR = _free(ds->DNEVR);
ds->Color = _free(ds->Color);
ds->Refs = _free(ds->Refs);
(void) rpmdsUnlink(ds, ds->Type);
- /*@-refcounttrans -usereleased@*/
-/*@-boundswrite@*/
memset(ds, 0, sizeof(*ds)); /* XXX trash and burn */
-/*@=boundswrite@*/
ds = _free(ds);
- /*@=refcounttrans =usereleased@*/
return NULL;
}
-/*@unchecked@*/ /*@observer@*/
static const char * beehiveToken = "redhatbuilddependency";
/**
* @returns 0 == false, 1 == true
*/
static int archFilter(const char * arch)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/
{
static int oneshot = 0;
int negate = 0; /* assume no negation. */
rc = (!strcmp(arch, myarch) ? 0 : 1);
else
rc = (!strcmp(arch, myarch) ? 1 : 0);
-/*@-modfilesys@*/
if (_rpmds_debug < 0)
fprintf(stderr, "=== strcmp(\"%s\", \"%s\") negate %d rc %d\n", arch, myarch, negate, rc);
-/*@=modfilesys@*/
}
} else {
int archScore = rpmMachineScore(RPM_MACHTABLE_INSTARCH, arch);
rc = (archScore > 0 ? 0 : 1);
else
rc = (archScore > 0 ? 1 : 0);
-/*@-modfilesys@*/
if (_rpmds_debug < 0)
fprintf(stderr, "=== archScore(\"%s\") %d negate %d rc %d\n", arch, archScore, negate, rc);
-/*@=modfilesys@*/
}
return rc;
}
* @param token namespace string
* @returns filtered dependency set
*/
-/*@null@*/
-static rpmds rpmdsFilter(/*@null@*/ /*@returned@*/ rpmds ds,
- /*@null@*/ const char * token)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies ds, rpmGlobalMacroContext, fileSystem, internalState @*/
+static rpmds rpmdsFilter(rpmds ds,
+ const char * token)
{
size_t toklen;
rpmds fds;
continue;
if (*(fe = N + len - 1) != ')')
continue;
-/*@-modfilesys@*/
if (_rpmds_debug < 0)
fprintf(stderr, "*** f \"%s\"\n", f);
-/*@=modfilesys@*/
g = f + 1;
state = 0;
gN = NULL;
nb = sizeof(buf) - 1;
(void) strncpy(buf, g, nb);
buf[nb] = '\0';
-/*@-branchstate@*/
switch (state) {
case 0: /* g is unwrapped N */
gN = xstrdup(buf);
- /*@switchbreak@*/ break;
+ break;
default: /* g is next arch score token. */
/* arch score tokens are compared assuming || */
if (archFilter(buf))
ignore = 0;
- /*@switchbreak@*/ break;
+ break;
}
-/*@=branchstate@*/
state++;
}
if (ignore) {
int Count = rpmdsCount(fds);
-/*@-modfilesys@*/
if (_rpmds_debug < 0)
fprintf(stderr, "*** deleting N[%d:%d] = \"%s\"\n", i, Count, N);
-/*@=modfilesys@*/
if (i < (Count - 1)) {
memmove((fds->N + i), (fds->N + i + 1), (Count - (i+1)) * sizeof(*fds->N));
if (fds->EVR != NULL)
}
fds->Count--;
} else if (gN != NULL) {
-/*@-modobserver -observertrans@*/
char * t = (char *) N;
(void) strcpy(t, gN);
-/*@=modobserver =observertrans@*/
-/*@-modfilesys@*/
if (_rpmds_debug < 0)
fprintf(stderr, "*** unwrapping N[%d] = \"%s\"\n", i, N);
-/*@=modfilesys@*/
}
gN = _free(gN);
}
fds = rpmdsFree(fds);
exit:
- /*@-refcounttrans@*/
return ds;
- /*@=refcounttrans@*/
}
rpmds rpmdsNew(Header h, rpmTag tagN, int flags)
} else
goto exit;
- /*@-branchstate@*/
if (hge(h, tagN, &Nt, (void **) &N, &Count)
&& N != NULL && Count > 0)
{
xx = hge(h, tagEVR, &ds->EVRt, (void **) &ds->EVR, NULL);
xx = hge(h, tagF, &ds->Ft, (void **) &ds->Flags, NULL);
-/*@-boundsread@*/
if (!scareMem && ds->Flags != NULL)
ds->Flags = memcpy(xmalloc(ds->Count * sizeof(*ds->Flags)),
ds->Flags, ds->Count * sizeof(*ds->Flags));
xx = hge(h, tagBT, &BTt, (void **) &BTp, NULL);
ds->BT = (xx && BTp != NULL && BTt == RPM_INT32_TYPE ? *BTp : 0);
-/*@=boundsread@*/
ds->Color = xcalloc(Count, sizeof(*ds->Color));
ds->Refs = xcalloc(Count, sizeof(*ds->Refs));
-/*@-modfilesys@*/
if (_rpmds_debug < 0)
fprintf(stderr, "*** ds %p\t%s[%d]\n", ds, ds->Type, ds->Count);
-/*@=modfilesys@*/
}
- /*@=branchstate@*/
exit:
- /*@-nullstate@*/ /* FIX: ds->Flags may be NULL */
+ /* FIX: ds->Flags may be NULL */
ds = rpmdsLink(ds, (ds ? ds->Type : NULL));
- /*@=nullstate@*/
if (!nofilter)
ds = rpmdsFilter(ds, beehiveToken);
nb = 0;
if (dspfx) nb += strlen(dspfx) + 1;
-/*@-boundsread@*/
if (ds->N[ds->i]) nb += strlen(ds->N[ds->i]);
/* XXX rpm prior to 3.0.2 did not always supply EVR and Flags. */
if (ds->Flags != NULL && (ds->Flags[ds->i] & RPMSENSE_SENSEMASK)) {
if (nb) nb++;
nb += strlen(ds->EVR[ds->i]);
}
-/*@=boundsread@*/
-/*@-boundswrite@*/
t = tbuf = xmalloc(nb + 1);
if (dspfx) {
t = stpcpy(t, dspfx);
t = stpcpy(t, ds->EVR[ds->i]);
}
*t = '\0';
-/*@=boundswrite@*/
return tbuf;
}
xx = hge(h, RPMTAG_EPOCH, NULL, (void **)&ep, NULL);
t = xmalloc(sizeof(*N) + strlen(n) + 1);
-/*@-boundswrite@*/
N = (const char **) t;
t += sizeof(*N);
*t = '\0';
t += strlen(t);
}
t = stpcpy( stpcpy( stpcpy( t, v), "-"), r);
-/*@=boundswrite@*/
ds = xcalloc(1, sizeof(*ds));
ds->h = NULL;
ds->Nt = -1; /* XXX to insure that hfd will free */
ds->EVR = EVR;
ds->EVRt = -1; /* XXX to insure that hfd will free */
-/*@-boundswrite@*/
ds->Flags = xmalloc(sizeof(*ds->Flags)); ds->Flags[0] = Flags;
-/*@=boundswrite@*/
ds->i = 0;
{ char pre[2];
-/*@-boundsread@*/
pre[0] = ds->Type[0];
-/*@=boundsread@*/
pre[1] = '\0';
- /*@-nullstate@*/ /* LCL: ds->Type may be NULL ??? */
+ /* LCL: ds->Type may be NULL ??? */
ds->DNEVR = rpmdsNewDNEVR(pre, ds);
- /*@=nullstate@*/
}
exit:
ds->BT = now;
}
ds->Count = 1;
- /*@-assignexpose@*/
-/*@-boundswrite@*/
ds->N = xmalloc(sizeof(*ds->N)); ds->N[0] = N;
ds->Nt = -1; /* XXX to insure that hfd will free */
ds->EVR = xmalloc(sizeof(*ds->EVR)); ds->EVR[0] = EVR;
ds->EVRt = -1; /* XXX to insure that hfd will free */
- /*@=assignexpose@*/
ds->Flags = xmalloc(sizeof(*ds->Flags)); ds->Flags[0] = Flags;
-/*@=boundswrite@*/
ds->i = 0;
{ char t[2];
-/*@-boundsread@*/
t[0] = ds->Type[0];
-/*@=boundsread@*/
t[1] = '\0';
ds->DNEVR = rpmdsNewDNEVR(t, ds);
}
const char * DNEVR = NULL;
if (ds != NULL && ds->i >= 0 && ds->i < ds->Count) {
-/*@-boundsread@*/
if (ds->DNEVR != NULL)
DNEVR = ds->DNEVR;
-/*@=boundsread@*/
}
return DNEVR;
}
const char * N = NULL;
if (ds != NULL && ds->i >= 0 && ds->i < ds->Count) {
-/*@-boundsread@*/
if (ds->N != NULL)
N = ds->N[ds->i];
-/*@=boundsread@*/
}
return N;
}
const char * EVR = NULL;
if (ds != NULL && ds->i >= 0 && ds->i < ds->Count) {
-/*@-boundsread@*/
if (ds->EVR != NULL)
EVR = ds->EVR[ds->i];
-/*@=boundsread@*/
}
return EVR;
}
int_32 Flags = 0;
if (ds != NULL && ds->i >= 0 && ds->i < ds->Count) {
-/*@-boundsread@*/
if (ds->Flags != NULL)
Flags = ds->Flags[ds->i];
-/*@=boundsread@*/
}
return Flags;
}
uint_32 Color = 0;
if (ds != NULL && ds->i >= 0 && ds->i < ds->Count) {
-/*@-boundsread@*/
if (ds->Color != NULL)
Color = ds->Color[ds->i];
-/*@=boundsread@*/
}
return Color;
}
uint_32 ocolor = 0;
if (ds != NULL && ds->i >= 0 && ds->i < ds->Count) {
-/*@-bounds@*/
if (ds->Color != NULL) {
ocolor = ds->Color[ds->i];
ds->Color[ds->i] = color;
}
-/*@=bounds@*/
}
return ocolor;
}
int_32 Refs = 0;
if (ds != NULL && ds->i >= 0 && ds->i < ds->Count) {
-/*@-boundsread@*/
if (ds->Refs != NULL)
Refs = ds->Refs[ds->i];
-/*@=boundsread@*/
}
return Refs;
}
int_32 orefs = 0;
if (ds != NULL && ds->i >= 0 && ds->i < ds->Count) {
-/*@-bounds@*/
if (ds->Refs != NULL) {
orefs = ds->Refs[ds->i];
ds->Refs[ds->i] = refs;
}
-/*@=bounds@*/
}
return orefs;
}
(where != NULL ? where : ""));
}
-int rpmdsNext(/*@null@*/ rpmds ds)
- /*@modifies ds @*/
+int rpmdsNext(rpmds ds)
{
int i = -1;
ds->DNEVR = _free(ds->DNEVR);
t[0] = ((ds->Type != NULL) ? ds->Type[0] : '\0');
t[1] = '\0';
- /*@-nullstate@*/
ds->DNEVR = rpmdsNewDNEVR(t, ds);
- /*@=nullstate@*/
} else
ds->i = -1;
-/*@-modfilesys @*/
if (_rpmds_debug < 0 && i != -1)
fprintf(stderr, "*** ds %p\t%s[%d]: %s\n", ds, (ds->Type ? ds->Type : "?Type?"), i, (ds->DNEVR ? ds->DNEVR : "?DNEVR?"));
-/*@=modfilesys @*/
}
return i;
}
-rpmds rpmdsInit(/*@null@*/ rpmds ds)
- /*@modifies ds @*/
+rpmds rpmdsInit(rpmds ds)
{
if (ds != NULL)
ds->i = -1;
- /*@-refcounttrans@*/
return ds;
- /*@=refcounttrans@*/
}
-/*@-bounds@*/
-static /*@null@*/
-const char ** rpmdsDupArgv(/*@null@*/ const char ** argv, int argc)
- /*@*/
+static
+const char ** rpmdsDupArgv(const char ** argv, int argc)
{
const char ** av;
size_t nb = 0;
t = stpcpy(t, argv[ac]) + 1;
}
av[ac] = NULL;
-/*@-nullret@*/
return av;
-/*@=nullret@*/
}
-/*@=bounds@*/
-/*@null@*/
static rpmds rpmdsDup(const rpmds ods)
- /*@modifies ods @*/
{
rpmds ds = xcalloc(1, sizeof(*ds));
size_t nb;
ds->h = (ods->h != NULL ? headerLink(ods->h) : NULL);
-/*@-assignexpose@*/
ds->Type = ods->Type;
-/*@=assignexpose@*/
ds->tagN = ods->tagN;
ds->Count = ods->Count;
ds->i = ods->i;
: memcpy(xmalloc(nb), ods->Flags, nb) );
ds->Ft = ods->Ft;
-/*@-compmempass@*/ /* FIX: ds->Flags is kept, not only */
+/* FIX: ds->Flags is kept, not only */
return rpmdsLink(ds, (ds ? ds->Type : NULL));
-/*@=compmempass@*/
}
comparison = strcmp(ods->N[ods->i], ds->N[ds->i]);
/* XXX rpm prior to 3.0.2 did not always supply EVR and Flags. */
-/*@-nullderef@*/
if (comparison == 0 && ods->EVR && ds->EVR)
comparison = strcmp(ods->EVR[ods->i], ds->EVR[ds->i]);
if (comparison == 0 && ods->Flags && ds->Flags)
comparison = (ods->Flags[ods->i] - ds->Flags[ds->i]);
-/*@=nullderef@*/
if (comparison < 0)
ds->u = ds->i;
return -1;
/* If not initialized yet, dup the 1st entry. */
-/*@-branchstate@*/
if (*dsp == NULL) {
save = ods->Count;
ods->Count = 1;
*dsp = rpmdsDup(ods);
ods->Count = save;
}
-/*@=branchstate@*/
ds = *dsp;
if (ds == NULL)
return -1;
ds->N = N;
/* XXX rpm prior to 3.0.2 did not always supply EVR and Flags. */
-/*@-nullderef -nullpass -nullptrarith @*/
assert(ods->EVR != NULL);
assert(ods->Flags != NULL);
Flags[ds->u] = ods->Flags[ods->i];
ds->Flags = _free(ds->Flags);
ds->Flags = Flags;
-/*@=nullderef =nullpass =nullptrarith @*/
ds->i = ds->Count;
ds->Count++;
}
-/*@-nullderef@*/
ods->i = save;
-/*@=nullderef@*/
return 0;
}
*/
static
void parseEVR(char * evr,
- /*@exposed@*/ /*@out@*/ const char ** ep,
- /*@exposed@*/ /*@out@*/ const char ** vp,
- /*@exposed@*/ /*@out@*/ const char ** rp)
- /*@modifies *ep, *vp, *rp @*/
- /*@requires maxSet(ep) >= 0 /\ maxSet(vp) >= 0 /\ maxSet(rp) >= 0 @*/
+ const char ** ep,
+ const char ** vp,
+ const char ** rp)
{
const char *epoch;
const char *version; /* assume only version is present */
epoch = evr;
*s++ = '\0';
version = s;
- /*@-branchstate@*/
if (*epoch == '\0') epoch = "0";
- /*@=branchstate@*/
} else {
epoch = NULL; /* XXX disable epoch compare if missing */
version = evr;
}
if (se) {
-/*@-boundswrite@*/
*se++ = '\0';
-/*@=boundswrite@*/
release = se;
} else {
release = NULL;
int result;
int sense;
-/*@-boundsread@*/
/* Different names don't overlap. */
if (strcmp(A->N[A->i], B->N[B->i])) {
result = 0;
}
/* XXX rpm prior to 3.0.2 did not always supply EVR and Flags. */
-/*@-nullderef@*/
if (!(A->EVR && A->Flags && B->EVR && B->Flags)) {
result = 1;
goto exit;
}
/* Both AEVR and BEVR exist. */
-/*@-boundswrite@*/
aEVR = xstrdup(A->EVR[A->i]);
parseEVR(aEVR, &aE, &aV, &aR);
bEVR = xstrdup(B->EVR[B->i]);
parseEVR(bEVR, &bE, &bV, &bR);
-/*@=boundswrite@*/
/* Compare {A,B} [epoch:]version[-release] */
sense = 0;
if (sense == 0 && aR && *aR && bR && *bR)
sense = rpmvercmp(aR, bR);
}
-/*@=boundsread@*/
aEVR = _free(aEVR);
bEVR = _free(bEVR);
((A->Flags[A->i] & RPMSENSE_GREATER) && (B->Flags[B->i] & RPMSENSE_GREATER)))) {
result = 1;
}
-/*@=nullderef@*/
exit:
if (_noisy_range_comparison_debug_message)
if (ps == NULL) return;
- /*@-branchstate@*/
if (Name == NULL) Name = "?N?";
if (EVR == NULL) EVR = "?EVR?";
if (DNEVR == NULL) DNEVR = "? ?N? ?OP? ?EVR?";
- /*@=branchstate@*/
rpmMessage(RPMMESS_DEBUG, _("package %s has unsatisfied %s: %s\n"),
pkgNEVR, ds->Type, DNEVR+2);
if (req->EVR == NULL || req->Flags == NULL)
return 1;
-/*@-boundsread@*/
if (!(req->Flags[req->i] & RPMSENSE_SENSEMASK) || !req->EVR[req->i] || *req->EVR[req->i] == '\0')
return 1;
-/*@=boundsread@*/
/* Get provides information from header */
provides = rpmdsInit(rpmdsNew(h, RPMTAG_PROVIDENAME, scareMem));
while (rpmdsNext(provides) >= 0) {
/* Filter out provides that came along for the ride. */
-/*@-boundsread@*/
if (strcmp(provides->N[provides->i], req->N[req->i]))
continue;
-/*@=boundsread@*/
result = rpmdsCompare(provides, req);
if (req->EVR == NULL || req->Flags == NULL)
return rc;
-/*@-boundsread@*/
if (!((req->Flags[req->i] & RPMSENSE_SENSEMASK) && req->EVR[req->i] && *req->EVR[req->i]))
return rc;
-/*@=boundsread@*/
/* Get package information from header */
(void) headerNVR(h, &pkgN, &v, &r);
-/*@-boundswrite@*/
t = alloca(21 + strlen(v) + 1 + strlen(r) + 1);
pkgEVR = t;
*t = '\0';
t++;
}
(void) stpcpy( stpcpy( stpcpy(t, v) , "-") , r);
-/*@=boundswrite@*/
if ((pkg = rpmdsSingle(RPMTAG_PROVIDENAME, pkgN, pkgEVR, pkgFlags)) != NULL) {
if (nopromote)
/**
*/
-/*@-exportlocal@*/
-/*@unchecked@*/
extern int _rpmds_debug;
-/*@=exportlocal@*/
/**
*/
-/*@-exportlocal@*/
-/*@unchecked@*/
extern int _rpmds_nopromote;
-/*@=exportlocal@*/
#if defined(_RPMDS_INTERNAL)
/**
* A package dependency set.
*/
struct rpmds_s {
-/*@observer@*/
const char * Type; /*!< Tag name. */
-/*@only@*/ /*@null@*/
const char * DNEVR; /*!< Formatted dependency string. */
-/*@refcounted@*/ /*@null@*/
Header h; /*!< Header for dependency set (or NULL) */
-/*@only@*/
const char ** N; /*!< Name. */
-/*@only@*/ /*@null@*/
const char ** EVR; /*!< Epoch-Version-Release. */
-/*@only@*/ /*@null@*/
int_32 * Flags; /*!< Bit(s) identifying context/comparison. */
-/*@only@*/ /*@null@*/
uint_32 * Color; /*!< Bit(s) calculated from file color(s). */
-/*@only@*/ /*@null@*/
int_32 * Refs; /*!< No. of file refs. */
int_32 BT; /*!< Package build time tie breaker. */
rpmTag tagN; /*!< Header tag. */
unsigned l; /*!< Low element (bsearch). */
unsigned u; /*!< High element (bsearch). */
int nopromote; /*!< Don't promote Epoch: in rpmdsCompare()? */
-/*@refs@*/
int nrefs; /*!< Reference count. */
};
#endif /* _RPMDS_INTERNAL */
* @param msg
* @return NULL always
*/
-/*@unused@*/ /*@null@*/
-rpmds rpmdsUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmds ds,
- /*@null@*/ const char * msg)
- /*@modifies ds @*/;
+rpmds rpmdsUnlink (rpmds ds,
+ const char * msg);
/** @todo Remove debugging entry from the ABI. */
-/*@-exportlocal@*/
-/*@null@*/
-rpmds XrpmdsUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmds ds,
- /*@null@*/ const char * msg, const char * fn, unsigned ln)
- /*@modifies ds @*/;
-/*@=exportlocal@*/
+rpmds XrpmdsUnlink (rpmds ds,
+ const char * msg, const char * fn, unsigned ln);
#define rpmdsUnlink(_ds, _msg) XrpmdsUnlink(_ds, _msg, __FILE__, __LINE__)
/**
* @param msg
* @return new dependency set reference
*/
-/*@unused@*/ /*@newref@*/ /*@null@*/
-rpmds rpmdsLink (/*@null@*/ rpmds ds, /*@null@*/ const char * msg)
- /*@modifies ds @*/;
+rpmds rpmdsLink (rpmds ds, const char * msg);
/** @todo Remove debugging entry from the ABI. */
-/*@newref@*/ /*@null@*/
-rpmds XrpmdsLink (/*@null@*/ rpmds ds, /*@null@*/ const char * msg,
- const char * fn, unsigned ln)
- /*@modifies ds @*/;
+rpmds XrpmdsLink (rpmds ds, const char * msg,
+ const char * fn, unsigned ln);
#define rpmdsLink(_ds, _msg) XrpmdsLink(_ds, _msg, __FILE__, __LINE__)
/**
* @param ds dependency set
* @return NULL always
*/
-/*@null@*/
-rpmds rpmdsFree(/*@killref@*/ /*@only@*/ /*@null@*/ rpmds ds)
- /*@modifies ds@*/;
+rpmds rpmdsFree(rpmds ds);
/**
* Create and load a dependency set.
* @deprecated Only scareMem = 0 will be permitted.
* @param flags scareMem(0x1), nofilter(0x2)
* @return new dependency set
*/
-/*@null@*/
-rpmds rpmdsNew(Header h, rpmTag tagN, int flags)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies h, rpmGlobalMacroContext, fileSystem, internalState @*/;
+rpmds rpmdsNew(Header h, rpmTag tagN, int flags);
/**
* Return new formatted dependency string.
* @param ds dependency set
* @return new formatted dependency (malloc'ed)
*/
-/*@only@*/
-char * rpmdsNewDNEVR(const char * dspfx, const rpmds ds)
- /*@*/;
+char * rpmdsNewDNEVR(const char * dspfx, const rpmds ds);
/**
* Create, load and initialize a dependency for this header.
* @param Flags comparison flags
* @return new dependency set
*/
-/*@null@*/
-rpmds rpmdsThis(Header h, rpmTag tagN, int_32 Flags)
- /*@*/;
+rpmds rpmdsThis(Header h, rpmTag tagN, int_32 Flags);
/**
* Create, load and initialize a dependency set of size 1.
* @param Flags comparison flags
* @return new dependency set
*/
-/*@null@*/
-rpmds rpmdsSingle(rpmTag tagN, const char * N, const char * EVR, int_32 Flags)
- /*@*/;
+rpmds rpmdsSingle(rpmTag tagN, const char * N, const char * EVR, int_32 Flags);
/**
* Return dependency set count.
* @param ds dependency set
* @return current count
*/
-int rpmdsCount(/*@null@*/ const rpmds ds)
- /*@*/;
+int rpmdsCount(const rpmds ds);
/**
* Return dependency set index.
* @param ds dependency set
* @return current index
*/
-int rpmdsIx(/*@null@*/ const rpmds ds)
- /*@*/;
+int rpmdsIx(const rpmds ds);
/**
* Set dependency set index.
* @param ix new index
* @return current index
*/
-int rpmdsSetIx(/*@null@*/ rpmds ds, int ix)
- /*@modifies ds @*/;
+int rpmdsSetIx(rpmds ds, int ix);
/**
* Return current formatted dependency string.
* @param ds dependency set
* @return current dependency DNEVR, NULL on invalid
*/
-/*@observer@*/ /*@null@*/
-extern const char * rpmdsDNEVR(/*@null@*/ const rpmds ds)
- /*@*/;
+extern const char * rpmdsDNEVR(const rpmds ds);
/**
* Return current dependency name.
* @param ds dependency set
* @return current dependency name, NULL on invalid
*/
-/*@observer@*/ /*@null@*/
-extern const char * rpmdsN(/*@null@*/ const rpmds ds)
- /*@*/;
+extern const char * rpmdsN(const rpmds ds);
/**
* Return current dependency epoch-version-release.
* @param ds dependency set
* @return current dependency EVR, NULL on invalid
*/
-/*@observer@*/ /*@null@*/
-extern const char * rpmdsEVR(/*@null@*/ const rpmds ds)
- /*@*/;
+extern const char * rpmdsEVR(const rpmds ds);
/**
* Return current dependency flags.
* @param ds dependency set
* @return current dependency flags, 0 on invalid
*/
-int_32 rpmdsFlags(/*@null@*/ const rpmds ds)
- /*@*/;
+int_32 rpmdsFlags(const rpmds ds);
/**
* Return current dependency type.
* @param ds dependency set
* @return current dependency type, 0 on invalid
*/
-rpmTag rpmdsTagN(/*@null@*/ const rpmds ds)
- /*@*/;
+rpmTag rpmdsTagN(const rpmds ds);
/**
* Return dependency build time.
* @param ds dependency set
* @return dependency build time, 0 on invalid
*/
-time_t rpmdsBT(/*@null@*/ const rpmds ds)
- /*@*/;
+time_t rpmdsBT(const rpmds ds);
/**
* Set dependency build time.
* @param BT build time
* @return dependency build time, 0 on invalid
*/
-time_t rpmdsSetBT(/*@null@*/ const rpmds ds, time_t BT)
- /*@modifies ds @*/;
+time_t rpmdsSetBT(const rpmds ds, time_t BT);
/**
* Return current "Don't promote Epoch:" flag.
* @param ds dependency set
* @return current "Don't promote Epoch:" flag
*/
-int rpmdsNoPromote(/*@null@*/ const rpmds ds)
- /*@*/;
+int rpmdsNoPromote(const rpmds ds);
/**
* Set "Don't promote Epoch:" flag.
* @param nopromote Should an unspecified Epoch: be treated as Epoch: 0?
* @return previous "Don't promote Epoch:" flag
*/
-int rpmdsSetNoPromote(/*@null@*/ rpmds ds, int nopromote)
- /*@modifies ds @*/;
+int rpmdsSetNoPromote(rpmds ds, int nopromote);
/**
* Return current dependency color.
* @param ds dependency set
* @return current dependency color
*/
-uint_32 rpmdsColor(/*@null@*/ const rpmds ds)
- /*@*/;
+uint_32 rpmdsColor(const rpmds ds);
/**
* Return current dependency color.
* @param color new dependency color
* @return previous dependency color
*/
-uint_32 rpmdsSetColor(/*@null@*/ const rpmds ds, uint_32 color)
- /*@modifies ds @*/;
+uint_32 rpmdsSetColor(const rpmds ds, uint_32 color);
/**
* Return current dependency file refs.
* @param ds dependency set
* @return current dependency file refs, -1 on global
*/
-int_32 rpmdsRefs(/*@null@*/ const rpmds ds)
- /*@*/;
+int_32 rpmdsRefs(const rpmds ds);
/**
* Return current dependency color.
* @param refs new dependency refs
* @return previous dependency refs
*/
-int_32 rpmdsSetRefs(/*@null@*/ const rpmds ds, int_32 refs)
- /*@modifies ds @*/;
+int_32 rpmdsSetRefs(const rpmds ds, int_32 refs);
/**
* Notify of results of dependency match.
* @param where where dependency was resolved (or NULL)
* @param rc 0 == YES, otherwise NO
*/
-/*@-globuse@*/ /* FIX: rpmMessage annotation is a lie */
-void rpmdsNotify(/*@null@*/ rpmds ds, /*@null@*/ const char * where, int rc)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/;
-/*@=globuse@*/
+/* FIX: rpmMessage annotation is a lie */
+void rpmdsNotify(rpmds ds, const char * where, int rc);
/**
* Return next dependency set iterator index.
* @param ds dependency set
* @return dependency set iterator index, -1 on termination
*/
-int rpmdsNext(/*@null@*/ rpmds ds)
- /*@modifies ds @*/;
+int rpmdsNext(rpmds ds);
/**
* Initialize dependency set iterator.
* @param ds dependency set
* @return dependency set
*/
-/*@null@*/
-rpmds rpmdsInit(/*@null@*/ rpmds ds)
- /*@modifies ds @*/;
+rpmds rpmdsInit(rpmds ds);
/**
* Find a dependency set element using binary search.
* @param ods dependency set element to find.
* @return dependency index (or -1 if not found)
*/
-/*@null@*/
-int rpmdsFind(rpmds ds, /*@null@*/ const rpmds ods)
- /*@modifies ds @*/;
+int rpmdsFind(rpmds ds, const rpmds ods);
/**
* Merge a dependency set maintaining (N,EVR,Flags) sorted order.
* @param ods dependency set to merge
* @return (merged) dependency index
*/
-/*@null@*/
-int rpmdsMerge(/*@out@*/ rpmds * dsp, /*@null@*/ rpmds ods)
- /*@modifies *dsp, ods @*/;
+int rpmdsMerge(rpmds * dsp, rpmds ods);
/**
* Compare two versioned dependency ranges, looking for overlap.
* @param B 2nd dependency
* @return 1 if dependencies overlap, 0 otherwise
*/
-int rpmdsCompare(const rpmds A, const rpmds B)
- /*@*/;
+int rpmdsCompare(const rpmds A, const rpmds B);
/**
* Report a Requires: or Conflicts: dependency problem.
* @param suggestedKeys filename or python object address
* @param adding dependency problem is from added package set?
*/
-void rpmdsProblem(/*@null@*/ rpmps ps, const char * pkgNEVR, const rpmds ds,
- /*@only@*/ /*@null@*/ const fnpyKey * suggestedKeys,
- int adding)
- /*@modifies ps @*/;
+void rpmdsProblem(rpmps ps, const char * pkgNEVR, const rpmds ds,
+ const fnpyKey * suggestedKeys,
+ int adding);
/**
* Compare package provides dependencies from header with a single dependency.
* @param nopromote Don't promote Epoch: in comparison?
* @return 1 if any dependency overlaps, 0 otherwise
*/
-int rpmdsAnyMatchesDep (const Header h, const rpmds req, int nopromote)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies h, rpmGlobalMacroContext, fileSystem, internalState @*/;
+int rpmdsAnyMatchesDep (const Header h, const rpmds req, int nopromote);
/**
* Compare package name-version-release from header with a single dependency.
* @param nopromote Don't promote Epoch: in comparison?
* @return 1 if dependency overlaps, 0 otherwise
*/
-int rpmdsNVRMatchesDep(const Header h, const rpmds req, int nopromote)
- /*@*/;
+int rpmdsNVRMatchesDep(const Header h, const rpmds req, int nopromote);
#ifdef __cplusplus
}
#include "debug.h"
-/*@access rpmte @*/
-/*@unchecked@*/
int _rpmfi_debug = 0;
rpmfi XrpmfiUnlink(rpmfi fi, const char * msg, const char * fn, unsigned ln)
{
if (fi == NULL) return NULL;
-/*@-modfilesys@*/
if (_rpmfi_debug && msg != NULL)
fprintf(stderr, "--> fi %p -- %d %s at %s:%u\n", fi, fi->nrefs, msg, fn, ln);
-/*@=modfilesys@*/
fi->nrefs--;
return NULL;
}
{
if (fi == NULL) return NULL;
fi->nrefs++;
-/*@-modfilesys@*/
if (_rpmfi_debug && msg != NULL)
fprintf(stderr, "--> fi %p ++ %d %s at %s:%u\n", fi, fi->nrefs, msg, fn, ln);
-/*@=modfilesys@*/
- /*@-refcounttrans@*/ return fi; /*@=refcounttrans@*/
+ return fi;
}
int rpmfiFC(rpmfi fi)
if (fi != NULL && fx >= 0 && fx < fi->fc) {
i = fi->i;
fi->i = fx;
-/*@-boundsread@*/
fi->j = fi->dil[fi->i];
-/*@=boundsread@*/
}
return i;
}
const char * BN = NULL;
if (fi != NULL && fi->i >= 0 && fi->i < fi->fc) {
-/*@-boundsread@*/
if (fi->bnl != NULL)
BN = fi->bnl[fi->i];
-/*@=boundsread@*/
}
return BN;
}
const char * DN = NULL;
if (fi != NULL && fi->j >= 0 && fi->j < fi->dc) {
-/*@-boundsread@*/
if (fi->dnl != NULL)
DN = fi->dnl[fi->j];
-/*@=boundsread@*/
}
return DN;
}
{
const char * FN = "";
- /*@-branchstate@*/
if (fi != NULL && fi->i >= 0 && fi->i < fi->fc) {
char * t;
if (fi->fn == NULL)
fi->fn = xmalloc(fi->fnlen);
FN = t = fi->fn;
-/*@-boundswrite@*/
*t = '\0';
t = stpcpy(t, fi->dnl[fi->dil[fi->i]]);
t = stpcpy(t, fi->bnl[fi->i]);
-/*@=boundswrite@*/
}
- /*@=branchstate@*/
return FN;
}
int_32 FFlags = 0;
if (fi != NULL && fi->i >= 0 && fi->i < fi->fc) {
-/*@-boundsread@*/
if (fi->fflags != NULL)
FFlags = fi->fflags[fi->i];
-/*@=boundsread@*/
}
return FFlags;
}
int_32 VFlags = 0;
if (fi != NULL && fi->i >= 0 && fi->i < fi->fc) {
-/*@-boundsread@*/
if (fi->vflags != NULL)
VFlags = fi->vflags[fi->i];
-/*@=boundsread@*/
}
return VFlags;
}
int_16 fmode = 0;
if (fi != NULL && fi->i >= 0 && fi->i < fi->fc) {
-/*@-boundsread@*/
if (fi->fmodes != NULL)
fmode = fi->fmodes[fi->i];
-/*@=boundsread@*/
}
return fmode;
}
rpmfileState fstate = RPMFILE_STATE_MISSING;
if (fi != NULL && fi->i >= 0 && fi->i < fi->fc) {
-/*@-boundsread@*/
if (fi->fstates != NULL)
fstate = fi->fstates[fi->i];
-/*@=boundsread@*/
}
return fstate;
}
unsigned char * MD5 = NULL;
if (fi != NULL && fi->i >= 0 && fi->i < fi->fc) {
-/*@-boundsread@*/
if (fi->md5s != NULL)
MD5 = fi->md5s + (16 * fi->i);
-/*@=boundsread@*/
}
return MD5;
}
const char * flink = NULL;
if (fi != NULL && fi->i >= 0 && fi->i < fi->fc) {
-/*@-boundsread@*/
if (fi->flinks != NULL)
flink = fi->flinks[fi->i];
-/*@=boundsread@*/
}
return flink;
}
int_32 fsize = 0;
if (fi != NULL && fi->i >= 0 && fi->i < fi->fc) {
-/*@-boundsread@*/
if (fi->fsizes != NULL)
fsize = fi->fsizes[fi->i];
-/*@=boundsread@*/
}
return fsize;
}
int_16 frdev = 0;
if (fi != NULL && fi->i >= 0 && fi->i < fi->fc) {
-/*@-boundsread@*/
if (fi->frdevs != NULL)
frdev = fi->frdevs[fi->i];
-/*@=boundsread@*/
}
return frdev;
}
int_32 finode = 0;
if (fi != NULL && fi->i >= 0 && fi->i < fi->fc) {
-/*@-boundsread@*/
if (fi->finodes != NULL)
finode = fi->finodes[fi->i];
-/*@=boundsread@*/
}
return finode;
}
uint_32 fcolor = 0;
if (fi != NULL && fi->i >= 0 && fi->i < fi->fc) {
-/*@-boundsread@*/
if (fi->fcolors != NULL)
/* XXX ignore all but lsnibble for now. */
fcolor = (fi->fcolors[fi->i] & 0x0f);
-/*@=boundsread@*/
}
return fcolor;
}
int cdictx;
if (fi != NULL && fi->fcdictx != NULL && fi->i >= 0 && fi->i < fi->fc) {
-/*@-boundsread@*/
cdictx = fi->fcdictx[fi->i];
if (fi->cdict != NULL && cdictx >= 0 && cdictx < fi->ncdict)
fclass = fi->cdict[cdictx];
-/*@=boundsread@*/
}
return fclass;
}
const char * fcontext = NULL;
if (fi != NULL && fi->i >= 0 && fi->i < fi->fc) {
-/*@-boundsread@*/
if (fi->fcontexts != NULL)
fcontext = fi->fcontexts[fi->i];
-/*@=boundsread@*/
}
return fcontext;
}
const uint_32 * fddict = NULL;
if (fi != NULL && fi->i >= 0 && fi->i < fi->fc) {
-/*@-boundsread@*/
if (fi->fddictn != NULL)
fddictn = fi->fddictn[fi->i];
if (fddictn > 0 && fi->fddictx != NULL)
fddictx = fi->fddictx[fi->i];
if (fi->ddict != NULL && fddictx >= 0 && (fddictx+fddictn) <= fi->nddict)
fddict = fi->ddict + fddictx;
-/*@=boundsread@*/
}
-/*@-boundswrite -dependenttrans -onlytrans @*/
if (fddictp)
*fddictp = fddict;
-/*@=boundswrite =dependenttrans =onlytrans @*/
return fddictn;
}
if (fi != NULL && fi->i >= 0 && fi->i < fi->fc) {
/* XXX rpm-2.3.12 has not RPMTAG_FILEINODES */
-/*@-boundsread@*/
if (fi->finodes && fi->frdevs) {
int_32 finode = fi->finodes[fi->i];
int_16 frdev = fi->frdevs[fi->i];
nlink++;
}
}
-/*@=boundsread@*/
}
return nlink;
}
int_32 fmtime = 0;
if (fi != NULL && fi->i >= 0 && fi->i < fi->fc) {
-/*@-boundsread@*/
if (fi->fmtimes != NULL)
fmtime = fi->fmtimes[fi->i];
-/*@=boundsread@*/
}
return fmtime;
}
/* XXX add support for ancient RPMTAG_FILEUIDS? */
if (fi != NULL && fi->i >= 0 && fi->i < fi->fc) {
-/*@-boundsread@*/
if (fi->fuser != NULL)
fuser = fi->fuser[fi->i];
-/*@=boundsread@*/
}
return fuser;
}
/* XXX add support for ancient RPMTAG_FILEGIDS? */
if (fi != NULL && fi->i >= 0 && fi->i < fi->fc) {
-/*@-boundsread@*/
if (fi->fgroup != NULL)
fgroup = fi->fgroup[fi->i];
-/*@=boundsread@*/
}
return fgroup;
}
if (fi != NULL && ++fi->i >= 0) {
if (fi->i < fi->fc) {
i = fi->i;
-/*@-boundsread@*/
if (fi->dil != NULL)
fi->j = fi->dil[fi->i];
-/*@=boundsread@*/
} else
fi->i = -1;
-/*@-modfilesys @*/
if (_rpmfi_debug < 0 && i != -1)
fprintf(stderr, "*** fi %p\t%s[%d] %s%s\n", fi, (fi->Type ? fi->Type : "?Type?"), i, (i >= 0 ? fi->dnl[fi->j] : ""), (i >= 0 ? fi->bnl[fi->i] : ""));
-/*@=modfilesys @*/
}
}
}
- /*@-refcounttrans@*/
return fi;
- /*@=refcounttrans@*/
}
int rpmfiNextD(rpmfi fi)
else
fi->j = -1;
-/*@-modfilesys @*/
if (_rpmfi_debug < 0 && j != -1)
fprintf(stderr, "*** fi %p\t%s[%d]\n", fi, (fi->Type ? fi->Type : "?Type?"), j);
-/*@=modfilesys @*/
}
fi = NULL;
}
- /*@-refcounttrans@*/
return fi;
- /*@=refcounttrans@*/
}
/**
* @param ft file type
* @return string to identify a file type
*/
-static /*@observer@*/
+static
const char * ftstring (fileTypes ft)
- /*@*/
{
switch (ft) {
case XDIR: return "directory";
case REG: return "file";
default: return "unknown file type";
}
- /*@notreached@*/
}
fileTypes whatis(uint_16 mode)
if (S_ISCHR(mode)) return CDEV;
if (S_ISBLK(mode)) return BDEV;
if (S_ISLNK(mode)) return LINK;
-/*@-unrecog@*/
if (S_ISSOCK(mode)) return SOCK;
-/*@=unrecog@*/
if (S_ISFIFO(mode)) return PIPE;
return REG;
}
-/*@-boundsread@*/
int rpmfiCompare(const rpmfi afi, const rpmfi bfi)
- /*@*/
{
fileTypes awhat = whatis(rpmfiFMode(afi));
fileTypes bwhat = whatis(rpmfiFMode(bfi));
return 0;
}
-/*@=boundsread@*/
-/*@-boundsread@*/
fileAction rpmfiDecideFate(const rpmfi ofi, rpmfi nfi, int skipMissing)
{
const char * fn = rpmfiFN(nfi);
return FA_CREATE; /* unmodified config file, replace. */
}
nmd5 = rpmfiMD5(nfi);
-/*@-nullpass@*/
if (omd5 && nmd5 && !memcmp(omd5, nmd5, 16))
return FA_SKIP; /* identical file, don't bother. */
-/*@=nullpass@*/
} else /* dbWhat == LINK */ {
const char * oFLink, * nFLink;
oFLink = rpmfiFLink(ofi);
return FA_CREATE; /* unmodified config file, replace. */
}
nFLink = rpmfiFLink(nfi);
-/*@-nullpass@*/
if (oFLink && nFLink && !strcmp(oFLink, nFLink))
return FA_SKIP; /* identical file, don't bother. */
-/*@=nullpass@*/
}
/*
*/
return save;
}
-/*@=boundsread@*/
-/*@-boundsread@*/
int rpmfiConfigConflict(const rpmfi fi)
{
const char * fn = rpmfiFN(fi);
return 1;
}
-/*@=boundsread@*/
-/*@observer@*/
const char * rpmfiTypeString(rpmfi fi)
{
switch(rpmteType(fi->te)) {
case TR_REMOVED: return " erase";
default: return "???";
}
- /*@noteached@*/
}
#define alloca_strdup(_s) strcpy(alloca(strlen(_s)+1), (_s))
* @param actions file dispositions
* @return header with relocated files
*/
-/*@-bounds@*/
static
Header relocateFileList(const rpmts ts, rpmfi fi,
Header origH, fileAction * actions)
- /*@globals h_errno, rpmGlobalMacroContext @*/
- /*@modifies ts, fi, origH, actions, rpmGlobalMacroContext @*/
{
rpmte p = rpmtsRelocateElement(ts);
HGE_t hge = fi->hge;
/* FIXME: Trailing /'s will confuse us greatly. Internal ones will
too, but those are more trouble to fix up. :-( */
t = alloca_strdup(p->relocs[i].oldPath);
- /*@-branchstate@*/
relocations[i].oldPath = (t[0] == '/' && t[1] == '\0')
? t
: stripTrailingChar(t, '/');
- /*@=branchstate@*/
/* An old path w/o a new path is valid, and indicates exclusion */
if (p->relocs[i].newPath) {
int del;
t = alloca_strdup(p->relocs[i].newPath);
- /*@-branchstate@*/
relocations[i].newPath = (t[0] == '/' && t[1] == '\0')
? t
: stripTrailingChar(t, '/');
- /*@=branchstate@*/
- /*@-nullpass@*/ /* FIX: relocations[i].oldPath == NULL */
+ /* FIX: relocations[i].oldPath == NULL */
/* Verify that the relocation's old path is in the header. */
for (j = 0; j < numValid; j++) {
if (!strcmp(validRelocations[j], relocations[i].oldPath))
- /*@innerbreak@*/ break;
+ break;
}
/* XXX actions check prevents problem from being appended twice. */
}
del =
strlen(relocations[i].newPath) - strlen(relocations[i].oldPath);
- /*@=nullpass@*/
if (del > reldel)
reldel = del;
if (relocations[j - 1].oldPath == NULL || /* XXX can't happen */
relocations[j ].oldPath == NULL || /* XXX can't happen */
strcmp(relocations[j - 1].oldPath, relocations[j].oldPath) <= 0)
- /*@innercontinue@*/ continue;
- /*@-usereleased@*/ /* LCL: ??? */
+ continue;
+ /* LCL: ??? */
tmpReloc = relocations[j - 1];
relocations[j - 1] = relocations[j];
relocations[j] = tmpReloc;
- /*@=usereleased@*/
madeSwap = 1;
}
if (!madeSwap) break;
for (j = 0; j < numRelocations; j++) {
if (relocations[j].oldPath == NULL || /* XXX can't happen */
strcmp(validRelocations[i], relocations[j].oldPath))
- /*@innercontinue@*/ continue;
+ continue;
/* On install, a relocate to NULL means skip the path. */
if (relocations[j].newPath) {
actualRelocations[numActual] = relocations[j].newPath;
numActual++;
}
- /*@innerbreak@*/ break;
+ break;
}
if (j == numRelocations) {
actualRelocations[numActual] = validRelocations[i];
len = reldel +
strlen(dirNames[dirIndexes[i]]) + strlen(baseNames[i]) + 1;
- /*@-branchstate@*/
if (len >= fileAlloced) {
fileAlloced = len * 2;
fn = xrealloc(fn, fileAlloced);
}
- /*@=branchstate@*/
assert(fn != NULL); /* XXX can't happen */
*fn = '\0';
if (fColors != NULL) {
/* XXX pkgs may not have unique dirNames, so color all dirNames that match. */
for (j = 0; j < dirCount; j++) {
-if (strcmp(dirNames[dirIndexes[i]], dirNames[j])) /*@innercontinue@*/ continue;
+if (strcmp(dirNames[dirIndexes[i]], dirNames[j])) continue;
dColors[j] |= fColors[i];
}
}
*/
for (j = numRelocations - 1; j >= 0; j--) {
if (relocations[j].oldPath == NULL) /* XXX can't happen */
- /*@innercontinue@*/ continue;
+ continue;
len = strcmp(relocations[j].oldPath, "/")
? strlen(relocations[j].oldPath)
: 0;
if (fnlen < len)
- /*@innercontinue@*/ continue;
+ continue;
/*
* Only subdirectories or complete file paths may be relocated. We
* don't check for '\0' as our directory names all end in '/'.
*/
if (!(fn[len] == '/' || fnlen == len))
- /*@innercontinue@*/ continue;
+ continue;
if (strncmp(relocations[j].oldPath, fn, len))
- /*@innercontinue@*/ continue;
- /*@innerbreak@*/ break;
+ continue;
+ break;
}
if (j < 0) continue;
-/*@-nullderef@*/ /* FIX: fModes may be NULL */
+/* FIX: fModes may be NULL */
ft = whatis(fModes[i]);
-/*@=nullderef@*/
/* On install, a relocate to NULL means skip the path. */
if (relocations[j].newPath == NULL) {
len = strlen(dirNames[j]) - 1;
while (len > 0 && dirNames[j][len-1] == '/') len--;
if (fnlen != len)
- /*@innercontinue@*/ continue;
+ continue;
if (strncmp(fn, dirNames[j], fnlen))
- /*@innercontinue@*/ continue;
- /*@innerbreak@*/ break;
+ continue;
+ break;
}
}
if (actions) {
fnlen = te - fn;
} else
te = fn + strlen(fn);
- /*@-nullpass -nullderef@*/ /* LCL: te != NULL here. */
+ /* LCL: te != NULL here. */
if (strcmp(baseNames[i], te)) /* basename changed too? */
baseNames[i] = alloca_strdup(te);
*te = '\0'; /* terminate new directory name */
- /*@=nullpass =nullderef@*/
}
/* Does this directory already exist in the directory list? */
for (j = 0; j < dirCount; j++) {
if (fnlen != strlen(dirNames[j]))
- /*@innercontinue@*/ continue;
+ continue;
if (strncmp(fn, dirNames[j], fnlen))
- /*@innercontinue@*/ continue;
- /*@innerbreak@*/ break;
+ continue;
+ break;
}
if (j < dirCount) {
/* XXX Don't autorelocate uncolored directories. */
if (j == p->autorelocatex
&& (dColors[i] == 0 || !(dColors[i] & mydColor)))
- /*@innercontinue@*/ continue;
+ continue;
if (relocations[j].oldPath == NULL) /* XXX can't happen */
- /*@innercontinue@*/ continue;
+ continue;
len = strcmp(relocations[j].oldPath, "/")
? strlen(relocations[j].oldPath)
: 0;
if (len && strncmp(relocations[j].oldPath, dirNames[i], len))
- /*@innercontinue@*/ continue;
+ continue;
/*
* Only subdirectories or complete file paths may be relocated. We
* don't check for '\0' as our directory names all end in '/'.
*/
if (dirNames[i][len] != '/')
- /*@innercontinue@*/ continue;
+ continue;
if (relocations[j].newPath) { /* Relocate the path */
const char * s = relocations[j].newPath;
baseNames = hfd(baseNames, RPM_STRING_ARRAY_TYPE);
dirNames = hfd(dirNames, RPM_STRING_ARRAY_TYPE);
-/*@-dependenttrans@*/
fn = _free(fn);
-/*@=dependenttrans@*/
return h;
}
-/*@=bounds@*/
rpmfi rpmfiFree(rpmfi fi)
{
if (fi->nrefs > 1)
return rpmfiUnlink(fi, fi->Type);
-/*@-modfilesys@*/
if (_rpmfi_debug < 0)
fprintf(stderr, "*** fi %p\t%s[%d]\n", fi, fi->Type, fi->fc);
-/*@=modfilesys@*/
/* Free pre- and post-transaction script and interpreter strings. */
fi->pretrans = _free(fi->pretrans);
fi->posttrans = _free(fi->posttrans);
fi->posttransprog = _free(fi->posttransprog);
- /*@-branchstate@*/
if (fi->fc > 0) {
fi->bnl = hfd(fi->bnl, -1);
fi->dnl = hfd(fi->dnl, -1);
fi->fstates = _free(fi->fstates);
- /*@-evalorder@*/
if (!fi->keep_header && fi->h == NULL) {
fi->fmtimes = _free(fi->fmtimes);
fi->fmodes = _free(fi->fmodes);
fi->fddictn = _free(fi->fddictn);
}
- /*@=evalorder@*/
}
- /*@=branchstate@*/
fi->fsm = freeFSM(fi->fsm);
fi->h = headerFree(fi->h);
- /*@-nullstate -refcounttrans -usereleased@*/
(void) rpmfiUnlink(fi, fi->Type);
memset(fi, 0, sizeof(*fi)); /* XXX trash and burn */
fi = _free(fi);
- /*@=nullstate =refcounttrans =usereleased@*/
return NULL;
}
* @return binary nibble
*/
static inline unsigned char nibble(char c)
- /*@*/
{
if (c >= '0' && c <= '9')
return (c - '0');
i = p->nrelocs;
if (newPath != NULL && *newPath != '\0' && p->relocs != NULL)
for (i = 0; i < p->nrelocs; i++) {
-/*@-nullpass@*/ /* XXX {old,new}Path might be NULL */
+/* XXX {old,new}Path might be NULL */
if (strcmp(p->relocs[i].oldPath, "/"))
continue;
if (strcmp(p->relocs[i].newPath, newPath))
continue;
-/*@=nullpass@*/
break;
}
/* XXX DYING */
if (fi->actions == NULL)
fi->actions = xcalloc(fi->fc, sizeof(*fi->actions));
- /*@-compdef@*/ /* FIX: fi-md5s undefined */
+ /* FIX: fi-md5s undefined */
foo = relocateFileList(ts, fi, h, fi->actions);
- /*@=compdef@*/
fi->h = headerFree(fi->h);
fi->h = headerLink(foo);
foo = headerFree(foo);
fi->fperms = 0644;
exit:
-/*@-modfilesys@*/
if (_rpmfi_debug < 0)
fprintf(stderr, "*** fi %p\t%s[%d]\n", fi, Type, (fi ? fi->fc : 0));
-/*@=modfilesys@*/
- /*@-compdef -nullstate@*/ /* FIX: rpmfi null annotations */
+ /* FIX: rpmfi null annotations */
return rpmfiLink(fi, (fi ? fi->Type : NULL));
- /*@=compdef =nullstate@*/
}
void rpmfiBuildFClasses(Header h,
- /*@out@*/ const char *** fclassp, /*@out@*/ int * fcp)
+ const char *** fclassp, int * fcp)
{
int scareMem = 0;
rpmfi fi = rpmfiNew(NULL, h, RPMTAG_BASENAMES, scareMem);
*t++ = '\0';
}
av[ac] = NULL; /* XXX tag arrays are not NULL terminated. */
- /*@=branchstate@*/
exit:
fi = rpmfiFree(fi);
- /*@-branchstate@*/
if (fclassp)
*fclassp = av;
else
av = _free(av);
- /*@=branchstate@*/
if (fcp) *fcp = ac;
}
void rpmfiBuildFDeps(Header h, rpmTag tagN,
- /*@out@*/ const char *** fdepsp, /*@out@*/ int * fcp)
+ const char *** fdepsp, int * fcp)
{
int scareMem = 0;
rpmfi fi = rpmfiNew(NULL, h, RPMTAG_BASENAMES, scareMem);
ix = *ddict++;
mydt = ((ix >> 24) & 0xff);
if (mydt != deptype)
- /*@innercontinue@*/ continue;
+ continue;
ix &= 0x00ffffff;
(void) rpmdsSetIx(ds, ix-1);
if (rpmdsNext(ds) < 0)
- /*@innercontinue@*/ continue;
+ continue;
DNEVR = rpmdsDNEVR(ds);
if (DNEVR != NULL)
nb += strlen(DNEVR+2) + 1;
av = xmalloc(nb);
t = ((char *) av) + ((ac + 1) * sizeof(*av));
ac = 0;
- /*@-branchstate@*/
fi = rpmfiInit(fi, 0);
if (fi != NULL)
while (rpmfiNext(fi) >= 0) {
ix = *ddict++;
mydt = ((ix >> 24) & 0xff);
if (mydt != deptype)
- /*@innercontinue@*/ continue;
+ continue;
ix &= 0x00ffffff;
(void) rpmdsSetIx(ds, ix-1);
if (rpmdsNext(ds) < 0)
- /*@innercontinue@*/ continue;
+ continue;
DNEVR = rpmdsDNEVR(ds);
if (DNEVR != NULL) {
t = stpcpy(t, DNEVR+2);
}
*t++ = '\0';
}
- /*@=branchstate@*/
av[ac] = NULL; /* XXX tag arrays are not NULL terminated. */
exit:
fi = rpmfiFree(fi);
ds = rpmdsFree(ds);
- /*@-branchstate@*/
if (fdepsp)
*fdepsp = av;
else
av = _free(av);
- /*@=branchstate@*/
if (fcp) *fcp = ac;
}
* Structure(s) used for file info tag sets.
*/
-/*@-exportlocal@*/
-/*@unchecked@*/
extern int _rpmfi_debug;
-/*@=exportlocal@*/
#if defined(_RPMFI_INTERNAL)
/**
int i; /*!< Current file index. */
int j; /*!< Current directory index. */
-/*@observer@*/
const char * Type; /*!< Tag name. */
rpmTag tagN; /*!< Header tag. */
-/*@refcounted@*/ /*@null@*/
Header h; /*!< Header for file info set (or NULL) */
-/*@only@*/ /*?null?*/
+/*?null?*/
const char ** bnl; /*!< Base name(s) (from header) */
-/*@only@*/ /*?null?*/
+/*?null?*/
const char ** dnl; /*!< Directory name(s) (from header) */
-/*@only@*/ /*@relnull@*/
const char ** fmd5s; /*!< File MD5 sum(s) (from header) */
-/*@only@*/ /*@relnull@*/
const char ** flinks; /*!< File link(s) (from header) */
-/*@only@*/ /*@null@*/
const char ** flangs; /*!< File lang(s) (from header) */
-/*@only@*/ /*@relnull@*/
uint_32 * dil; /*!< Directory indice(s) (from header) */
-/*@only@*/ /*?null?*/
+/*?null?*/
const uint_32 * fflags; /*!< File flag(s) (from header) */
-/*@only@*/ /*?null?*/
+/*?null?*/
const uint_32 * fsizes; /*!< File size(s) (from header) */
-/*@only@*/ /*?null?*/
+/*?null?*/
const uint_32 * fmtimes; /*!< File modification time(s) (from header) */
-/*@only@*/ /*?null?*/
+/*?null?*/
uint_16 * fmodes; /*!< File mode(s) (from header) */
-/*@only@*/ /*?null?*/
+/*?null?*/
const uint_16 * frdevs; /*!< File rdev(s) (from header) */
-/*@only@*/ /*?null?*/
+/*?null?*/
const uint_32 * finodes; /*!< File inodes(s) (from header) */
-/*@only@*/ /*@null@*/
const char ** fuser; /*!< File owner(s) (from header) */
-/*@only@*/ /*@null@*/
const char ** fgroup; /*!< File group(s) (from header) */
-/*@only@*/ /*@null@*/
char * fstates; /*!< File state(s) (from header) */
-/*@only@*/ /*@null@*/
const uint_32 * fcolors; /*!< File color bits (header) */
-/*@only@*/ /*@null@*/
const char ** fcontexts; /*! FIle security contexts. */
-/*@only@*/ /*@null@*/
const char ** cdict; /*!< File class dictionary (header) */
int_32 ncdict; /*!< No. of class entries. */
-/*@only@*/ /*@null@*/
const uint_32 * fcdictx; /*!< File class dictionary index (header) */
-/*@only@*/ /*@null@*/
const uint_32 * ddict; /*!< File depends dictionary (header) */
int_32 nddict; /*!< No. of depends entries. */
-/*@only@*/ /*@null@*/
const uint_32 * fddictx; /*!< File depends dictionary start (header) */
-/*@only@*/ /*@null@*/
const uint_32 * fddictn; /*!< File depends dictionary count (header) */
-/*@only@*/ /*?null?*/
+/*?null?*/
const uint_32 * vflags; /*!< File verify flag(s) (from header) */
int_32 dc; /*!< No. of directories. */
int_32 fc; /*!< No. of files. */
/*=============================*/
-/*@dependent@*/ /*@relnull@*/
rpmte te;
HGE_t hge; /*!< Vector to headerGetEntry() */
gid_t gid; /*!< File gid (default). */
uint_32 flags; /*!< File flags (default). */
fileAction action; /*!< File disposition (default). */
-/*@owned@*/ /*@relnull@*/
fileAction * actions; /*!< File disposition(s). */
-/*@owned@*/
struct fingerPrint_s * fps; /*!< File fingerprint(s). */
-/*@owned@*/
const char ** obnl; /*!< Original basename(s) (from header) */
-/*@owned@*/
const char ** odnl; /*!< Original dirname(s) (from header) */
-/*@unused@*/
int_32 * odil; /*!< Original dirindex(s) (from header) */
-/*@only@*/ /*@relnull@*/
unsigned char * md5s; /*!< File md5 sums in binary. */
-/*@only@*/ /*@null@*/
const char * pretrans;
-/*@only@*/ /*@null@*/
const char * pretransprog;
-/*@only@*/ /*@null@*/
const char * posttrans;
-/*@only@*/ /*@null@*/
const char * posttransprog;
-/*@only@*/ /*@null@*/
char * fn; /*!< File name buffer. */
int fnlen; /*!< FIle name buffer length. */
unsigned int archiveSize;
mode_t dperms; /*!< Directory perms (0755) if not mapped. */
mode_t fperms; /*!< File perms (0644) if not mapped. */
-/*@only@*/ /*@null@*/
const char ** apath;
int mapflags;
-/*@owned@*/ /*@null@*/
int * fmapflags;
-/*@owned@*/
FSM_t fsm; /*!< File state machine data. */
int keep_header; /*!< Keep header? */
uint_32 color; /*!< Color bit(s) from file color union. */
-/*@owned@*/
sharedFileInfo replaced; /*!< (TR_ADDED) */
-/*@owned@*/
uint_32 * replacedSizes; /*!< (TR_ADDED) */
unsigned int record; /*!< (TR_REMOVED) */
int magic;
#define RPMFIMAGIC 0x09697923
/*=============================*/
-/*@refs@*/ int nrefs; /*!< Reference count. */
+int nrefs; /*!< Reference count. */
};
#endif /* _RPMFI_INTERNAL */
* @param msg
* @return NULL always
*/
-/*@unused@*/ /*@null@*/
-rpmfi rpmfiUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmfi fi,
- /*@null@*/ const char * msg)
- /*@modifies fi @*/;
+rpmfi rpmfiUnlink (rpmfi fi,
+ const char * msg);
/** @todo Remove debugging entry from the ABI.
* @param fi file info set
* @param ln
* @return NULL always
*/
-/*@-exportlocal@*/
-/*@null@*/
-rpmfi XrpmfiUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmfi fi,
- /*@null@*/ const char * msg, const char * fn, unsigned ln)
- /*@modifies fi @*/;
-/*@=exportlocal@*/
+rpmfi XrpmfiUnlink (rpmfi fi,
+ const char * msg, const char * fn, unsigned ln);
#define rpmfiUnlink(_fi, _msg) XrpmfiUnlink(_fi, _msg, __FILE__, __LINE__)
/**
* @param msg
* @return new file info set reference
*/
-/*@unused@*/ /*@null@*/
-rpmfi rpmfiLink (/*@null@*/ rpmfi fi, /*@null@*/ const char * msg)
- /*@modifies fi @*/;
+rpmfi rpmfiLink (rpmfi fi, const char * msg);
/** @todo Remove debugging entry from the ABI.
* @param fi file info set
* @param ln
* @return NULL always
*/
-/*@null@*/
-rpmfi XrpmfiLink (/*@null@*/ rpmfi fi, /*@null@*/ const char * msg,
- const char * fn, unsigned ln)
- /*@modifies fi @*/;
+rpmfi XrpmfiLink (rpmfi fi, const char * msg,
+ const char * fn, unsigned ln);
#define rpmfiLink(_fi, _msg) XrpmfiLink(_fi, _msg, __FILE__, __LINE__)
/**
* @param fi file info set
* @return current file count
*/
-int rpmfiFC(/*@null@*/ rpmfi fi)
- /*@*/;
+int rpmfiFC(rpmfi fi);
/**
* Return current file index from file info set.
* @param fi file info set
* @return current file index
*/
-/*@unused@*/
-int rpmfiFX(/*@null@*/ rpmfi fi)
- /*@*/;
+int rpmfiFX(rpmfi fi);
/**
* Set current file index in file info set.
* @param fx new file index
* @return current file index
*/
-/*@unused@*/
-int rpmfiSetFX(/*@null@*/ rpmfi fi, int fx)
- /*@modifies fi @*/;
+int rpmfiSetFX(rpmfi fi, int fx);
/**
* Return directory count from file info set.
* @param fi file info set
* @return current directory count
*/
-int rpmfiDC(/*@null@*/ rpmfi fi)
- /*@*/;
+int rpmfiDC(rpmfi fi);
/**
* Return current directory index from file info set.
* @param fi file info set
* @return current directory index
*/
-int rpmfiDX(/*@null@*/ rpmfi fi)
- /*@*/;
+int rpmfiDX(rpmfi fi);
/**
* Set current directory index in file info set.
* @param dx new directory index
* @return current directory index
*/
-int rpmfiSetDX(/*@null@*/ rpmfi fi, int dx)
- /*@modifies fi @*/;
+int rpmfiSetDX(rpmfi fi, int dx);
/**
* Return current base name from file info set.
* @param fi file info set
* @return current base name, NULL on invalid
*/
-/*@observer@*/ /*@null@*/
-extern const char * rpmfiBN(/*@null@*/ rpmfi fi)
- /*@*/;
+extern const char * rpmfiBN(rpmfi fi);
/**
* Return current directory name from file info set.
* @param fi file info set
* @return current directory, NULL on invalid
*/
-/*@observer@*/ /*@null@*/
-extern const char * rpmfiDN(/*@null@*/ rpmfi fi)
- /*@*/;
+extern const char * rpmfiDN(rpmfi fi);
/**
* Return current file name from file info set.
* @param fi file info set
* @return current file name
*/
-/*@observer@*/
-extern const char * rpmfiFN(/*@null@*/ rpmfi fi)
- /*@modifies fi @*/;
+extern const char * rpmfiFN(rpmfi fi);
/**
* Return current file flags from file info set.
* @param fi file info set
* @return current file flags, 0 on invalid
*/
-uint_32 rpmfiFFlags(/*@null@*/ rpmfi fi)
- /*@*/;
+uint_32 rpmfiFFlags(rpmfi fi);
/**
* Return current file verify flags from file info set.
* @param fi file info set
* @return current file verify flags, 0 on invalid
*/
-uint_32 rpmfiVFlags(/*@null@*/ rpmfi fi)
- /*@*/;
+uint_32 rpmfiVFlags(rpmfi fi);
/**
* Return current file mode from file info set.
* @param fi file info set
* @return current file mode, 0 on invalid
*/
-int_16 rpmfiFMode(/*@null@*/ rpmfi fi)
- /*@*/;
+int_16 rpmfiFMode(rpmfi fi);
/**
* Return current file state from file info set.
* @param fi file info set
* @return current file state, 0 on invalid
*/
-rpmfileState rpmfiFState(/*@null@*/ rpmfi fi)
- /*@*/;
+rpmfileState rpmfiFState(rpmfi fi);
/**
* Return current file (binary) md5 digest from file info set.
* @param fi file info set
* @return current file md5 digest, NULL on invalid
*/
-/*@observer@*/ /*@null@*/
-extern const unsigned char * rpmfiMD5(/*@null@*/ rpmfi fi)
- /*@*/;
+extern const unsigned char * rpmfiMD5(rpmfi fi);
/**
* Return current file linkto (i.e. symlink(2) target) from file info set.
* @param fi file info set
* @return current file linkto, NULL on invalid
*/
-/*@observer@*/ /*@null@*/
-extern const char * rpmfiFLink(/*@null@*/ rpmfi fi)
- /*@*/;
+extern const char * rpmfiFLink(rpmfi fi);
/**
* Return current file size from file info set.
* @param fi file info set
* @return current file size, 0 on invalid
*/
-int_32 rpmfiFSize(/*@null@*/ rpmfi fi)
- /*@*/;
+int_32 rpmfiFSize(rpmfi fi);
/**
* Return current file rdev from file info set.
* @param fi file info set
* @return current file rdev, 0 on invalid
*/
-int_16 rpmfiFRdev(/*@null@*/ rpmfi fi)
- /*@*/;
+int_16 rpmfiFRdev(rpmfi fi);
/**
* Return current file inode from file info set.
* @param fi file info set
* @return current file inode, 0 on invalid
*/
-int_32 rpmfiFInode(/*@null@*/ rpmfi fi)
- /*@*/;
+int_32 rpmfiFInode(rpmfi fi);
/**
* Return union of all file color bits from file info set.
* @param fi file info set
* @return current color
*/
-uint_32 rpmfiColor(/*@null@*/ rpmfi fi)
- /*@*/;
+uint_32 rpmfiColor(rpmfi fi);
/**
* Return current file color bits from file info set.
* @param fi file info set
* @return current file color
*/
-uint_32 rpmfiFColor(/*@null@*/ rpmfi fi)
- /*@*/;
+uint_32 rpmfiFColor(rpmfi fi);
/**
* Return current file class from file info set.
* @param fi file info set
* @return current file class, 0 on invalid
*/
-/*@-exportlocal@*/
-/*@observer@*/ /*@null@*/
-extern const char * rpmfiFClass(/*@null@*/ rpmfi fi)
- /*@*/;
-/*@=exportlocal@*/
+extern const char * rpmfiFClass(rpmfi fi);
/**
* Return current file security context from file info set.
* @param fi file info set
* @return current file context, 0 on invalid
*/
-/*@-exportlocal@*/
-/*@observer@*/ /*@null@*/
-extern const char * rpmfiFContext(/*@null@*/ rpmfi fi)
- /*@*/;
-/*@=exportlocal@*/
+extern const char * rpmfiFContext(rpmfi fi);
/**
* Return current file depends dictionary from file info set.
* @retval *fddictp file depends dictionary array (or NULL)
* @return no. of file depends entries, 0 on invalid
*/
-int_32 rpmfiFDepends(/*@null@*/ rpmfi fi,
- /*@out@*/ /*@null@*/ const uint_32 ** fddictp)
- /*@modifies *fddictp @*/;
+int_32 rpmfiFDepends(rpmfi fi,
+ const uint_32 ** fddictp);
/**
* Return (calculated) current file nlink count from file info set.
* @param fi file info set
* @return current file nlink count, 0 on invalid
*/
-int_32 rpmfiFNlink(/*@null@*/ rpmfi fi)
- /*@*/;
+int_32 rpmfiFNlink(rpmfi fi);
/**
* Return current file modify time from file info set.
* @param fi file info set
* @return current file modify time, 0 on invalid
*/
-int_32 rpmfiFMtime(/*@null@*/ rpmfi fi)
- /*@*/;
+int_32 rpmfiFMtime(rpmfi fi);
/**
* Return current file owner from file info set.
* @param fi file info set
* @return current file owner, NULL on invalid
*/
-/*@observer@*/ /*@null@*/
-extern const char * rpmfiFUser(/*@null@*/ rpmfi fi)
- /*@*/;
+extern const char * rpmfiFUser(rpmfi fi);
/**
* Return current file group from file info set.
* @param fi file info set
* @return current file group, NULL on invalid
*/
-/*@observer@*/ /*@null@*/
-extern const char * rpmfiFGroup(/*@null@*/ rpmfi fi)
- /*@*/;
+extern const char * rpmfiFGroup(rpmfi fi);
/**
* Return next file iterator index.
* @param fi file info set
* @return file iterator index, -1 on termination
*/
-int rpmfiNext(/*@null@*/ rpmfi fi)
- /*@modifies fi @*/;
+int rpmfiNext(rpmfi fi);
/**
* Initialize file iterator index.
* @param fx file iterator index
* @return file info set
*/
-/*@null@*/
-rpmfi rpmfiInit(/*@null@*/ rpmfi fi, int fx)
- /*@modifies fi @*/;
+rpmfi rpmfiInit(rpmfi fi, int fx);
/**
* Return next directory iterator index.
* @param fi file info set
* @return directory iterator index, -1 on termination
*/
-/*@unused@*/
-int rpmfiNextD(/*@null@*/ rpmfi fi)
- /*@modifies fi @*/;
+int rpmfiNextD(rpmfi fi);
/**
* Initialize directory iterator index.
* @param dx directory iterator index
* @return file info set, NULL if dx is out of range
*/
-/*@unused@*/ /*@null@*/
-rpmfi rpmfiInitD(/*@null@*/ rpmfi fi, int dx)
- /*@modifies fi @*/;
+rpmfi rpmfiInitD(rpmfi fi, int dx);
/**
* Destroy a file info set.
* @param fi file info set
* @return NULL always
*/
-/*@null@*/
-rpmfi rpmfiFree(/*@killref@*/ /*@only@*/ /*@null@*/ rpmfi fi)
- /*@globals fileSystem @*/
- /*@modifies fi, fileSystem @*/;
+rpmfi rpmfiFree(rpmfi fi);
/**
* Create and load a file info set.
* @param scareMem Use pointers to refcounted header memory?
* @return new file info set
*/
-/*@null@*/
-rpmfi rpmfiNew(/*@null@*/ const rpmts ts, Header h, rpmTag tagN, int scareMem)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem @*/
- /*@modifies ts, h, rpmGlobalMacroContext, fileSystem @*/;
+rpmfi rpmfiNew(const rpmts ts, Header h, rpmTag tagN, int scareMem);
/**
* Retrieve file classes from header.
* @retval *fcp number of files
*/
void rpmfiBuildFClasses(Header h,
- /*@out@*/ const char *** fclassp, /*@out@*/ int * fcp)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem @*/
- /*@modifies h, *fclassp, *fcp, rpmGlobalMacroContext, fileSystem @*/;
+ const char *** fclassp, int * fcp);
/**
* @retval *fcp number of files
*/
void rpmfiBuildFDeps(Header h, rpmTag tagN,
- /*@out@*/ const char *** fdepsp, /*@out@*/ int * fcp)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies h, *fdepsp, *fcp,
- rpmGlobalMacroContext, fileSystem, internalState @*/;
+ const char *** fdepsp, int * fcp);
/**
* Return file type from mode_t.
* @param mode file mode bits (from header)
* @return file type
*/
-fileTypes whatis(uint_16 mode)
- /*@*/;
+fileTypes whatis(uint_16 mode);
/**
* Return file info comparison.
* @param bfi 2nd file info
* @return 0 if identical
*/
-int rpmfiCompare(const rpmfi afi, const rpmfi bfi)
- /*@*/;
+int rpmfiCompare(const rpmfi afi, const rpmfi bfi);
/**
* Return file disposition.
* @param skipMissing OK to skip missing files?
* @return file dispostion
*/
-fileAction rpmfiDecideFate(const rpmfi ofi, rpmfi nfi, int skipMissing)
- /*@globals h_errno, fileSystem, internalState @*/
- /*@modifies nfi, fileSystem, internalState @*/;
+fileAction rpmfiDecideFate(const rpmfi ofi, rpmfi nfi, int skipMissing);
/**
* Return whether file is conflicting config
* @param fi file info
* @return 1 if config file and file on disk conflicts
*/
-int rpmfiConfigConflict(const rpmfi fi)
- /*@*/;
+int rpmfiConfigConflict(const rpmfi fi);
/**
* Return formatted string representation of package disposition.
* @param fi file info set
* @return formatted string
*/
-/*@-redef@*/
-/*@observer@*/
-const char * rpmfiTypeString(rpmfi fi)
- /*@*/;
-/*@=redef@*/
+const char * rpmfiTypeString(rpmfi fi);
#ifdef __cplusplus
}
-/*@-modfilesys@*/
/** \ingroup rpmio
* \file rpmio/rpmio.c
*/
#include "debug.h"
-/*@access fnpyKey @*/
-/*@access rpmdbMatchIterator @*/
-/*@access rpmts @*/
-/*@access rpmps @*/
-/*@unchecked@*/
int _rpmgi_debug = 0;
-/*@unchecked@*/
rpmgiFlags giFlags = RPMGI_NONE;
-/*@unchecked@*/
static int indent = 2;
-/*@unchecked@*/ /*@observer@*/
static const char * ftsInfoStrings[] = {
"UNKNOWN",
"D",
"W",
};
-/*@observer@*/
static const char * ftsInfoStr(int fts_info)
- /*@*/
{
if (!(fts_info >= 1 && fts_info <= 14))
fts_info = 0;
-/*@-compmempass@*/
return ftsInfoStrings[ fts_info ];
-/*@=compmempass@*/
}
/**
* @param fmode open mode
* @return file handle
*/
-/*@null@*/
static FD_t rpmgiOpen(const char * path, const char * fmode)
- /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
- /*@modifies rpmGlobalMacroContext, h_errno, internalState @*/
{
const char * fn = rpmExpand(path, NULL);
FD_t fd = Fopen(fn, fmode);
* @return RPMRC_OK on success
*/
static rpmRC rpmgiLoadManifest(rpmgi gi, const char * path)
- /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
- /*@modifies gi, rpmGlobalMacroContext, h_errno, internalState @*/
{
FD_t fd = rpmgiOpen(path, "r.ufdio");
rpmRC rpmrc = RPMRC_FAIL;
* @param path file path
* @return header (NULL on failure)
*/
-/*@null@*/
static Header rpmgiReadHeader(rpmgi gi, const char * path)
- /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
- /*@modifies gi, rpmGlobalMacroContext, h_errno, internalState @*/
{
FD_t fd = rpmgiOpen(path, "r.ufdio");
Header h = NULL;
* @param gi generalized iterator
* @return RPMRC_OK on success
*/
-/*@null@*/
static rpmRC rpmgiLoadReadHeader(rpmgi gi)
- /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
- /*@modifies gi, rpmGlobalMacroContext, h_errno, internalState @*/
{
rpmRC rpmrc = RPMRC_NOTFOUND;
Header h = NULL;
* @param gi generalized iterator
* @return RPMRC_OK on success
*/
-/*@null@*/
static rpmRC rpmgiWalkPathFilter(rpmgi gi)
- /*@*/
{
FTSENT * fts = gi->fts;
rpmRC rpmrc = RPMRC_NOTFOUND;
* @param gi generalized iterator
* @return RPMRC_OK on success
*/
-/*@null@*/
static rpmRC rpmgiWalkReadHeader(rpmgi gi)
- /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
- /*@modifies gi, rpmGlobalMacroContext, h_errno, internalState @*/
{
rpmRC rpmrc = RPMRC_NOTFOUND;
* @param argv arg list to be globbed (or NULL)
* @returns RPMRC_OK on success
*/
-static rpmRC rpmgiGlobArgv(rpmgi gi, /*@null@*/ ARGV_t argv)
- /*@globals internalState @*/
- /*@modifies gi, internalState @*/
+static rpmRC rpmgiGlobArgv(rpmgi gi, ARGV_t argv)
{
const char * arg;
rpmRC rpmrc = RPMRC_OK;
if (argv != NULL) {
while (argv[ac] != NULL)
ac++;
-/*@-nullstate@*/ /* XXX argv is not NULL */
+/* XXX argv is not NULL */
xx = argvAppend(&gi->argv, argv);
-/*@=nullstate@*/
}
gi->argc = ac;
return rpmrc;
* @returns RPMRC_OK on success
*/
static rpmRC rpmgiInitFilter(rpmgi gi)
- /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
- /*@modifies gi, rpmGlobalMacroContext, h_errno, internalState @*/
{
rpmRC rpmrc = RPMRC_OK;
ARGV_t av;
tag = RPMTAG_NAME;
/* Parse for "tag=pattern" args. */
-/*@-branchstate@*/
if ((ae = strchr(a, '=')) != NULL) {
*ae++ = '\0';
tag = tagValue(a);
}
pat = ae;
}
-/*@=branchstate@*/
if (!res) {
if (_rpmgi_debug < 0)
if (_rpmgi_debug && msg != NULL)
fprintf(stderr, "--> gi %p ++ %d %s at %s:%u\n", gi, gi->nrefs, msg, fn, ln);
- /*@-refcounttrans@*/ return gi; /*@=refcounttrans@*/
+ return gi;
}
rpmgi rpmgiFree(rpmgi gi)
(void) rpmgiUnlink(gi, __FUNCTION__);
-/*@-usereleased@*/
gi->hdrPath = _free(gi->hdrPath);
gi->h = headerFree(gi->h);
gi->ts = rpmtsFree(gi->ts);
memset(gi, 0, sizeof(*gi)); /* XXX trash and burn */
-/*@-refcounttrans@*/
gi = _free(gi);
-/*@=refcounttrans@*/
-/*@=usereleased@*/
return NULL;
}
gi->ts = rpmtsLink(ts, __FUNCTION__);
gi->tag = tag;
-/*@-assignexpose@*/
gi->keyp = keyp;
-/*@=assignexpose@*/
gi->keylen = keylen;
gi->flags = 0;
return gi;
}
-rpmRC rpmgiNext(/*@null@*/ rpmgi gi)
+rpmRC rpmgiNext(rpmgi gi)
{
char hnum[32];
rpmRC rpmrc = RPMRC_NOTFOUND;
gi->hdrPath = _free(gi->hdrPath);
hnum[0] = '\0';
-/*@-branchstate@*/
if (++gi->i >= 0)
switch (gi->tag) {
default:
gi->hdrPath = xstrdup(gi->fts->fts_path);
break;
}
-/*@=branchstate@*/
if ((gi->flags & RPMGI_TSADD) && gi->h != NULL) {
/* XXX rpmgi hack: Save header in transaction element. */
if (rpmIsVerbose())
rpmpsPrint(NULL, ps);
-/*@-branchstate@*/
if (ts->suggests != NULL && ts->nsuggests > 0) {
rpmMessage(RPMMESS_VERBOSE, _(" Suggested resolutions:\n"));
for (i = 0; i < ts->nsuggests; i++) {
}
ts->suggests = _free(ts->suggests);
}
-/*@=branchstate@*/
}
ps = rpmpsFree(ps);
Header rpmgiHeader(rpmgi gi)
{
-/*@-compdef -refcounttrans -retexpose -usereleased@*/
return (gi != NULL ? gi->h : NULL);
-/*@=compdef =refcounttrans =retexpose =usereleased@*/
}
rpmts rpmgiTs(rpmgi gi)
{
-/*@-compdef -refcounttrans -retexpose -usereleased@*/
return (gi != NULL ? gi->ts : NULL);
-/*@=compdef =refcounttrans =retexpose =usereleased@*/
}
rpmRC rpmgiSetArgs(rpmgi gi, ARGV_t argv, int ftsOpts, rpmgiFlags flags)
return rpmgiGlobArgv(gi, argv);
}
-/*@=modfilesys@*/
/**
*/
-/*@-exportlocal@*/
-/*@unchecked@*/
extern int _rpmgi_debug;
-/*@=exportlocal@*/
/**
*/
RPMGI_NOHEADER = (1 << 4)
} rpmgiFlags;
-/*@unchecked@*/
extern rpmgiFlags giFlags;
#if defined(_RPMGI_INTERNAL)
/** \ingroup rpmio
*/
struct rpmgi_s {
-/*@refcounted@*/
rpmts ts; /*!< Iterator transaction set. */
int tag; /*!< Iterator type. */
-/*@kept@*/ /*@relnull@*/
const void * keyp; /*!< Iterator key. */
size_t keylen; /*!< Iterator key length. */
rpmgiFlags flags; /*!< Iterator control bits. */
int active; /*!< Iterator is active? */
int i; /*!< Element index. */
-/*@null@*/
const char * hdrPath; /*!< Path to current iterator header. */
-/*@refcounted@*/ /*@null@*/
Header h; /*!< Current iterator header. */
-/*@null@*/
rpmtsi tsi;
-/*@null@*/
rpmdbMatchIterator mi;
-/*@refcounted@*/
FD_t fd;
ARGV_t argv;
int argc;
int ftsOpts;
-/*@null@*/
FTS * ftsp;
-/*@relnull@*/
FTSENT * fts;
-/*@refs@*/
int nrefs; /*!< Reference count. */
};
#endif
* @param msg
* @return NULL always
*/
-/*@unused@*/ /*@null@*/
-rpmgi rpmgiUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmgi gi,
- /*@null@*/ const char * msg)
- /*@modifies gi @*/;
+rpmgi rpmgiUnlink (rpmgi gi,
+ const char * msg);
/** @todo Remove debugging entry from the ABI. */
-/*@-exportlocal@*/
-/*@null@*/
-rpmgi XrpmgiUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmgi gi,
- /*@null@*/ const char * msg, const char * fn, unsigned ln)
- /*@modifies gi @*/;
-/*@=exportlocal@*/
+rpmgi XrpmgiUnlink (rpmgi gi,
+ const char * msg, const char * fn, unsigned ln);
#define rpmgiUnlink(_gi, _msg) XrpmgiUnlink(_gi, _msg, __FILE__, __LINE__)
/**
* @param msg
* @return new generalized iterator reference
*/
-/*@unused@*/ /*@newref@*/ /*@null@*/
-rpmgi rpmgiLink (/*@null@*/ rpmgi gi, /*@null@*/ const char * msg)
- /*@modifies gi @*/;
+rpmgi rpmgiLink (rpmgi gi, const char * msg);
/** @todo Remove debugging entry from the ABI. */
-/*@newref@*/ /*@null@*/
-rpmgi XrpmgiLink (/*@null@*/ rpmgi gi, /*@null@*/ const char * msg,
- const char * fn, unsigned ln)
- /*@modifies gi @*/;
+rpmgi XrpmgiLink (rpmgi gi, const char * msg,
+ const char * fn, unsigned ln);
#define rpmgiLink(_gi, _msg) XrpmgiLink(_gi, _msg, __FILE__, __LINE__)
/** Destroy a generalized iterator.
* @param gi generalized iterator
* @return NULL always
*/
-/*@null@*/
-rpmgi rpmgiFree(/*@killref@*/ /*@only@*/ /*@null@*/ rpmgi gi)
- /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
- /*@modifies gi, rpmGlobalMacroContext, h_errno, internalState @*/;
+rpmgi rpmgiFree(rpmgi gi);
/**
* Return a generalized iterator.
* @param keylen key data length (0 will use strlen(keyp))
* @return new iterator
*/
-/*@null@*/
-rpmgi rpmgiNew(rpmts ts, int tag, /*@kept@*/ /*@null@*/ const void * keyp,
- size_t keylen)
- /*@globals internalState @*/
- /*@modifies ts, internalState @*/;
+rpmgi rpmgiNew(rpmts ts, int tag, const void * keyp,
+ size_t keylen);
/**
* Perform next iteration step.
* @param gi generalized iterator
* @returns RPMRC_OK on success, RPMRC_NOTFOUND on EOI
*/
-rpmRC rpmgiNext(/*@null@*/ rpmgi gi)
- /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
- /*@modifies gi, rpmGlobalMacroContext, h_errno, internalState @*/;
+rpmRC rpmgiNext(rpmgi gi);
/**
* Return current header path.
* @param gi generalized iterator
* @returns header path
*/
-/*@observer@*/ /*@null@*/
-const char * rpmgiHdrPath(rpmgi gi)
- /*@*/;
+const char * rpmgiHdrPath(rpmgi gi);
/**
* Return current iteration header.
* @param gi generalized iterator
* @returns header
*/
-/*@null@*/
-Header rpmgiHeader(/*@null@*/ rpmgi gi)
- /*@*/;
+Header rpmgiHeader(rpmgi gi);
/**
* Return current iteration transaction set.
* @param gi generalized iterator
* @returns transaction set
*/
-/*@null@*/
-rpmts rpmgiTs(/*@null@*/ rpmgi gi)
- /*@*/;
+rpmts rpmgiTs(rpmgi gi);
/**
* Load iterator args.
* @param flags iterator flags
* @returns RPMRC_OK on success
*/
-rpmRC rpmgiSetArgs(rpmgi gi, /*@null@*/ ARGV_t argv,
- int ftsOpts, rpmgiFlags flags)
- /*@globals internalState @*/
- /*@modifies gi, internalState @*/;
+rpmRC rpmgiSetArgs(rpmgi gi, ARGV_t argv,
+ int ftsOpts, rpmgiFlags flags);
#ifdef __cplusplus
}
#include "manifest.h"
#include "debug.h"
-/*@access rpmts @*/ /* XXX ts->goal, ts->dbmode */
-/*@access IDTX @*/
-/*@access IDT @*/
-
-/*@unchecked@*/
int rpmcliPackagesTotal = 0;
-/*@unchecked@*/
int rpmcliHashesCurrent = 0;
-/*@unchecked@*/
int rpmcliHashesTotal = 0;
-/*@unchecked@*/
int rpmcliProgressCurrent = 0;
-/*@unchecked@*/
int rpmcliProgressTotal = 0;
/**
* @param total final
*/
static void printHash(const unsigned long amount, const unsigned long total)
- /*@globals rpmcliHashesCurrent, rpmcliHashesTotal,
- rpmcliProgressCurrent, fileSystem @*/
- /*@modifies rpmcliHashesCurrent, rpmcliHashesTotal,
- rpmcliProgressCurrent, fileSystem @*/
{
int hashesNeeded;
rpmcliHashesTotal = (isatty (STDOUT_FILENO) ? 44 : 50);
if (rpmcliHashesCurrent != rpmcliHashesTotal) {
-/*@+relaxtypes@*/
float pct = (total ? (((float) amount) / total) : 1.0);
hashesNeeded = (rpmcliHashesTotal * pct) + 0.5;
-/*@=relaxtypes@*/
while (hashesNeeded > rpmcliHashesCurrent) {
if (isatty (STDOUT_FILENO)) {
int i;
if (isatty(STDOUT_FILENO)) {
for (i = 1; i < rpmcliHashesCurrent; i++)
(void) putchar ('#');
-/*@+relaxtypes@*/
pct = (rpmcliProgressTotal
? (((float) rpmcliProgressCurrent) / rpmcliProgressTotal)
: 1);
-/*@=relaxtypes@*/
fprintf(stdout, " [%3d%%]", (int)((100 * pct) + 0.5));
}
fprintf(stdout, "\n");
}
}
-void * rpmShowProgress(/*@null@*/ const void * arg,
+void * rpmShowProgress(const void * arg,
const rpmCallbackType what,
const unsigned long amount,
const unsigned long total,
- /*@null@*/ fnpyKey key,
- /*@null@*/ void * data)
- /*@globals rpmcliHashesCurrent, rpmcliProgressCurrent, rpmcliProgressTotal,
- fileSystem @*/
- /*@modifies rpmcliHashesCurrent, rpmcliProgressCurrent, rpmcliProgressTotal,
- fileSystem @*/
+ fnpyKey key,
+ void * data)
{
-/*@-abstract -castexpose @*/
Header h = (Header) arg;
-/*@=abstract =castexpose @*/
char * s;
int flags = (int) ((long)data);
void * rc = NULL;
-/*@-abstract -assignexpose @*/
const char * filename = (const char *)key;
-/*@=abstract =assignexpose @*/
static FD_t fd = NULL;
int xx;
switch (what) {
case RPMCALLBACK_INST_OPEN_FILE:
-/*@-boundsread@*/
if (filename == NULL || filename[0] == '\0')
return NULL;
-/*@=boundsread@*/
fd = Fopen(filename, "r.ufdio");
- /*@-type@*/ /* FIX: still necessary? */
+ /* FIX: still necessary? */
if (fd == NULL || Ferror(fd)) {
rpmError(RPMERR_OPEN, _("open of %s failed: %s\n"), filename,
Fstrerror(fd));
}
} else
fd = fdLink(fd, "persist (showProgress)");
- /*@=type@*/
-/*@+voidabstract@*/
return (void *)fd;
-/*@=voidabstract@*/
- /*@notreached@*/ break;
+ break;
case RPMCALLBACK_INST_CLOSE_FILE:
- /*@-type@*/ /* FIX: still necessary? */
+ /* FIX: still necessary? */
fd = fdFree(fd, "persist (showProgress)");
- /*@=type@*/
if (fd != NULL) {
xx = Fclose(fd);
fd = NULL;
case RPMCALLBACK_TRANS_PROGRESS:
case RPMCALLBACK_INST_PROGRESS:
-/*@+relaxtypes@*/
if (flags & INSTALL_PERCENT)
fprintf(stdout, "%%%% %f\n", (double) (total
? ((((float) amount) / total) * 100)
: 100.0));
else if (flags & INSTALL_HASH)
printHash(amount, total);
-/*@=relaxtypes@*/
(void) fflush(stdout);
break;
return rc;
}
-typedef /*@only@*/ /*@null@*/ const char * str_t;
+typedef const char * str_t;
struct rpmEIU {
Header h;
FD_t fd;
int numFailed;
int numPkgs;
-/*@only@*/
str_t * pkgURL;
-/*@dependent@*/ /*@null@*/
str_t * fnp;
-/*@only@*/
char * pkgState;
int prevx;
int pkgx;
int numRPMS;
int numSRPMS;
-/*@only@*/ /*@null@*/
str_t * sourceURL;
int isSource;
int argc;
-/*@only@*/ /*@null@*/
str_t * argv;
-/*@dependent@*/
rpmRelocation * relocations;
rpmRC rpmrc;
};
/** @todo Generalize --freshen policies. */
-/*@-bounds@*/
int rpmInstall(rpmts ts,
struct rpmInstallArguments_s * ia,
const char ** fileArgv)
rpmps ps;
rpmprobFilterFlags probFilter;
rpmRelocation * relocations;
-/*@only@*/ /*@null@*/ const char * fileURL = NULL;
+const char * fileURL = NULL;
int stopInstall = 0;
const char ** av = NULL;
rpmVSFlags vsflags, ovsflags, tvsflags;
}
/* Build fully globbed list of arguments in argv[argc]. */
- /*@-branchstate@*/
- /*@-temptrans@*/
for (eiu->fnp = fileArgv; *eiu->fnp != NULL; eiu->fnp++) {
- /*@=temptrans@*/
av = _free(av); ac = 0;
rc = rpmGlob(*eiu->fnp, &ac, &av);
if (rc || ac == 0) {
eiu->argc += ac;
eiu->argv[eiu->argc] = NULL;
}
- /*@=branchstate@*/
av = _free(av); ac = 0;
restart:
eiu->numFailed++;
eiu->pkgURL[eiu->pkgx] = NULL;
tfn = _free(tfn);
- /*@switchbreak@*/ break;
+ break;
}
eiu->pkgState[eiu->pkgx] = 1;
eiu->pkgURL[eiu->pkgx] = tfn;
eiu->pkgx++;
- } /*@switchbreak@*/ break;
+ } break;
case URL_IS_PATH:
case URL_IS_DASH: /* WRONG WRONG WRONG */
case URL_IS_HKP: /* WRONG WRONG WRONG */
eiu->pkgURL[eiu->pkgx] = fileURL;
fileURL = NULL;
eiu->pkgx++;
- /*@switchbreak@*/ break;
+ break;
}
}
fileURL = _free(fileURL);
rpmMessage(RPMMESS_ERROR, _("%s cannot be installed\n"), *eiu->fnp);
eiu->numFailed++; *eiu->fnp = NULL;
continue;
- /*@notreached@*/ /*@switchbreak@*/ break;
+ break;
case RPMRC_NOTFOUND:
goto maybe_manifest;
- /*@notreached@*/ /*@switchbreak@*/ break;
+ break;
case RPMRC_NOTTRUSTED:
case RPMRC_NOKEY:
case RPMRC_OK:
default:
- /*@switchbreak@*/ break;
+ break;
}
eiu->isSource = headerIsEntry(eiu->h, RPMTAG_SOURCEPACKAGE);
_("package %s is not relocatable\n"), name);
eiu->numFailed++;
goto exit;
- /*@notreached@*/
}
}
count = rpmdbGetIteratorCount(mi);
while ((oldH = rpmdbNextIterator(mi)) != NULL) {
if (rpmVersionCompare(oldH, eiu->h) < 0)
- /*@innercontinue@*/ continue;
+ continue;
/* same or newer package already installed */
count = 0;
- /*@innerbreak@*/ break;
+ break;
}
mi = rpmdbFreeIterator(mi);
if (count == 0) {
/* Package is newer than those currently installed. */
}
- /*@-abstract@*/
rc = rpmtsAddInstallElement(ts, eiu->h, (fnpyKey)fileName,
(ia->installInterfaceFlags & INSTALL_UPGRADE) != 0,
relocations);
- /*@=abstract@*/
/* XXX reference held by transaction set */
eiu->h = headerFree(eiu->h);
case 0:
rpmMessage(RPMMESS_DEBUG, _("\tadded binary package [%d]\n"),
eiu->numRPMS);
- /*@switchbreak@*/ break;
+ break;
case 1:
rpmMessage(RPMMESS_ERROR,
_("error reading from file %s\n"), *eiu->fnp);
eiu->numFailed++;
goto exit;
- /*@notreached@*/ /*@switchbreak@*/ break;
+ break;
case 2:
rpmMessage(RPMMESS_ERROR,
_("file %s requires a newer version of RPM\n"),
*eiu->fnp);
eiu->numFailed++;
goto exit;
- /*@notreached@*/ /*@switchbreak@*/ break;
+ break;
default:
eiu->numFailed++;
goto exit;
- /*@notreached@*/ /*@switchbreak@*/ break;
+ break;
}
eiu->numRPMS++;
}
/* Read list of packages from manifest. */
-/*@-nullstate@*/ /* FIX: *eiu->argv can be NULL */
+/* FIX: *eiu->argv can be NULL */
rc = rpmReadPackageManifest(eiu->fd, &eiu->argc, &eiu->argv);
-/*@=nullstate@*/
if (rc != RPMRC_OK)
rpmError(RPMERR_MANIFEST, _("%s: not an rpm package (or package manifest): %s\n"),
*eiu->fnp, Fstrerror(eiu->fd));
eiu->numFailed = eiu->numPkgs;
stopInstall = 1;
- /*@-branchstate@*/
if (ts->suggests != NULL && ts->nsuggests > 0) {
rpmMessage(RPMMESS_NORMAL, _(" Suggested resolutions:\n"));
for (i = 0; i < ts->nsuggests; i++) {
}
ts->suggests = _free(ts->suggests);
}
- /*@=branchstate@*/
}
ps = rpmpsFree(ps);
}
return eiu->numFailed;
}
-/*@=bounds@*/
int rpmErase(rpmts ts, struct rpmInstallArguments_s * ia,
const char ** argv)
rpmMessage(RPMMESS_ERROR, _("\"%s\" specifies multiple packages\n"),
*arg);
numFailed++;
- /*@innerbreak@*/ break;
+ break;
}
if (recOffset) {
(void) rpmtsAddEraseElement(ts, h, recOffset);
}
if (rc != 0) {
rpmMessage(RPMMESS_ERROR, _("%s cannot be installed\n"), arg);
- /*@-unqualifiedtrans@*/
if (specFilePtr && *specFilePtr)
*specFilePtr = _free(*specFilePtr);
if (cookie && *cookie)
*cookie = _free(*cookie);
- /*@=unqualifiedtrans@*/
}
(void) Fclose(fd);
rpmMessage(RPMMESS_DEBUG, "\t+++ install %s\n",
(rp->key ? rp->key : "???"));
-/*@-abstract@*/
rc = rpmtsAddInstallElement(ts, rp->h, (fnpyKey)rp->key,
0, ia->relocations);
-/*@=abstract@*/
if (rc != 0)
goto exit;
for (i = 0; i < rtids->nidt; i++) {
IDT rrp = rtids->idt + i;
if (rrp->val.u32 != thistid)
- /*@innercontinue@*/ continue;
+ continue;
if (rrp->key) { /* XXX can't happen */
rpmMessage(RPMMESS_NORMAL, _("\tRemoving %s:\n"), rrp->key);
(void) unlink(rrp->key); /* XXX: Should check rc??? */
#include "rpmlead.h"
#include "debug.h"
-/*@unchecked@*/ /*@observer@*/
static unsigned char lead_magic[] = {
RPMLEAD_MAGIC0, RPMLEAD_MAGIC1, RPMLEAD_MAGIC2, RPMLEAD_MAGIC3
};
{
struct rpmlead l;
-/*@-boundswrite@*/
memcpy(&l, lead, sizeof(l));
memcpy(&l.magic, lead_magic, sizeof(l.magic));
-/*@=boundswrite@*/
l.type = htons(l.type);
l.archnum = htons(l.archnum);
l.osnum = htons(l.osnum);
l.signature_type = htons(l.signature_type);
-/*@-boundswrite@*/
if (Fwrite(&l, 1, sizeof(l), fd) != sizeof(l))
return RPMRC_FAIL;
-/*@=boundswrite@*/
return RPMRC_OK;
}
rpmRC readLead(FD_t fd, struct rpmlead *lead)
{
-/*@-boundswrite@*/
memset(lead, 0, sizeof(*lead));
-/*@=boundswrite@*/
- /*@-type@*/ /* FIX: remove timed read */
+ /* FIX: remove timed read */
if (timedRead(fd, (char *)lead, sizeof(*lead)) != sizeof(*lead)) {
if (Ferror(fd)) {
rpmError(RPMERR_READ, _("read failed: %s (%d)\n"),
}
return RPMRC_NOTFOUND;
}
- /*@=type@*/
if (memcmp(lead->magic, lead_magic, sizeof(lead_magic)))
return RPMRC_NOTFOUND;
* @param lead package lead
* @return RPMRC_OK on success, RPMRC_FAIL on error
*/
-rpmRC writeLead(FD_t fd, const struct rpmlead *lead)
- /*@globals fileSystem @*/
- /*@modifies fd, fileSystem @*/;
+rpmRC writeLead(FD_t fd, const struct rpmlead *lead);
/** \ingroup lead
* Read lead from file handle.
* @retval lead package lead
* @return RPMRC_OK on success, RPMRC_FAIL/RPMRC_NOTFOUND on error
*/
-rpmRC readLead(FD_t fd, /*@out@*/ struct rpmlead *lead)
- /*@modifies fd, *lead @*/;
+rpmRC readLead(FD_t fd, struct rpmlead *lead);
#ifdef __cplusplus
}
RPMRC_NOKEY = 4 /*!< Public key is unavailable. */
} rpmRC;
-/*@-redecl@*/
-/*@checked@*/
extern struct MacroContext_s * rpmGlobalMacroContext;
-/*@checked@*/
extern struct MacroContext_s * rpmCLIMacroContext;
-/*@unchecked@*/ /*@observer@*/
extern const char * RPMVERSION;
-/*@unchecked@*/ /*@observer@*/
extern const char * rpmNAME;
-/*@unchecked@*/ /*@observer@*/
extern const char * rpmEVR;
-/*@unchecked@*/
extern int rpmFLAGS;
-/*@=redecl@*/
#ifdef __cplusplus
extern "C" {
* @param p memory to free
* @return NULL always
*/
-/*@unused@*/ static inline /*@null@*/
-void * _free(/*@only@*/ /*@null@*/ /*@out@*/ const void * p)
- /*@modifies p @*/
+static inline
+void * _free(const void * p)
{
if (p != NULL) free((void *)p);
return NULL;
* sets to reduce errors. In general, installs/upgrades are done before
* strict removals, and prerequisite ordering is done on installs/upgrades.
*/
-typedef /*@abstract@*/ /*@refcounted@*/ struct rpmts_s * rpmts;
+typedef struct rpmts_s * rpmts;
/** \ingroup rpmbuild
*/
/** \ingroup rpmtrans
* An added/available package retrieval key.
*/
-typedef /*@abstract@*/ void * alKey;
+typedef void * alKey;
#define RPMAL_NOMATCH ((alKey)-1L)
/** \ingroup rpmtrans
* An added/available package retrieval index.
*/
-/*@-mutrep@*/
-typedef /*@abstract@*/ intptr_t alNum;
-/*@=mutrep@*/
+typedef intptr_t alNum;
/** \ingroup rpmtrans
* Dependency tag sets from a header, so that a header can be discarded early.
*/
-typedef /*@abstract@*/ /*@refcounted@*/ struct rpmds_s * rpmds;
+typedef struct rpmds_s * rpmds;
/** \ingroup rpmtrans
* File info tag sets from a header, so that a header can be discarded early.
*/
-typedef /*@abstract@*/ /*@refcounted@*/ struct rpmfi_s * rpmfi;
+typedef struct rpmfi_s * rpmfi;
/** \ingroup rpmtrans
* An element of a transaction set, i.e. a TR_ADDED or TR_REMOVED package.
*/
-typedef /*@abstract@*/ struct rpmte_s * rpmte;
+typedef struct rpmte_s * rpmte;
/** \ingroup rpmdb
* Database of headers and tag value indices.
*/
-typedef /*@abstract@*/ /*@refcounted@*/ struct rpmdb_s * rpmdb;
+typedef struct rpmdb_s * rpmdb;
/** \ingroup rpmdb
* Database iterator.
*/
-typedef /*@abstract@*/ struct _rpmdbMatchIterator * rpmdbMatchIterator;
+typedef struct _rpmdbMatchIterator * rpmdbMatchIterator;
/** \ingroup rpmcli
* Generalized iterator.
*/
-typedef /*@abstract@*/ /*@refcounted@*/ struct rpmgi_s * rpmgi;
+typedef struct rpmgi_s * rpmgi;
/** \ingroup header
* Return name, version, release strings from header.
* @return 0 always
*/
int headerNVR(Header h,
- /*@null@*/ /*@out@*/ const char ** np,
- /*@null@*/ /*@out@*/ const char ** vp,
- /*@null@*/ /*@out@*/ const char ** rp)
- /*@modifies *np, *vp, *rp @*/;
+ const char ** np,
+ const char ** vp,
+ const char ** rp);
/** \ingroup header
* Return name, epoch, version, release, arch strings from header.
* @return 0 always
*/
int headerNEVRA(Header h,
- /*@null@*/ /*@out@*/ const char ** np,
- /*@null@*/ /*@out@*/ /*@unused@*/ const char ** ep,
- /*@null@*/ /*@out@*/ const char ** vp,
- /*@null@*/ /*@out@*/ const char ** rp,
- /*@null@*/ /*@out@*/ const char ** ap)
- /*@modifies *np, *vp, *rp, *ap @*/;
+ const char ** np,
+ const char ** ep,
+ const char ** vp,
+ const char ** rp,
+ const char ** ap);
/** \ingroup header
* Translate and merge legacy signature tags into header.
* @param h header
* @param sigh signature header
*/
-void headerMergeLegacySigs(Header h, const Header sigh)
- /*@modifies h, sigh @*/;
+void headerMergeLegacySigs(Header h, const Header sigh);
/** \ingroup header
* Regenerate signature header.
* @param noArchiveSize don't copy archive size tag (pre rpm-4.1)
* @return regenerated signature header
*/
-Header headerRegenSigHeader(const Header h, int noArchiveSize)
- /*@modifies h @*/;
+Header headerRegenSigHeader(const Header h, int noArchiveSize);
/** \ingroup header
* Retrieve tag info from header.
* @retval c address of number of values
* @return 0 on success, 1 on bad magic, 2 on error
*/
-/*@unused@*/
-int rpmHeaderGetEntry(Header h, int_32 tag, /*@out@*/ int_32 *type,
- /*@out@*/ void **p, /*@out@*/ int_32 *c)
- /*@modifies *type, *p, *c @*/;
+int rpmHeaderGetEntry(Header h, int_32 tag, int_32 *type,
+ void **p, int_32 *c);
/**
* Automatically generated table of tag name/value pairs.
*/
-/*@-redecl@*/
-/*@observer@*/ /*@unchecked@*/
extern const struct headerTagTableEntry_s * rpmTagTable;
-/*@=redecl@*/
/**
* Number of entries in rpmTagTable.
*/
-/*@-redecl@*/
-/*@unchecked@*/
extern const int rpmTagTableSize;
-/*@=redecl@*/
-/*@unchecked@*/
extern headerTagIndices rpmTags;
/**
* Table of query format extensions.
* @note Chains to headerDefaultFormats[].
*/
-/*@-redecl@*/
-/*@unchecked@*/
extern const struct headerSprintfExtension_s rpmHeaderFormats[];
-/*@=redecl@*/
/**
* Pseudo-tags used by the rpmdb and rpmgi iterator API's.
RPMTAG_HEADERIMAGE = HEADER_IMAGE, /*!< Current image. */
RPMTAG_HEADERSIGNATURES = HEADER_SIGNATURES, /*!< Signatures. */
RPMTAG_HEADERIMMUTABLE = HEADER_IMMUTABLE, /*!< Original image. */
-/*@-enummemuse@*/
RPMTAG_HEADERREGIONS = HEADER_REGIONS, /*!< Regions. */
RPMTAG_HEADERI18NTABLE = HEADER_I18NTABLE, /*!< I18N string locales. */
-/*@=enummemuse@*/
/* Retrofit (and uniqify) signature tags for use by tagName() and rpmQuery. */
/* the md5 sum was broken *twice* on big endian machines */
RPMTAG_LICENSE = 1014, /* s */
RPMTAG_PACKAGER = 1015, /* s */
RPMTAG_GROUP = 1016, /* s{} */
-/*@-enummemuse@*/
RPMTAG_CHANGELOG = 1017, /* s[] internal */
-/*@=enummemuse@*/
RPMTAG_SOURCE = 1018, /* s[] */
RPMTAG_PATCH = 1019, /* s[] */
RPMTAG_URL = 1020, /* s */
#define RPMTAG_FILEMD5S RPMTAG_FILEDIGESTS /* s[] */
RPMTAG_FILELINKTOS = 1036, /* s[] */
RPMTAG_FILEFLAGS = 1037, /* i[] */
-/*@-enummemuse@*/
RPMTAG_ROOT = 1038, /* internal - obsolete */
-/*@=enummemuse@*/
RPMTAG_FILEUSERNAME = 1039, /* s[] */
RPMTAG_FILEGROUPNAME = 1040, /* s[] */
-/*@-enummemuse@*/
RPMTAG_EXCLUDE = 1041, /* internal - obsolete */
RPMTAG_EXCLUSIVE = 1042, /* internal - obsolete */
-/*@=enummemuse@*/
RPMTAG_ICON = 1043, /* x */
RPMTAG_SOURCERPM = 1044, /* s */
RPMTAG_FILEVERIFYFLAGS = 1045, /* i[] */
RPMTAG_CHANGELOGTIME = 1080, /* i[] */
RPMTAG_CHANGELOGNAME = 1081, /* s[] */
RPMTAG_CHANGELOGTEXT = 1082, /* s[] */
-/*@-enummemuse@*/
RPMTAG_BROKENMD5 = 1083, /* internal - obsolete */
-/*@=enummemuse@*/
RPMTAG_PREREQ = 1084, /* internal */
RPMTAG_PREINPROG = 1085, /* s */
RPMTAG_POSTINPROG = 1086, /* s */
RPMTAG_TRIGGERPOSTUN = 1102, /* internal */
RPMTAG_AUTOREQ = 1103, /* internal */
RPMTAG_AUTOPROV = 1104, /* internal */
-/*@-enummemuse@*/
RPMTAG_CAPABILITY = 1105, /* i legacy - obsolete */
-/*@=enummemuse@*/
RPMTAG_SOURCEPACKAGE = 1106, /* i legacy - obsolete */
-/*@-enummemuse@*/
RPMTAG_OLDORIGFILENAMES = 1107, /* internal - obsolete */
-/*@=enummemuse@*/
RPMTAG_BUILDPREREQ = 1108, /* internal */
RPMTAG_BUILDREQUIRES = 1109, /* internal */
RPMTAG_BUILDCONFLICTS = 1110, /* internal */
-/*@-enummemuse@*/
RPMTAG_BUILDMACROS = 1111, /* internal - unused */
-/*@=enummemuse@*/
RPMTAG_PROVIDEFLAGS = 1112, /* i[] */
RPMTAG_PROVIDEVERSION = 1113, /* s[] */
RPMTAG_OBSOLETEFLAGS = 1114, /* i[] */
RPMTAG_INSTALLCOLOR = 1127, /* i transaction color when installed */
RPMTAG_INSTALLTID = 1128, /* i */
RPMTAG_REMOVETID = 1129, /* i */
-/*@-enummemuse@*/
RPMTAG_SHA1RHN = 1130, /* internal - obsolete */
-/*@=enummemuse@*/
RPMTAG_RHNPLATFORM = 1131, /* s deprecated */
RPMTAG_PLATFORM = 1132, /* s */
RPMTAG_PATCHESNAME = 1133, /* s[] deprecated placeholder (SuSE) */
RPMTAG_BUILDPROVIDES = 1193, /* internal */
RPMTAG_BUILDOBSOLETES = 1194, /* internal */
-/*@-enummemuse@*/
RPMTAG_FIRSTFREE_TAG /*!< internal */
-/*@=enummemuse@*/
} rpmTag;
#define RPMTAG_EXTERNAL_TAG 1000000
* File Attributes.
*/
typedef enum rpmfileAttrs_e {
-/*@-enummemuse@*/
RPMFILE_NONE = 0,
-/*@=enummemuse@*/
RPMFILE_CONFIG = (1 << 0), /*!< from %%config */
RPMFILE_DOC = (1 << 1), /*!< from %%doc */
RPMFILE_ICON = (1 << 2), /*!< from %%donotuse. */
*/
typedef enum rpmsenseFlags_e {
RPMSENSE_ANY = 0,
-/*@-enummemuse@*/
RPMSENSE_SERIAL = (1 << 0), /*!< @todo Legacy. */
-/*@=enummemuse@*/
RPMSENSE_LESS = (1 << 1),
RPMSENSE_GREATER = (1 << 2),
RPMSENSE_EQUAL = (1 << 3),
RPMSENSE_SCRIPT_INSTALL = (1 << 22),/*!< %install build dependency. */
RPMSENSE_SCRIPT_CLEAN = (1 << 23), /*!< %clean build dependency. */
RPMSENSE_RPMLIB = ((1 << 24) | RPMSENSE_PREREQ), /*!< rpmlib(feature) dependency. */
-/*@-enummemuse@*/
RPMSENSE_TRIGGERPREIN = (1 << 25), /*!< @todo Implement %triggerprein. */
-/*@=enummemuse@*/
RPMSENSE_KEYRING = (1 << 26),
RPMSENSE_PATCHES = (1 << 27),
RPMSENSE_CONFIG = (1 << 28)
/* ==================================================================== */
/** \name RPMRC */
-/*@{*/
/* Stuff for maintaining "variables" like SOURCEDIR, BUILDDIR, etc */
#define RPMVAR_OPTFLAGS 3
* @deprecated Use rpmExpand() with appropriate macro expression.
* @todo Eliminate from API.
*/
-/*@-redecl@*/
-/*@observer@*/ /*@null@*/ extern const char * rpmGetVar(int var)
- /*@*/;
-/*@=redecl@*/
+extern const char * rpmGetVar(int var);
/** \ingroup rpmrc
* Set value of an rpmrc variable.
* @deprecated Use rpmDefineMacro() to change appropriate macro instead.
* @todo Eliminate from API.
*/
-void rpmSetVar(int var, const char * val)
- /*@globals internalState@*/
- /*@modifies internalState @*/;
+void rpmSetVar(int var, const char * val);
/** \ingroup rpmrc
* Build and install arch/os table identifiers.
* @param target target platform (NULL uses default)
* @return 0 on success, -1 on error
*/
-int rpmReadConfigFiles(/*@null@*/ const char * file,
- /*@null@*/ const char * target)
- /*@globals rpmGlobalMacroContext, rpmCLIMacroContext, h_errno,
- fileSystem, internalState @*/
- /*@modifies rpmGlobalMacroContext, rpmCLIMacroContext,
- fileSystem, internalState @*/;
+int rpmReadConfigFiles(const char * file,
+ const char * target);
/** \ingroup rpmrc
* Return current arch name and/or number.
* @retval name address of arch name (or NULL)
* @retval num address of arch number (or NULL)
*/
-void rpmGetArchInfo( /*@null@*/ /*@out@*/ const char ** name,
- /*@null@*/ /*@out@*/ int * num)
- /*@modifies *name, *num @*/;
+void rpmGetArchInfo( const char ** name,
+ int * num);
/** \ingroup rpmrc
* Return current os name and/or number.
* @retval name address of os name (or NULL)
* @retval num address of os number (or NULL)
*/
-void rpmGetOsInfo( /*@null@*/ /*@out@*/ const char ** name,
- /*@null@*/ /*@out@*/ int * num)
- /*@modifies *name, *num @*/;
+void rpmGetOsInfo( const char ** name,
+ int * num);
/** \ingroup rpmrc
* Return arch/os score of a name.
* @param name name
* @return arch score (0 is no match, lower is preferred)
*/
-int rpmMachineScore(int type, const char * name)
- /*@*/;
+int rpmMachineScore(int type, const char * name);
/** \ingroup rpmrc
* Display current rpmrc (and macro) configuration.
* @param fp output file handle
* @return 0 always
*/
-int rpmShowRC(FILE * fp)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies *fp, rpmGlobalMacroContext, fileSystem, internalState @*/;
+int rpmShowRC(FILE * fp);
/** \ingroup rpmrc
* @deprecated Use addMacro to set _target_* macros.
* @param archTable
* @param osTable
*/
-void rpmSetTables(int archTable, int osTable)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/;
+void rpmSetTables(int archTable, int osTable);
/** \ingroup rpmrc
* Set current arch/os names.
* @param arch arch name (or NULL)
* @param os os name (or NULL)
*/
-void rpmSetMachine(/*@null@*/ const char * arch, /*@null@*/ const char * os)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/;
+void rpmSetMachine(const char * arch, const char * os);
/** \ingroup rpmrc
* Return current arch/os names.
* @retval arch address of arch name (or NULL)
* @retval os address of os name (or NULL)
*/
-/*@unused@*/
-void rpmGetMachine( /*@null@*/ /*@out@*/ const char **arch,
- /*@null@*/ /*@out@*/ const char **os)
- /*@modifies *arch, *os @*/;
+void rpmGetMachine( const char **arch,
+ const char **os);
/** \ingroup rpmrc
* Destroy rpmrc arch/os compatibility tables.
* @todo Eliminate from API.
*/
-void rpmFreeRpmrc(void)
- /*@globals internalState @*/
- /*@modifies internalState @*/;
+void rpmFreeRpmrc(void);
-/*@}*/
/* ==================================================================== */
/** \name RPMTS */
-/*@{*/
/**
* Prototype for headerFreeData() vector.
*
* @param type type of data (or -1 to force free)
* @return NULL always
*/
-typedef /*@null@*/
- void * (*HFD_t) (/*@only@*/ /*@null@*/ const void * data, rpmTagType type)
- /*@modifies data @*/;
+typedef
+ void * (*HFD_t) (const void * data, rpmTagType type);
/**
* Prototype for headerGetEntry() vector.
* @return 1 on success, 0 on failure
*/
typedef int (*HGE_t) (Header h, rpmTag tag,
- /*@null@*/ /*@out@*/ rpmTagType * type,
- /*@null@*/ /*@out@*/ void ** p,
- /*@null@*/ /*@out@*/ int_32 * c)
- /*@modifies *type, *p, *c @*/;
+ rpmTagType * type,
+ void ** p,
+ int_32 * c);
/**
* Prototype for headerAddEntry() vector.
* @return 1 on success, 0 on failure
*/
typedef int (*HAE_t) (Header h, rpmTag tag, rpmTagType type,
- const void * p, int_32 c)
- /*@modifies h @*/;
+ const void * p, int_32 c);
/**
* Prototype for headerModifyEntry() vector.
* @return 1 on success, 0 on failure
*/
typedef int (*HME_t) (Header h, rpmTag tag, rpmTagType type,
- const void * p, int_32 c)
- /*@modifies h @*/;
+ const void * p, int_32 c);
/**
* Prototype for headerRemoveEntry() vector.
* @param tag tag
* @return 0 on success, 1 on failure (INCONSISTENT)
*/
-typedef int (*HRE_t) (Header h, int_32 tag)
- /*@modifies h @*/;
+typedef int (*HRE_t) (Header h, int_32 tag);
/**
* @todo Generalize filter mechanism.
* We pass these around as an array with a sentinel.
*/
typedef struct rpmRelocation_s {
-/*@only@*/ /*@null@*/
const char * oldPath; /*!< NULL here evals to RPMTAG_DEFAULTPREFIX, */
-/*@only@*/ /*@null@*/
const char * newPath; /*!< NULL means to omit the file completely! */
} rpmRelocation;
* @param second 2nd header
* @return result of comparison
*/
-int rpmVersionCompare(Header first, Header second)
- /*@*/;
+int rpmVersionCompare(Header first, Header second);
/**
* File disposition(s) during package install/erase transaction.
/** \ingroup payload
* Iterator across package file info, forward on install, backward on erase.
*/
-typedef /*@abstract@*/ struct fsmIterator_s * FSMI_t;
+typedef struct fsmIterator_s * FSMI_t;
/** \ingroup payload
* File state machine data.
*/
-typedef /*@abstract@*/ struct fsm_s * FSM_t;
+typedef struct fsm_s * FSM_t;
/** \ingroup rpmtrans
* Package state machine data.
*/
-typedef /*@abstract@*/ /*@refcounted@*/ struct rpmpsm_s * rpmpsm;
+typedef struct rpmpsm_s * rpmpsm;
/**
* Perform simple sanity and range checks on header tag(s).
* @param negate negative offset expected?
* @return -1 on success, otherwise failing tag element index
*/
-int headerVerifyInfo(int il, int dl, const void * pev, void * iv, int negate)
- /*@modifies *iv @*/;
+int headerVerifyInfo(int il, int dl, const void * pev, void * iv, int negate);
/**
* Check for supported payload format in header.
* @return RPMRC_OK on success
*/
rpmRC headerCheck(rpmts ts, const void * uh, size_t uc,
- /*@out@*/ /*@null@*/ const char ** msg)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies ts, *msg, rpmGlobalMacroContext,
- fileSystem, internalState @*/;
+ const char ** msg);
/**
* Return checked and loaded header.
* @retval *msg verification error message (or NULL)
* @return RPMRC_OK on success
*/
-rpmRC rpmReadHeader(rpmts ts, FD_t fd, /*@out@*/ Header *hdrp,
- /*@out@*/ /*@null@*/ const char ** msg)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies ts, *hdrp, *msg, rpmGlobalMacroContext,
- fileSystem, internalState @*/;
+rpmRC rpmReadHeader(rpmts ts, FD_t fd, Header *hdrp,
+ const char ** msg);
/**
* Return package header from file handle, verifying digests/signatures.
* @return RPMRC_OK on success
*/
rpmRC rpmReadPackageFile(rpmts ts, FD_t fd,
- const char * fn, /*@null@*/ /*@out@*/ Header * hdrp)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies ts, fd, *hdrp, rpmGlobalMacroContext,
- fileSystem, internalState @*/;
+ const char * fn, Header * hdrp);
/**
* Install source package.
* @return rpmRC return code
*/
rpmRC rpmInstallSourcePackage(rpmts ts, FD_t fd,
- /*@null@*/ /*@out@*/ const char ** specFilePtr,
- /*@null@*/ /*@out@*/ const char ** cookie)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies ts, fd, *specFilePtr, *cookie, rpmGlobalMacroContext,
- fileSystem, internalState @*/;
+ const char ** specFilePtr,
+ const char ** cookie);
/** \ingroup rpmtrans
* Bit(s) to control rpmtsRun() operation.
RPMTRANS_FLAG_NOTRIGGERS = (1 << 4), /*!< from --notriggers */
RPMTRANS_FLAG_NODOCS = (1 << 5), /*!< from --excludedocs */
RPMTRANS_FLAG_ALLFILES = (1 << 6), /*!< from --allfiles */
-/*@-enummemuse@*/
RPMTRANS_FLAG_KEEPOBSOLETE = (1 << 7), /*!< @todo Document. */
-/*@=enummemuse@*/
RPMTRANS_FLAG_NOCONTEXTS = (1 << 8), /*!< from --nocontexts */
RPMTRANS_FLAG_DIRSTASH = (1 << 9), /*!< from --dirstash */
RPMTRANS_FLAG_REPACKAGE = (1 << 10), /*!< from --repackage */
RPMTRANS_FLAG_PKGCOMMIT = (1 << 11),
-/*@-enummemuse@*/
RPMTRANS_FLAG_PKGUNDO = (1 << 12),
-/*@=enummemuse@*/
RPMTRANS_FLAG_COMMIT = (1 << 13),
-/*@-enummemuse@*/
RPMTRANS_FLAG_UNDO = (1 << 14),
-/*@=enummemuse@*/
RPMTRANS_FLAG_REVERSE = (1 << 15),
RPMTRANS_FLAG_NOTRIGGERPREIN= (1 << 16), /*!< from --notriggerprein */
RPMTRANS_FLAG_NOPREUN = (1 << 21), /*!< from --nopreun */
RPMTRANS_FLAG_NOPOSTUN = (1 << 22), /*!< from --nopostun */
RPMTRANS_FLAG_NOTRIGGERPOSTUN = (1 << 23), /*!< from --notriggerpostun */
-/*@-enummemuse@*/
RPMTRANS_FLAG_NOPAYLOAD = (1 << 24),
-/*@=enummemuse@*/
RPMTRANS_FLAG_APPLYONLY = (1 << 25),
RPMTRANS_FLAG_ANACONDA = (1 << 26), /*!< from --anaconda */
* @retval provVersions address of array of rpmlib internal provide versions
* @return no. of entries
*/
-/*@unused@*/
-int rpmGetRpmlibProvides(/*@null@*/ /*@out@*/ const char *** provNames,
- /*@null@*/ /*@out@*/ int ** provFlags,
- /*@null@*/ /*@out@*/ const char *** provVersions)
- /*@modifies *provNames, *provFlags, *provVersions @*/;
+int rpmGetRpmlibProvides(const char *** provNames,
+ int ** provFlags,
+ const char *** provVersions);
/** \ingroup rpmtrans
* Segmented string compare for version and/or release.
* @param b 2nd string
* @return +1 if a is "newer", 0 if equal, -1 if b is "newer"
*/
-int rpmvercmp(const char * a, const char * b)
- /*@*/;
+int rpmvercmp(const char * a, const char * b);
/** \ingroup rpmtrans
* Check dependency against internal rpmlib feature provides.
* @param key dependency
* @return 1 if dependency overlaps, 0 otherwise
*/
-int rpmCheckRpmlibProvides(const rpmds key)
- /*@*/;
+int rpmCheckRpmlibProvides(const rpmds key);
/** \ingroup rpmcli
* Display current rpmlib feature provides.
* @param fp output file handle
*/
-void rpmShowRpmlibProvides(FILE * fp)
- /*@globals fileSystem @*/
- /*@modifies *fp, fileSystem @*/;
+void rpmShowRpmlibProvides(FILE * fp);
-/*@}*/
/**
* Return tag name from value.
* @param tag tag value
* @return tag name, "(unknown)" on not found
*/
-/*@-redecl@*/
-/*@unused@*/ static inline /*@observer@*/
+static inline
const char * tagName(int tag)
- /*@*/
{
return ((*rpmTags->tagName)(tag));
}
-/*@=redecl@*/
/**
* Return tag data type from value.
* @param tag tag value
* @return tag data type, RPM_NULL_TYPE on not found.
*/
-/*@unused@*/ static inline
+static inline
int tagType(int tag)
- /*@*/
{
return ((*rpmTags->tagType)(tag));
}
* @param tagstr name of tag
* @return tag value, -1 on not found
*/
-/*@unused@*/ static inline
+static inline
int tagValue(const char * tagstr)
- /*@*/
{
return ((*rpmTags->tagValue)(tagstr));
}
char name[66];
short osnum;
short signature_type; /*!< Signature header type (RPMSIG_HEADERSIG) */
-/*@unused@*/ char reserved[16]; /*!< Pad to 96 bytes -- 8 byte aligned! */
+char reserved[16]; /*!< Pad to 96 bytes -- 8 byte aligned! */
} ;
/**
* Release storage used by file system usage cache.
*/
-void freeFilesystems(void)
- /*@globals internalState@*/
- /*@modifies internalState@*/;
+void freeFilesystems(void);
/**
* Return (cached) file system mount points.
* @retval num address of number of file systems (or NULL)
* @return 0 on success, 1 on error
*/
-/*@-incondefs@*/
-int rpmGetFilesystemList( /*@null@*/ /*@out@*/ const char *** listptr,
- /*@null@*/ /*@out@*/ int * num)
- /*@globals fileSystem, internalState @*/
- /*@modifies *listptr, *num, fileSystem, internalState @*/
- /*@requires maxSet(listptr) >= 0 /\ maxSet(num) >= 0 @*/
- /*@ensures maxRead(num) == 0 @*/;
-/*@=incondefs@*/
+int rpmGetFilesystemList( const char *** listptr,
+ int * num);
/**
* Determine per-file system usage for a list of files.
* @param flags (unused)
* @return 0 on success, 1 on error
*/
-/*@-incondefs@*/
int rpmGetFilesystemUsage(const char ** fileList, int_32 * fssizes,
- int numFiles, /*@null@*/ /*@out@*/ uint_32 ** usagesPtr,
- int flags)
- /*@globals rpmGlobalMacroContext, h_errno,
- fileSystem, internalState @*/
- /*@modifies *usagesPtr, rpmGlobalMacroContext,
- fileSystem, internalState @*/
- /*@requires maxSet(fileList) >= 0 /\ maxSet(fssizes) == 0
- /\ maxSet(usagesPtr) >= 0 @*/
- /*@ensures maxRead(usagesPtr) == 0 @*/;
-/*@=incondefs@*/
+ int numFiles, uint_32 ** usagesPtr,
+ int flags);
/* ==================================================================== */
/** \name RPMEIU */
-/*@{*/
/* --- install/upgrade/erase modes */
/** \ingroup rpmcli
UNINSTALL_ALLMATCHES= (1 << 1) /*!< from --allmatches */
} rpmEraseInterfaceFlags;
-/*@}*/
/* ==================================================================== */
/** \name RPMK */
-/*@{*/
/** \ingroup signature
* Tags found in signature header from package.
* @return result of signature verification
*/
rpmRC rpmVerifySignature(const rpmts ts,
- /*@out@*/ char * result)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies ts, *result, rpmGlobalMacroContext,
- fileSystem, internalState @*/;
+ char * result);
/** \ingroup signature
* Destroy signature header from package.
* @param h signature header
* @return NULL always
*/
-/*@null@*/ Header rpmFreeSignature(/*@null@*/ /*@killref@*/ Header h)
- /*@modifies h @*/;
-
-/*@}*/
+Header rpmFreeSignature(Header h);
#ifdef __cplusplus
}
/**
*/
struct rpmlibProvides_s {
-/*@observer@*/ /*@null@*/
const char * featureName;
-/*@observer@*/ /*@null@*/
const char * featureEVR;
int featureFlags;
-/*@observer@*/ /*@null@*/
const char * featureDescription;
};
-/*@observer@*/ /*@unchecked@*/
static struct rpmlibProvides_s rpmlibProvides[] = {
{ "rpmlib(VersionedDependencies)", "3.0.3-1",
(RPMSENSE_RPMLIB|RPMSENSE_EQUAL),
const struct rpmlibProvides_s * rlp;
for (rlp = rpmlibProvides; rlp->featureName != NULL; rlp++) {
-/*@-nullpass@*/ /* FIX: rlp->featureEVR not NULL */
+/* FIX: rlp->featureEVR not NULL */
rpmds pro = rpmdsSingle(RPMTAG_PROVIDENAME, rlp->featureName,
rlp->featureEVR, rlp->featureFlags);
-/*@=nullpass@*/
const char * DNEVR = rpmdsDNEVR(pro);
if (pro != NULL && DNEVR != NULL) {
int * flags;
int n = 0;
-/*@-boundswrite@*/
while (rpmlibProvides[n].featureName != NULL)
n++;
-/*@=boundswrite@*/
names = xcalloc((n+1), sizeof(*names));
versions = xcalloc((n+1), sizeof(*versions));
flags = xcalloc((n+1), sizeof(*flags));
-/*@-boundswrite@*/
for (n = 0; rpmlibProvides[n].featureName != NULL; n++) {
names[n] = rpmlibProvides[n].featureName;
flags[n] = rpmlibProvides[n].featureFlags;
versions[n] = rpmlibProvides[n].featureEVR;
}
- /*@-branchstate@*/
if (provNames)
*provNames = names;
else
names = _free(names);
- /*@=branchstate@*/
- /*@-branchstate@*/
if (provFlags)
*provFlags = flags;
else
flags = _free(flags);
- /*@=branchstate@*/
- /*@-branchstate@*/
if (provVersions)
*provVersions = versions;
else
versions = _free(versions);
- /*@=branchstate@*/
-/*@=boundswrite@*/
- /*@-compmempass@*/ /* FIX: rpmlibProvides[] reachable */
+ /* FIX: rpmlibProvides[] reachable */
return n;
- /*@=compmempass@*/
}
/* Internal interface */
#define RPMLOCK_PATH LOCALSTATEDIR "/lock/rpm/transaction"
-/*@unchecked@*/ /*@observer@*/
static const char * rpmlock_path_default = "%{?_rpmlock_path}";
-/*@unchecked@*/
static const char * rpmlock_path = NULL;
enum {
int openmode;
} * rpmlock;
-/*@null@*/
-static rpmlock rpmlock_new(/*@unused@*/ const char *rootdir)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/
+static rpmlock rpmlock_new(const char *rootdir)
{
rpmlock lock = (rpmlock) malloc(sizeof(*lock));
lock->fd = open(rpmlock_path, O_RDWR|O_CREAT, 0644);
(void) umask(oldmask);
-/*@-branchstate@*/
if (lock->fd == -1) {
lock->fd = open(rpmlock_path, O_RDONLY);
if (lock->fd == -1) {
free(lock);
lock = NULL;
} else {
-/*@-nullderef@*/ /* XXX splint on crack */
lock->openmode = RPMLOCK_READ;
-/*@=nullderef@*/
}
} else {
-/*@-nullderef@*/ /* XXX splint on crack */
lock->openmode = RPMLOCK_WRITE | RPMLOCK_READ;
-/*@=nullderef@*/
}
-/*@=branchstate@*/
}
-/*@-compdef@*/
return lock;
-/*@=compdef@*/
}
-static void rpmlock_free(/*@only@*/ /*@null@*/ rpmlock lock)
- /*@globals fileSystem, internalState @*/
- /*@modifies lock, fileSystem, internalState @*/
+static void rpmlock_free(rpmlock lock)
{
if (lock) {
(void) close(lock->fd);
}
}
-static int rpmlock_acquire(/*@null@*/ rpmlock lock, int mode)
- /*@*/
+static int rpmlock_acquire(rpmlock lock, int mode)
{
int res = 0;
if (lock && (mode & lock->openmode)) {
return res;
}
-static void rpmlock_release(/*@null@*/ rpmlock lock)
- /*@globals internalState @*/
- /*@modifies internalState @*/
+static void rpmlock_release(rpmlock lock)
{
if (lock) {
struct flock info;
if (!rootDir || rpmtsChrootDone(ts))
rootDir = "/";
lock = rpmlock_new(rootDir);
-/*@-branchstate@*/
if (!lock) {
rpmMessage(RPMMESS_ERROR, _("can't create transaction lock on %s\n"), rpmlock_path);
} else if (!rpmlock_acquire(lock, RPMLOCK_WRITE)) {
lock = NULL;
}
}
-/*@=branchstate@*/
return lock;
}
#ifndef RPMLOCK_H
#define RPMLOCK_H
-/*@only@*/ /*@null@*/
-void * rpmtsAcquireLock(rpmts ts)
- /*@globals fileSystem, internalState @*/
- /*@modifies fileSystem, internalState @*/;
-void rpmtsFreeLock(/*@only@*/ /*@null@*/ void *lock)
- /*@globals fileSystem, internalState @*/
- /*@modifies lock, fileSystem, internalState @*/;
+void * rpmtsAcquireLock(rpmts ts);
+void rpmtsFreeLock(void *lock);
#endif
#include "misc.h"
#include "debug.h"
-/*@access fnpyKey @*/
-/*@access rpmProblem @*/
-/*@unchecked@*/
int _rpmps_debug = 0;
rpmps XrpmpsUnlink(rpmps ps, const char * msg,
const char * fn, unsigned ln)
{
-/*@-modfilesys@*/
if (_rpmps_debug > 0 && msg != NULL)
fprintf(stderr, "--> ps %p -- %d %s at %s:%u\n", ps, ps->nrefs, msg, fn, ln);
-/*@=modfilesys@*/
ps->nrefs--;
-/*@-refcounttrans@*/
return ps;
-/*@=refcounttrans@*/
}
rpmps XrpmpsLink(rpmps ps, const char * msg,
const char * fn, unsigned ln)
{
ps->nrefs++;
-/*@-modfilesys@*/
if (_rpmps_debug > 0 && msg != NULL)
fprintf(stderr, "--> ps %p ++ %d %s at %s:%u\n", ps, ps->nrefs, msg, fn, ln);
-/*@=modfilesys@*/
-/*@-refcounttrans@*/
return ps;
-/*@=refcounttrans@*/
}
int rpmpsNumProblems(rpmps ps)
p = ps->probs + ps->numProblems;
ps->numProblems++;
-/*@-boundswrite@*/
memset(p, 0, sizeof(*p));
-/*@=boundswrite@*/
p->type = type;
p->key = key;
p->str1 = NULL;
if (dn != NULL || bn != NULL) {
-/*@-boundswrite@*/
t = xcalloc(1, (dn != NULL ? strlen(dn) : 0) +
(bn != NULL ? strlen(bn) : 0) + 1);
p->str1 = t;
if (dn != NULL) t = stpcpy(t, dn);
if (bn != NULL) t = stpcpy(t, bn);
-/*@=boundswrite@*/
}
}
continue;
}
while ((t - ps->probs) < ps->numProblems) {
- /*@-nullpass@*/ /* LCL: looks good to me <shrug> */
+ /* LCL: looks good to me <shrug> */
if (f->type == t->type && t->key == f->key &&
XSTRCMP(f->str1, t->str1))
- /*@innerbreak@*/ break;
- /*@=nullpass@*/
+ break;
t++;
gotProblems = 1;
}
}
#if !defined(HAVE_VSNPRINTF)
-/*@-shadow -bufferoverflowhigh @*/
-static inline int vsnprintf(/*@out@*/ char * buf, /*@unused@*/ int nb,
+static inline int vsnprintf(char * buf, int nb,
const char * fmt, va_list ap)
{
return vsprintf(buf, fmt, ap);
}
-/*@=shadow =bufferoverflowhigh @*/
#endif
#if !defined(HAVE_SNPRINTF)
-static inline int snprintf(/*@out@*/ char * buf, int nb, const char * fmt, ...)
+static inline int snprintf(char * buf, int nb, const char * fmt, ...)
{
va_list ap;
int rc;
const char * rpmProblemString(const rpmProblem prob)
{
-/*@observer@*/
const char * pkgNEVR = (prob->pkgNEVR ? prob->pkgNEVR : "?pkgNEVR?");
-/*@observer@*/
const char * altNEVR = (prob->altNEVR ? prob->altNEVR : "? ?altNEVR?");
-/*@observer@*/
const char * str1 = (prob->str1 ? prob->str1 : N_("different"));
int nb = strlen(pkgNEVR) + strlen(str1) + strlen(altNEVR) + 100;
char * buf = xmalloc(nb+1);
}
static int sameProblem(const rpmProblem ap, const rpmProblem bp)
- /*@*/
{
if (ap->type != bp->type)
return 1;
/* Filter already displayed problems. */
for (j = 0; j < i; j++) {
if (!sameProblem(p, ps->probs + j))
- /*@innerbreak@*/ break;
+ break;
}
if (j < i)
continue;
* Structures and prototypes used for an "rpmps" problem set.
*/
-/*@-exportlocal@*/
-/*@unchecked@*/
extern int _rpmps_debug;
-/*@=exportlocal@*/
/**
* Raw data for an element of a problem set.
*/
-typedef /*@abstract@*/ struct rpmProblem_s * rpmProblem;
+typedef struct rpmProblem_s * rpmProblem;
/**
* Transaction problems found while processing a transaction set/
*/
-typedef /*@abstract@*/ /*@refcounted@*/ struct rpmps_s * rpmps;
+typedef struct rpmps_s * rpmps;
/**
* Enumerate transaction set problem types.
/**
*/
struct rpmProblem_s {
-/*@only@*/ /*@null@*/
char * pkgNEVR;
-/*@only@*/ /*@null@*/
char * altNEVR;
-/*@exposed@*/ /*@null@*/
fnpyKey key;
rpmProblemType type;
int ignoreProblem;
-/*@only@*/ /*@null@*/
char * str1;
unsigned long ulong1;
};
int numProblems; /*!< Current probs array size. */
int numProblemsAlloced; /*!< Allocated probs array size. */
rpmProblem probs; /*!< Array of specific problems. */
-/*@refs@*/
int nrefs; /*!< Reference count. */
};
* @param prob rpm problem
* @return formatted string (malloc'd)
*/
-/*@-exportlocal@*/
-/*@-redecl@*/ /* LCL: is confused. */
-/*@only@*/ extern const char * rpmProblemString(const rpmProblem prob)
- /*@*/;
-/*@=redecl@*/
-/*@=exportlocal@*/
+extern const char * rpmProblemString(const rpmProblem prob);
/**
* Unreference a problem set instance.
* @param msg
* @return problem set
*/
-/*@unused@*/
-rpmps rpmpsUnlink (/*@killref@*/ /*@returned@*/ rpmps ps,
- const char * msg)
- /*@modifies ps @*/;
+rpmps rpmpsUnlink (rpmps ps,
+ const char * msg);
/** @todo Remove debugging entry from the ABI. */
-/*@-exportlocal@*/
-/*@null@*/
-rpmps XrpmpsUnlink (/*@killref@*/ /*@returned@*/ rpmps ps,
- const char * msg, const char * fn, unsigned ln)
- /*@modifies ps @*/;
+rpmps XrpmpsUnlink (rpmps ps,
+ const char * msg, const char * fn, unsigned ln);
#define rpmpsUnlink(_ps, _msg) XrpmpsUnlink(_ps, _msg, __FILE__, __LINE__)
-/*@=exportlocal@*/
/**
* Reference a problem set instance.
* @param msg
* @return new transaction set reference
*/
-/*@unused@*/
-rpmps rpmpsLink (rpmps ps, const char * msg)
- /*@modifies ps @*/;
+rpmps rpmpsLink (rpmps ps, const char * msg);
/** @todo Remove debugging entry from the ABI. */
rpmps XrpmpsLink (rpmps ps,
- const char * msg, const char * fn, unsigned ln)
- /*@modifies ps @*/;
+ const char * msg, const char * fn, unsigned ln);
#define rpmpsLink(_ps, _msg) XrpmpsLink(_ps, _msg, __FILE__, __LINE__)
/**
* @param ps problem set
* @return number of problems
*/
-int rpmpsNumProblems(/*@null@*/ rpmps ps)
- /*@*/;
+int rpmpsNumProblems(rpmps ps);
/**
* Create a problem set.
* @return new problem set
*/
-rpmps rpmpsCreate(void)
- /*@*/;
+rpmps rpmpsCreate(void);
/**
* Destroy a problem set.
* @param ps problem set
* @return NULL always
*/
-/*@null@*/
-rpmps rpmpsFree(/*@killref@*/ /*@only@*/ /*@null@*/ rpmps ps)
- /*@modifies ps @*/;
+rpmps rpmpsFree(rpmps ps);
/**
* Print problems to file handle.
* @param fp file handle (NULL uses stderr)
* @param ps problem set
*/
-void rpmpsPrint(/*@null@*/ FILE *fp, /*@null@*/ rpmps ps)
- /*@globals fileSystem @*/
- /*@modifies *fp, ps, fileSystem @*/;
+void rpmpsPrint(FILE *fp, rpmps ps);
/**
* Append a problem to current set of problems.
* @param altNEVR related (e.g. through a dependency) package name
* @param ulong1 generic pointer/long attribute
*/
-void rpmpsAppend(/*@null@*/ rpmps ps, rpmProblemType type,
- /*@null@*/ const char * pkgNEVR,
- /*@exposed@*/ /*@null@*/ fnpyKey key,
- /*@null@*/ const char * dn, /*@null@*/ const char * bn,
- /*@null@*/ const char * altNEVR,
- unsigned long ulong1)
- /*@modifies ps @*/;
+void rpmpsAppend(rpmps ps, rpmProblemType type,
+ const char * pkgNEVR,
+ fnpyKey key,
+ const char * dn, const char * bn,
+ const char * altNEVR,
+ unsigned long ulong1);
/**
* Filter a problem set.
* @param filter problem filter (or NULL)
* @return 0 no problems, 1 if problems remain
*/
-int rpmpsTrim(/*@null@*/ rpmps ps, /*@null@*/ rpmps filter)
- /*@modifies ps @*/;
+int rpmpsTrim(rpmps ps, rpmps filter);
#ifdef __cplusplus
}
-/*@-bounds@*/
#include "system.h"
#include <stdarg.h>
#include "misc.h"
#include "debug.h"
-/*@observer@*/ /*@unchecked@*/
static const char *defrcfiles =
RPMCONFIGDIR "/rpmrc"
":" RPMCONFIGDIR "/" RPMCANONVENDOR "/rpmrc"
":" SYSCONFDIR "/rpmrc"
":~/.rpmrc";
-/*@observer@*/ /*@checked@*/
const char * macrofiles =
#ifndef MACROFILES
RPMCONFIGDIR "/macros"
MACROFILES;
#endif
-/*@observer@*/ /*@unchecked@*/
static const char * platform = SYSCONFDIR "/rpm/platform";
-/*@only@*/ /*@relnull@*/ /*@unchecked@*/
static const char ** platpat = NULL;
-/*@unchecked@*/
static int nplatpat = 0;
-typedef /*@owned@*/ const char * cptr_t;
+typedef const char * cptr_t;
typedef struct machCacheEntry_s {
const char * name;
const char * value;
/* eventually, this arch will be replaced with a generic condition */
const char * arch;
-/*@only@*/ /*@null@*/ struct rpmvarValue * next;
+struct rpmvarValue * next;
};
struct rpmOption {
const char * name;
int var;
int archSpecific;
-/*@unused@*/ int required;
+int required;
int macroize;
int localize;
-/*@unused@*/ struct rpmOptionValue * value;
+struct rpmOptionValue * value;
};
typedef struct defaultEntry_s {
-/*@owned@*/ /*@null@*/ const char * name;
-/*@owned@*/ /*@null@*/ const char * defName;
+const char * name;
+const char * defName;
} * defaultEntry;
typedef struct canonEntry_s {
-/*@owned@*/ const char * name;
-/*@owned@*/ const char * short_name;
+const char * name;
+const char * short_name;
short num;
} * canonEntry;
* for giggles, 'key'_canon, 'key'_compat, and 'key'_canon will also work
*/
typedef struct tableType_s {
-/*@observer@*/ const char * const key;
+const char * const key;
const int hasCanon;
const int hasTranslate;
struct machEquivTable_s equiv;
int canonsLength;
} * tableType;
-/*@-fullinitblock@*/
-/*@unchecked@*/
static struct tableType_s tables[RPM_MACHTABLE_COUNT] = {
{ "arch", 1, 0 },
{ "os", 1, 0 },
/* this *must* be kept in alphabetical order */
/* The order of the flags is archSpecific, required, macroize, localize */
-/*@unchecked@*/
static struct rpmOption optionTable[] = {
{ "include", RPMVAR_INCLUDE, 0, 1, 0, 2 },
{ "macrofiles", RPMVAR_MACROFILES, 0, 0, 0, 1 },
{ "optflags", RPMVAR_OPTFLAGS, 1, 0, 1, 0 },
{ "provides", RPMVAR_PROVIDES, 0, 0, 0, 0 },
};
-/*@=fullinitblock@*/
-/*@unchecked@*/
static int optionTableSize = sizeof(optionTable) / sizeof(*optionTable);
#define OS 0
#define ARCH 1
-/*@unchecked@*/
static cptr_t current[2];
-/*@unchecked@*/
static int currTables[2] = { RPM_MACHTABLE_INSTOS, RPM_MACHTABLE_INSTARCH };
-/*@unchecked@*/
static struct rpmvarValue values[RPMVAR_NUM];
-/*@unchecked@*/
static int defaultsInitialized = 0;
/* prototypes */
-static int doReadRC( /*@killref@*/ FD_t fd, const char * urlfn)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies fd, rpmGlobalMacroContext, fileSystem, internalState @*/;
+static int doReadRC( FD_t fd, const char * urlfn);
static void rpmSetVarArch(int var, const char * val,
- /*@null@*/ const char * arch)
- /*@globals values, internalState @*/
- /*@modifies values, internalState @*/;
+ const char * arch);
-static void rebuildCompatTables(int type, const char * name)
- /*@globals internalState @*/
- /*@modifies internalState @*/;
+static void rebuildCompatTables(int type, const char * name);
-static void rpmRebuildTargetVars(/*@null@*/ const char **target, /*@null@*/ const char ** canontarget)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies *canontarget, rpmGlobalMacroContext,
- fileSystem, internalState @*/;
+static void rpmRebuildTargetVars(const char **target, const char ** canontarget);
static int optionCompare(const void * a, const void * b)
- /*@*/
{
return xstrcasecmp(((struct rpmOption *) a)->name,
((struct rpmOption *) b)->name);
}
-static /*@observer@*/ /*@null@*/ machCacheEntry
+static machCacheEntry
machCacheFindEntry(const machCache cache, const char * key)
- /*@*/
{
int i;
static int machCompatCacheAdd(char * name, const char * fn, int linenum,
machCache cache)
- /*@globals internalState @*/
- /*@modifies *name, cache->cache, cache->size, internalState @*/
{
machCacheEntry entry = NULL;
char * chptr;
return 0;
}
-static /*@observer@*/ /*@null@*/ machEquivInfo
+static machEquivInfo
machEquivSearch(const machEquivTable table, const char * name)
- /*@*/
{
int i;
static void machAddEquiv(machEquivTable table, const char * name,
int distance)
- /*@modifies table->list, table->count @*/
{
machEquivInfo equiv;
static void machCacheEntryVisit(machCache cache,
machEquivTable table, const char * name, int distance)
- /*@modifies table->list, table->count @*/
{
machCacheEntry entry;
int i;
static void machFindEquivs(machCache cache, machEquivTable table,
const char * key)
- /*@modifies cache->cache, table->list, table->count @*/
{
int i;
* Yuck. We have to start at a point at traverse it, remembering how
* far away everything is.
*/
- /*@-nullstate@*/ /* FIX: table->list may be NULL. */
+ /* FIX: table->list may be NULL. */
machAddEquiv(table, key, 1);
machCacheEntryVisit(cache, table, key, 2);
return;
- /*@=nullstate@*/
}
static int addCanon(canonEntry * table, int * tableLen, char * line,
const char * fn, int lineNum)
- /*@globals internalState @*/
- /*@modifies *table, *tableLen, *line, internalState @*/
{
canonEntry t;
char *s, *s1;
int tnum;
(*tableLen) += 2;
- /*@-unqualifiedtrans@*/
*table = xrealloc(*table, sizeof(**table) * (*tableLen));
- /*@=unqualifiedtrans@*/
t = & ((*table)[*tableLen - 2]);
return RPMERR_RPMRC;
}
- /*@-nullpass@*/ /* LCL: s != NULL here. */
+ /* LCL: s != NULL here. */
tnum = strtoul(s, &s1, 10);
if ((*s1) || (s1 == s) || (tnum == ULONG_MAX)) {
rpmError(RPMERR_RPMRC, _("Bad arch/os number: %s (%s:%d)\n"), s,
fn, lineNum);
return(RPMERR_RPMRC);
}
- /*@=nullpass@*/
t[0].name = xstrdup(tname);
t[0].short_name = (tshort_name ? xstrdup(tshort_name) : xstrdup(""));
static int addDefault(defaultEntry * table, int * tableLen, char * line,
const char * fn, int lineNum)
- /*@globals internalState @*/
- /*@modifies *table, *tableLen, *line, internalState @*/
{
defaultEntry t;
(*tableLen)++;
- /*@-unqualifiedtrans@*/
*table = xrealloc(*table, sizeof(**table) * (*tableLen));
- /*@=unqualifiedtrans@*/
t = & ((*table)[*tableLen - 1]);
- /*@-temptrans@*/
t->name = strtok(line, ": \t");
t->defName = strtok(NULL, " \t");
if (! (t->name && t->defName)) {
t->name = xstrdup(t->name);
t->defName = (t->defName ? xstrdup(t->defName) : NULL);
- /*@=temptrans@*/
return 0;
}
-static /*@null@*/ canonEntry lookupInCanonTable(const char * name,
+static canonEntry lookupInCanonTable(const char * name,
const canonEntry table, int tableLen)
- /*@*/
{
while (tableLen) {
tableLen--;
if (strcmp(name, table[tableLen].name))
continue;
- /*@-immediatetrans -retalias@*/
return &(table[tableLen]);
- /*@=immediatetrans =retalias@*/
}
return NULL;
}
-static /*@observer@*/ /*@null@*/
+static
const char * lookupInDefaultTable(const char * name,
const defaultEntry table, int tableLen)
- /*@*/
{
while (tableLen) {
tableLen--;
}
static void setVarDefault(int var, const char * macroname, const char * val,
- /*@null@*/ const char * body)
- /*@globals rpmGlobalMacroContext, internalState @*/
- /*@modifies rpmGlobalMacroContext, internalState @*/
+ const char * body)
{
if (var >= 0) { /* XXX Dying ... */
if (rpmGetVar(var)) return;
}
static void setPathDefault(int var, const char * macroname, const char * subdir)
- /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
- /*@modifies rpmGlobalMacroContext, internalState @*/
{
if (var >= 0) { /* XXX Dying ... */
}
}
-/*@observer@*/ /*@unchecked@*/
static const char * prescriptenviron = "\n\
RPM_SOURCE_DIR=\"%{_sourcedir}\"\n\
RPM_BUILD_DIR=\"%{_builddir}\"\n\
";
static void setDefaults(void)
- /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
- /*@modifies rpmGlobalMacroContext, internalState @*/
{
addMacro(NULL, "_usr", NULL, "/usr", RMIL_DEFAULT);
}
-/*@-usedef@*/ /*@ FIX: se usage inconsistent, W2DO? */
-static int doReadRC( /*@killref@*/ FD_t fd, const char * urlfn)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies fd, rpmGlobalMacroContext, fileSystem, internalState @*/
+/* FIX: se usage inconsistent, W2DO? */
+static int doReadRC( FD_t fd, const char * urlfn)
{
const char *s;
char *se, *next;
next[nb + 1] = '\0';
}
- /*@-branchstate@*/
while (*next != '\0') {
linenum++;
option->name, urlfn, linenum, s);
fn = _free(fn);
return 1;
- /*@notreached@*/
}
fdinc = Fopen(fn, "r.fpio");
fn = _free(fn);
if (rc) return rc;
continue; /* XXX don't save include value as var/macro */
- } /*@notreached@*/ /*@switchbreak@*/ break;
+ } break;
case RPMVAR_PROVIDES:
{ char *t;
s = rpmGetVar(RPMVAR_PROVIDES);
while (*se != '\0') *t++ = *se++;
*t++ = '\0';
se = (char *)fn;
- } /*@switchbreak@*/ break;
+ } break;
default:
- /*@switchbreak@*/ break;
+ break;
}
if (option->archSpecific) {
for (i = 0; i < RPM_MACHTABLE_COUNT; i++) {
if (!strncmp(tables[i].key, s, strlen(tables[i].key)))
- /*@innerbreak@*/ break;
+ break;
}
if (i < RPM_MACHTABLE_COUNT) {
}
}
}
- /*@=branchstate@*/
return 0;
}
-/*@=usedef@*/
/**
*/
-/*@-bounds@*/
static int rpmPlatform(const char * platform)
- /*@globals nplatpat, platpat,
- rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies nplatpat, platpat,
- rpmGlobalMacroContext, fileSystem, internalState @*/
{
char *cpu = NULL, *vendor = NULL, *os = NULL, *gnu = NULL;
byte * b = NULL;
*t = '\0';
if (t > p) {
platpat = xrealloc(platpat, (nplatpat + 2) * sizeof(*platpat));
-/*@-onlyunqglobaltrans@*/
platpat[nplatpat] = xstrdup(p);
nplatpat++;
platpat[nplatpat] = NULL;
-/*@=onlyunqglobaltrans@*/
}
continue;
}
vendor = p;
while (*p && !(*p == '-' || isspace(*p)))
p++;
-/*@-branchstate@*/
if (*p != '-') {
if (*p != '\0') *p++ = '\0';
os = vendor;
}
if (*p != '\0') *p++ = '\0';
}
-/*@=branchstate@*/
addMacro(NULL, "_host_cpu", NULL, cpu, -1);
addMacro(NULL, "_host_vendor", NULL, vendor, -1);
addMacro(NULL, "_host_os", NULL, os, -1);
platpat = xrealloc(platpat, (nplatpat + 2) * sizeof(*platpat));
-/*@-onlyunqglobaltrans@*/
platpat[nplatpat] = rpmExpand("%{_host_cpu}-%{_host_vendor}-%{_host_os}", (gnu && *gnu ? "-" : NULL), gnu, NULL);
nplatpat++;
platpat[nplatpat] = NULL;
-/*@=onlyunqglobaltrans@*/
init_platform++;
}
rc = (init_platform ? 0 : -1);
exit:
-/*@-modobserver@*/
b = _free(b);
-/*@=modobserver@*/
return rc;
}
-/*@=bounds@*/
# if defined(__linux__) && defined(__i386__)
* Generic CPUID function
*/
static inline void cpuid(unsigned int op, int *eax, int *ebx, int *ecx, int *edx)
- /*@modifies *eax, *ebx, *ecx, *edx @*/
{
asm volatile (
"pushl %%ebx \n"
* CPUID functions returning a single datum
*/
static inline unsigned int cpuid_eax(unsigned int op)
- /*@*/
{
unsigned int tmp, val;
cpuid(op, &val, &tmp, &tmp, &tmp);
}
static inline unsigned int cpuid_ebx(unsigned int op)
- /*@*/
{
unsigned int tmp, val;
cpuid(op, &tmp, &val, &tmp, &tmp);
}
static inline unsigned int cpuid_ecx(unsigned int op)
- /*@*/
{
unsigned int tmp, val;
cpuid(op, &tmp, &tmp, &val, &tmp);
}
static inline unsigned int cpuid_edx(unsigned int op)
- /*@*/
{
unsigned int tmp, val;
cpuid(op, &tmp, &tmp, &tmp, &val);
return val;
}
-/*@unchecked@*/
static sigjmp_buf jenv;
static inline void model3(int _unused)
- /*@globals internalState @*/
- /*@modifies internalState @*/
{
siglongjmp(jenv, 1);
}
static inline int RPMClass(void)
- /*@globals internalState @*/
- /*@modifies internalState @*/
{
int cpu;
unsigned int tfms, junk, cap, capamd;
/* should only be called for model 6 CPU's */
static int is_athlon(void)
- /*@*/
{
unsigned int eax, ebx, ecx, edx;
char vendor[16];
/**
*/
-static void defaultMachine(/*@out@*/ const char ** arch,
- /*@out@*/ const char ** os)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies *arch, *os, rpmGlobalMacroContext, fileSystem, internalState @*/
+static void defaultMachine(const char ** arch,
+ const char ** os)
{
static struct utsname un;
static int gotDefaults = 0;
*/
strncpy(un.sysname, "SINIX", sizeof(un.sysname));
#endif
- /*@-nullpass@*/
if (!strcmp(un.sysname, "AIX")) {
strcpy(un.machine, __power_pc() ? "ppc" : "rs6000");
sprintf(un.sysname,"aix%s.%s", un.version, un.release);
fd++) {
if (!xisdigit(un.release[fd]) && (un.release[fd] != '.')) {
un.release[fd] = 0;
- /*@innerbreak@*/ break;
+ break;
}
}
sprintf(un.sysname,"sunos%s",un.release);
char * prelid = NULL;
FD_t fd = Fopen("/etc/.relid", "r.fdio");
int gotit = 0;
- /*@-branchstate@*/
if (fd != NULL && !Ferror(fd)) {
chptr = xcalloc(1, 256);
{ int irelid = Fread(chptr, sizeof(*chptr), 256, fd);
}
chptr = _free (chptr);
}
- /*@=branchstate@*/
if (!gotit) /* parsing /etc/.relid file failed? */
strcpy(un.sysname,"ncr-sysv4");
/* wrong, just for now, find out how to look for i586 later*/
strcpy(un.machine,"i486");
}
- /*@=nullpass@*/
#endif /* __linux__ */
/* get rid of the hyphens in the sysname */
if (os) *os = un.sysname;
}
-static /*@observer@*/ /*@null@*/
-const char * rpmGetVarArch(int var, /*@null@*/ const char * arch)
- /*@*/
+static
+const char * rpmGetVarArch(int var, const char * arch)
{
const struct rpmvarValue * next;
}
/* this doesn't free the passed pointer! */
-static void freeRpmVar(/*@only@*/ struct rpmvarValue * orig)
- /*@modifies *orig @*/
+static void freeRpmVar(struct rpmvarValue * orig)
{
struct rpmvarValue * next, * var = orig;
var->arch = _free(var->arch);
var->value = _free(var->value);
- /*@-branchstate@*/
if (var != orig) var = _free(var);
- /*@=branchstate@*/
var = next;
}
}
void rpmSetVar(int var, const char * val)
- /*@globals values @*/
- /*@modifies values @*/
{
- /*@-immediatetrans@*/
freeRpmVar(&values[var]);
- /*@=immediatetrans@*/
values[var].value = (val ? xstrdup(val) : NULL);
}
}
}
- /*@-nullpass@*/ /* LCL: arch != NULL here. */
if (next->arch && arch && !strcmp(next->arch, arch)) {
- /*@=nullpass@*/
next->value = _free(next->value);
next->arch = _free(next->arch);
} else if (next->arch || arch) {
}
void rpmSetTables(int archTable, int osTable)
- /*@globals currTables @*/
- /*@modifies currTables @*/
{
const char * arch, * os;
}
void rpmSetMachine(const char * arch, const char * os)
- /*@globals current @*/
- /*@modifies current @*/
{
const char * host_cpu, * host_os;
}
static void rebuildCompatTables(int type, const char * name)
- /*@*/
{
machFindEquivs(&tables[currTables[type]].cache,
&tables[currTables[type]].equiv,
name);
}
-static void getMachineInfo(int type, /*@null@*/ /*@out@*/ const char ** name,
- /*@null@*/ /*@out@*/int * num)
- /*@modifies *name, *num @*/
+static void getMachineInfo(int type, const char ** name,
+ int * num)
{
canonEntry canon;
int which = currTables[type];
rpmSetTables(RPM_MACHTABLE_INSTARCH, RPM_MACHTABLE_INSTOS);
rpmSetTables(RPM_MACHTABLE_BUILDARCH, RPM_MACHTABLE_BUILDOS);
- /*@-branchstate@*/
if (target && *target) {
char *c;
/* Set arch and os from specified build target */
rpmGetOsInfo(&o, NULL);
co = (o) ? xstrdup(o) : NULL;
}
- /*@=branchstate@*/
/* If still not set, Set target arch/os from default uname(2) values */
if (ca == NULL) {
}
}
- /*@-branchstate@*/
if (canontarget)
*canontarget = ct;
else
ct = _free(ct);
- /*@=branchstate@*/
ca = _free(ca);
- /*@-usereleased@*/
co = _free(co);
- /*@=usereleased@*/
}
void rpmFreeRpmrc(void)
- /*@globals current, tables, values, defaultsInitialized,
- platpat, nplatpat @*/
- /*@modifies current, tables, values, defaultsInitialized,
- platpat, nplatpat @*/
{
int i, j, k;
-/*@-onlyunqglobaltrans -unqualifiedtrans @*/
if (platpat)
for (i = 0; i < nplatpat; i++)
platpat[i] = _free(platpat[i]);
platpat = _free(platpat);
-/*@-onlyunqglobaltrans =unqualifiedtrans @*/
nplatpat = 0;
for (i = 0; i < RPM_MACHTABLE_COUNT; i++) {
machCacheEntry e;
e = t->cache.cache + j;
if (e == NULL)
- /*@innercontinue@*/ continue;
+ continue;
e->name = _free(e->name);
if (e->equivs) {
for (k = 0; k < e->count; k++)
}
for (i = 0; i < RPMVAR_NUM; i++) {
- /*@only@*/ /*@null@*/ struct rpmvarValue * vp;
+ struct rpmvarValue * vp;
while ((vp = values[i].next) != NULL) {
values[i].next = vp->next;
vp->value = _free(vp->value);
current[OS] = _free(current[OS]);
current[ARCH] = _free(current[ARCH]);
defaultsInitialized = 0;
-/*@-globstate -nullstate@*/ /* FIX: platpat/current may be NULL */
+/* FIX: platpat/current may be NULL */
return;
-/*@=globstate =nullstate@*/
}
/** \ingroup rpmrc
* @param rcfiles colon separated files to read (NULL uses default)
* @return 0 on succes
*/
-static int rpmReadRC(/*@null@*/ const char * rcfiles)
- /*@globals defaultsInitialized, rpmGlobalMacroContext,
- rpmCLIMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies defaultsInitialized, rpmGlobalMacroContext,
- fileSystem, internalState @*/
+static int rpmReadRC(const char * rcfiles)
{
char *myrcfiles, *r, *re;
int rc;
/* Get pointer to rest of files */
for (re = r; (re = strchr(re, ':')) != NULL; re++) {
if (!(re[1] == '/' && re[2] == '/'))
- /*@innerbreak@*/ break;
+ break;
}
if (re && *re == ':')
*re++ = '\0';
{
/* Preset target macros */
- /*@-nullstate@*/ /* FIX: target can be NULL */
+ /* FIX: target can be NULL */
rpmRebuildTargetVars(&target, NULL);
/* Read the files */
/* Reset target macros */
rpmRebuildTargetVars(&target, NULL);
- /*@=nullstate@*/
/* Finally set target platform */
{ const char *cpu = rpmExpand("%{_target_cpu}", NULL);
return 0;
}
-/*@=bounds@*/
#include "debug.h"
-/*@unchecked@*/
int _rpmte_debug = 0;
-/*@access alKey @*/
-/*@access rpmtsi @*/
void rpmteCleanDS(rpmte te)
{
* @param p transaction element
*/
static void delTE(rpmte p)
- /*@globals fileSystem @*/
- /*@modifies p, fileSystem @*/
{
rpmRelocation * r;
p->h = headerFree(p->h);
-/*@-boundswrite@*/
memset(p, 0, sizeof(*p)); /* XXX trash and burn */
-/*@=boundswrite@*/
- /*@-nullstate@*/ /* FIX: p->{NEVR,name} annotations */
+ /* FIX: p->{NEVR,name} annotations */
return;
- /*@=nullstate@*/
}
/**
* @param key (TR_ADDED) package retrieval key (e.g. file name)
* @param relocs (TR_ADDED) package file relocations
*/
-/*@-bounds@*/
static void addTE(rpmts ts, rpmte p, Header h,
- /*@dependent@*/ /*@null@*/ fnpyKey key,
- /*@null@*/ rpmRelocation * relocs)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies ts, p, h,
- rpmGlobalMacroContext, fileSystem, internalState @*/
+ fnpyKey key,
+ rpmRelocation * relocs)
{
int scareMem = 0;
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
ep = NULL;
xx = hge(h, RPMTAG_EPOCH, NULL, (void **)&ep, NULL);
-/*@-branchstate@*/
if (ep) {
p->epoch = xmalloc(20);
sprintf(p->epoch, "%d", *ep);
} else
p->epoch = NULL;
-/*@=branchstate@*/
p->nrelocs = 0;
p->relocs = NULL;
rpmteColorDS(p, RPMTAG_PROVIDENAME);
rpmteColorDS(p, RPMTAG_REQUIRENAME);
-/*@-compdef@*/
return;
-/*@=compdef@*/
}
-/*@=bounds@*/
rpmte rpmteFree(rpmte te)
{
rpmte rpmteSetParent(rpmte te, rpmte pte)
{
rpmte opte = NULL;
-/*@-branchstate@*/
if (te != NULL) {
opte = te->parent;
- /*@-assignexpose -temptrans@*/
te->parent = pte;
- /*@=assignexpose =temptrans@*/
}
-/*@=branchstate@*/
return opte;
}
tsortInfo rpmteTSI(rpmte te)
{
- /*@-compdef -retalias -retexpose -usereleased @*/
return te->tsi;
- /*@=compdef =retalias =retexpose =usereleased @*/
}
void rpmteFreeTSI(rpmte te)
}
te->tsi = _free(te->tsi);
}
- /*@-nullstate@*/ /* FIX: te->tsi is NULL */
+ /* FIX: te->tsi is NULL */
return;
- /*@=nullstate@*/
}
void rpmteNewTSI(rpmte te)
FD_t rpmteFd(rpmte te)
{
- /*@-compdef -refcounttrans -retalias -retexpose -usereleased @*/
return (te != NULL ? te->fd : NULL);
- /*@=compdef =refcounttrans =retalias =retexpose =usereleased @*/
}
fnpyKey rpmteKey(rpmte te)
rpmds rpmteDS(rpmte te, rpmTag tag)
{
- /*@-compdef -refcounttrans -retalias -retexpose -usereleased @*/
if (te == NULL)
return NULL;
return te->obsoletes;
else
return NULL;
- /*@=compdef =refcounttrans =retalias =retexpose =usereleased @*/
}
rpmfi rpmteFI(rpmte te, rpmTag tag)
{
- /*@-compdef -refcounttrans -retalias -retexpose -usereleased @*/
if (te == NULL)
return NULL;
return te->fi;
else
return NULL;
- /*@=compdef =refcounttrans =retalias =retexpose =usereleased @*/
}
void rpmteColorDS(rpmte te, rpmTag tag)
switch (tag) {
default:
return;
- /*@notreached@*/ break;
+ break;
case RPMTAG_PROVIDENAME:
deptype = 'P';
break;
ix = *ddict++;
mydt = ((ix >> 24) & 0xff);
if (mydt != deptype)
- /*@innercontinue@*/ continue;
+ continue;
ix &= 0x00ffffff;
assert (ix < Count);
colors[ix] |= val;
return tsi->ocsave;
}
-rpmtsi XrpmtsiFree(/*@only@*//*@null@*/ rpmtsi tsi,
+rpmtsi XrpmtsiFree(rpmtsi tsi,
const char * fn, unsigned int ln)
{
/* XXX watchout: a funky recursion segfaults here iff nrefs is wrong. */
-/*@-internalglobs@*/
if (tsi)
tsi->ts = rpmtsFree(tsi->ts);
-/*@=internalglobs@*/
-/*@-modfilesys@*/
if (_rpmte_debug)
fprintf(stderr, "*** tsi %p -- %s:%d\n", tsi, fn, ln);
-/*@=modfilesys@*/
return _free(tsi);
}
tsi->reverse = ((rpmtsFlags(ts) & RPMTRANS_FLAG_REVERSE) ? 1 : 0);
tsi->oc = (tsi->reverse ? (rpmtsNElements(ts) - 1) : 0);
tsi->ocsave = tsi->oc;
-/*@-modfilesys@*/
if (_rpmte_debug)
fprintf(stderr, "*** tsi %p ++ %s:%d\n", tsi, fn, ln);
-/*@=modfilesys@*/
return tsi;
}
* @param tsi transaction element iterator
* @return transaction element, NULL on termination
*/
-static /*@null@*/ /*@dependent@*/
+static
rpmte rpmtsiNextElement(rpmtsi tsi)
- /*@modifies tsi @*/
{
rpmte te = NULL;
int oc = -1;
if (tsi->oc < rpmtsNElements(tsi->ts)) oc = tsi->oc++;
}
tsi->ocsave = oc;
-/*@-branchstate@*/
if (oc != -1)
te = rpmtsElement(tsi->ts, oc);
-/*@=branchstate@*/
return te;
}
/**
*/
-/*@-exportlocal@*/
-/*@unchecked@*/
extern int _rpmte_debug;
-/*@=exportlocal@*/
/**
* Transaction element ordering chain linkage.
*/
-typedef /*@abstract@*/ struct tsortInfo_s * tsortInfo;
+typedef struct tsortInfo_s * tsortInfo;
/**
* Transaction element iterator.
*/
-typedef /*@abstract@*/ struct rpmtsi_s * rpmtsi;
+typedef struct rpmtsi_s * rpmtsi;
/** \ingroup rpmte
* Transaction element type.
/** \ingroup rpmte
* Dependncy ordering information.
*/
-/*@-fielduse@*/ /* LCL: confused by union? */
struct tsortInfo_s {
union {
int count;
- /*@exposed@*/ /*@dependent@*/ /*@null@*/
rpmte suc;
} tsi_u;
#define tsi_count tsi_u.count
#define tsi_suc tsi_u.suc
-/*@owned@*/ /*@null@*/
struct tsortInfo_s * tsi_next;
-/*@exposed@*/ /*@dependent@*/ /*@null@*/
rpmte tsi_chain;
int tsi_reqx;
int tsi_qcnt;
};
-/*@=fielduse@*/
/** \ingroup rpmte
* A single package instance to be installed/removed atomically.
struct rpmte_s {
rpmElementType type; /*!< Package disposition (installed/removed). */
-/*@refcounted@*/ /*@relnull@*/
Header h; /*!< Package header. */
-/*@only@*/
const char * NEVR; /*!< Package name-version-release. */
-/*@only@*/
const char * NEVRA; /*!< Package name-version-release.arch. */
-/*@owned@*/
const char * name; /*!< Name: */
-/*@only@*/ /*@null@*/
char * epoch;
-/*@dependent@*/ /*@null@*/
char * version; /*!< Version: */
-/*@dependent@*/ /*@null@*/
char * release; /*!< Release: */
-/*@only@*/ /*@null@*/
const char * arch; /*!< Architecture hint. */
-/*@only@*/ /*@null@*/
const char * os; /*!< Operating system hint. */
int archScore; /*!< (TR_ADDED) Arch score. */
int osScore; /*!< (TR_ADDED) Os score. */
int depth; /*!< Depth in dependency tree. */
int breadth; /*!< Breadth in dependency tree. */
unsigned int db_instance; /*!< Database Instance after add */
-/*@owned@*/
tsortInfo tsi; /*!< Dependency ordering chains. */
-/*@refcounted@*/ /*@null@*/
rpmds this; /*!< This package's provided NEVR. */
-/*@refcounted@*/ /*@null@*/
rpmds provides; /*!< Provides: dependencies. */
-/*@refcounted@*/ /*@null@*/
rpmds requires; /*!< Requires: dependencies. */
-/*@refcounted@*/ /*@null@*/
rpmds conflicts; /*!< Conflicts: dependencies. */
-/*@refcounted@*/ /*@null@*/
rpmds obsoletes; /*!< Obsoletes: dependencies. */
-/*@refcounted@*/ /*@null@*/
rpmfi fi; /*!< File information. */
uint_32 color; /*!< Color bit(s) from package dependencies. */
uint_32 pkgFileSize; /*!< No. of bytes in package file (approx). */
-/*@exposed@*/ /*@dependent@*/ /*@null@*/
fnpyKey key; /*!< (TR_ADDED) Retrieval key. */
-/*@owned@*/ /*@null@*/
rpmRelocation * relocs; /*!< (TR_ADDED) Payload file relocations. */
int nrelocs; /*!< (TR_ADDED) No. of relocations. */
int autorelocatex; /*!< (TR_ADDED) Auto relocation entry index. */
-/*@refcounted@*/ /*@null@*/
FD_t fd; /*!< (TR_ADDED) Payload file descriptor. */
-/*@-fielduse@*/ /* LCL: confused by union? */
union {
-/*@exposed@*/ /*@dependent@*/ /*@null@*/
alKey addedKey;
struct {
-/*@exposed@*/ /*@dependent@*/ /*@null@*/
alKey dependsOnKey;
int dboffset;
} removed;
} u;
-/*@=fielduse@*/
};
* Iterator across transaction elements, forward on install, backward on erase.
*/
struct rpmtsi_s {
-/*@refcounted@*/
rpmts ts; /*!< transaction set. */
int reverse; /*!< reversed traversal? */
int ocsave; /*!< last returned iterator index. */
* @param te transaction element
* @return NULL always
*/
-/*@null@*/
-rpmte rpmteFree(/*@only@*/ /*@null@*/ rpmte te)
- /*@globals fileSystem @*/
- /*@modifies te, fileSystem @*/;
+rpmte rpmteFree(rpmte te);
/**
* Create a transaction element.
* @param pkgKey associated added package (if any)
* @return new transaction element
*/
-/*@only@*/ /*@null@*/
rpmte rpmteNew(const rpmts ts, Header h, rpmElementType type,
- /*@exposed@*/ /*@dependent@*/ /*@null@*/ fnpyKey key,
- /*@null@*/ rpmRelocation * relocs,
+ fnpyKey key,
+ rpmRelocation * relocs,
int dboffset,
- /*@exposed@*/ /*@dependent@*/ /*@null@*/ alKey pkgKey)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies ts, h, rpmGlobalMacroContext, fileSystem, internalState @*/;
+ alKey pkgKey);
/**
* Retrieve header from transaction element.
* @param te transaction element
* @return header
*/
-extern Header rpmteHeader(rpmte te)
- /*@modifies te @*/;
+extern Header rpmteHeader(rpmte te);
/**
* Save header into transaction element.
* @param h header
* @return NULL always
*/
-extern Header rpmteSetHeader(rpmte te, Header h)
- /*@modifies te, h @*/;
+extern Header rpmteSetHeader(rpmte te, Header h);
/**
* Retrieve type of transaction element.
* @param te transaction element
* @return type
*/
-rpmElementType rpmteType(rpmte te)
- /*@*/;
+rpmElementType rpmteType(rpmte te);
/**
* Retrieve name string of transaction element.
* @param te transaction element
* @return name string
*/
-/*@observer@*/
-extern const char * rpmteN(rpmte te)
- /*@*/;
+extern const char * rpmteN(rpmte te);
/**
* Retrieve epoch string of transaction element.
* @param te transaction element
* @return epoch string
*/
-/*@observer@*/ /*@null@*/
-extern const char * rpmteE(rpmte te)
- /*@*/;
+extern const char * rpmteE(rpmte te);
/**
* Retrieve version string of transaction element.
* @param te transaction element
* @return version string
*/
-/*@observer@*/ /*@null@*/
-extern const char * rpmteV(rpmte te)
- /*@*/;
+extern const char * rpmteV(rpmte te);
/**
* Retrieve release string of transaction element.
* @param te transaction element
* @return release string
*/
-/*@observer@*/ /*@null@*/
-extern const char * rpmteR(rpmte te)
- /*@*/;
+extern const char * rpmteR(rpmte te);
/**
* Retrieve arch string of transaction element.
* @param te transaction element
* @return arch string
*/
-/*@observer@*/ /*@null@*/
-extern const char * rpmteA(rpmte te)
- /*@*/;
+extern const char * rpmteA(rpmte te);
/**
* Retrieve os string of transaction element.
* @param te transaction element
* @return os string
*/
-/*@observer@*/ /*@null@*/
-extern const char * rpmteO(rpmte te)
- /*@*/;
+extern const char * rpmteO(rpmte te);
/**
* Retrieve isSource attribute of transaction element.
* @param te transaction element
* @return isSource attribute
*/
-extern int rpmteIsSource(rpmte te)
- /*@*/;
+extern int rpmteIsSource(rpmte te);
/**
* Retrieve color bits of transaction element.
* @param te transaction element
* @return color bits
*/
-uint_32 rpmteColor(rpmte te)
- /*@*/;
+uint_32 rpmteColor(rpmte te);
/**
* Set color bits of transaction element.
* @param color new color bits
* @return previous color bits
*/
-uint_32 rpmteSetColor(rpmte te, uint_32 color)
- /*@modifies te @*/;
+uint_32 rpmteSetColor(rpmte te, uint_32 color);
/**
* Retrieve last instance installed to the database.
* @param te transaction element
* @return last install instance.
*/
-unsigned int rpmteDBInstance(rpmte te)
- /*@*/;
+unsigned int rpmteDBInstance(rpmte te);
/**
* Set last instance installed to the database.
* @param instance Database instance of last install element.
* @return last install instance.
*/
-void rpmteSetDBInstance(rpmte te, unsigned int instance)
- /*@modifies te @*/;
+void rpmteSetDBInstance(rpmte te, unsigned int instance);
/**
* Retrieve size in bytes of package file.
* @param te transaction element
* @return size in bytes of package file.
*/
-uint_32 rpmtePkgFileSize(rpmte te)
- /*@*/;
+uint_32 rpmtePkgFileSize(rpmte te);
/**
* Retrieve dependency tree depth of transaction element.
* @param te transaction element
* @return depth
*/
-int rpmteDepth(rpmte te)
- /*@*/;
+int rpmteDepth(rpmte te);
/**
* Set dependency tree depth of transaction element.
* @param ndepth new depth
* @return previous depth
*/
-int rpmteSetDepth(rpmte te, int ndepth)
- /*@modifies te @*/;
+int rpmteSetDepth(rpmte te, int ndepth);
/**
* Retrieve dependency tree breadth of transaction element.
* @param te transaction element
* @return breadth
*/
-int rpmteBreadth(rpmte te)
- /*@*/;
+int rpmteBreadth(rpmte te);
/**
* Set dependency tree breadth of transaction element.
* @param nbreadth new breadth
* @return previous breadth
*/
-int rpmteSetBreadth(rpmte te, int nbreadth)
- /*@modifies te @*/;
+int rpmteSetBreadth(rpmte te, int nbreadth);
/**
* Retrieve tsort no. of predecessors of transaction element.
* @param te transaction element
* @return no. of predecessors
*/
-int rpmteNpreds(rpmte te)
- /*@*/;
+int rpmteNpreds(rpmte te);
/**
* Set tsort no. of predecessors of transaction element.
* @param npreds new no. of predecessors
* @return previous no. of predecessors
*/
-int rpmteSetNpreds(rpmte te, int npreds)
- /*@modifies te @*/;
+int rpmteSetNpreds(rpmte te, int npreds);
/**
* Retrieve tree index of transaction element.
* @param te transaction element
* @return tree index
*/
-int rpmteTree(rpmte te)
- /*@*/;
+int rpmteTree(rpmte te);
/**
* Set tree index of transaction element.
* @param ntree new tree index
* @return previous tree index
*/
-int rpmteSetTree(rpmte te, int ntree)
- /*@modifies te @*/;
+int rpmteSetTree(rpmte te, int ntree);
/**
* Retrieve parent transaction element.
* @param te transaction element
* @return parent transaction element
*/
-/*@observer@*/ /*@unused@*/
-rpmte rpmteParent(rpmte te)
- /*@*/;
+rpmte rpmteParent(rpmte te);
/**
* Set parent transaction element.
* @param pte new parent transaction element
* @return previous parent transaction element
*/
-/*@null@*/
-rpmte rpmteSetParent(rpmte te, rpmte pte)
- /*@modifies te @*/;
+rpmte rpmteSetParent(rpmte te, rpmte pte);
/**
* Retrieve number of children of transaction element.
* @param te transaction element
* @return tree index
*/
-int rpmteDegree(rpmte te)
- /*@*/;
+int rpmteDegree(rpmte te);
/**
* Set number of children of transaction element.
* @param ndegree new number of children
* @return previous number of children
*/
-int rpmteSetDegree(rpmte te, int ndegree)
- /*@modifies te @*/;
+int rpmteSetDegree(rpmte te, int ndegree);
/**
* Retrieve tsort info for transaction element.
* @param te transaction element
* @return tsort info
*/
-tsortInfo rpmteTSI(rpmte te)
- /*@*/;
+tsortInfo rpmteTSI(rpmte te);
/**
* Destroy tsort info of transaction element.
* @param te transaction element
*/
-void rpmteFreeTSI(rpmte te)
- /*@modifies te @*/;
+void rpmteFreeTSI(rpmte te);
/**
* Initialize tsort info of transaction element.
* @param te transaction element
*/
-void rpmteNewTSI(rpmte te)
- /*@modifies te @*/;
+void rpmteNewTSI(rpmte te);
/**
* Destroy dependency set info of transaction element.
* @param te transaction element
*/
-/*@unused@*/
-void rpmteCleanDS(rpmte te)
- /*@modifies te @*/;
+void rpmteCleanDS(rpmte te);
/**
* Retrieve pkgKey of TR_ADDED transaction element.
* @param te transaction element
* @return pkgKey
*/
-/*@exposed@*/ /*@dependent@*/ /*@null@*/
-alKey rpmteAddedKey(rpmte te)
- /*@*/;
+alKey rpmteAddedKey(rpmte te);
/**
* Set pkgKey of TR_ADDED transaction element.
* @param npkgKey new pkgKey
* @return previous pkgKey
*/
-/*@exposed@*/ /*@dependent@*/ /*@null@*/
alKey rpmteSetAddedKey(rpmte te,
- /*@exposed@*/ /*@dependent@*/ /*@null@*/ alKey npkgKey)
- /*@modifies te @*/;
+ alKey npkgKey);
/**
* Retrieve dependent pkgKey of TR_REMOVED transaction element.
* @param te transaction element
* @return dependent pkgKey
*/
-/*@exposed@*/ /*@dependent@*/ /*@null@*/
-alKey rpmteDependsOnKey(rpmte te)
- /*@*/;
+alKey rpmteDependsOnKey(rpmte te);
/**
* Retrieve rpmdb instance of TR_REMOVED transaction element.
* @param te transaction element
* @return rpmdb instance
*/
-int rpmteDBOffset(rpmte te)
- /*@*/;
+int rpmteDBOffset(rpmte te);
/**
* Retrieve name-version-release string from transaction element.
* @param te transaction element
* @return name-version-release string
*/
-/*@observer@*/
-extern const char * rpmteNEVR(rpmte te)
- /*@*/;
+extern const char * rpmteNEVR(rpmte te);
/**
* Retrieve name-version-release.arch string from transaction element.
* @param te transaction element
* @return name-version-release.arch string
*/
-/*@-exportlocal@*/
-/*@observer@*/
-extern const char * rpmteNEVRA(rpmte te)
- /*@*/;
-/*@=exportlocal@*/
+extern const char * rpmteNEVRA(rpmte te);
/**
* Retrieve file handle from transaction element.
* @param te transaction element
* @return file handle
*/
-FD_t rpmteFd(rpmte te)
- /*@*/;
+FD_t rpmteFd(rpmte te);
/**
* Retrieve key from transaction element.
* @param te transaction element
* @return key
*/
-/*@exposed@*/
-fnpyKey rpmteKey(rpmte te)
- /*@*/;
+fnpyKey rpmteKey(rpmte te);
/**
* Retrieve dependency tag set from transaction element.
* @param tag dependency tag
* @return dependency tag set
*/
-rpmds rpmteDS(rpmte te, rpmTag tag)
- /*@*/;
+rpmds rpmteDS(rpmte te, rpmTag tag);
/**
* Retrieve file info tag set from transaction element.
* @param tag file info tag (RPMTAG_BASENAMES)
* @return file info tag set
*/
-rpmfi rpmteFI(rpmte te, rpmTag tag)
- /*@*/;
+rpmfi rpmteFI(rpmte te, rpmTag tag);
/**
* Calculate transaction element dependency colors/refs from file info.
* @param te transaction element
* @param tag dependency tag (RPMTAG_PROVIDENAME, RPMTAG_REQUIRENAME)
*/
-/*@-exportlocal@*/
-void rpmteColorDS(rpmte te, rpmTag tag)
- /*@modifies te @*/;
-/*@=exportlocal@*/
+void rpmteColorDS(rpmte te, rpmTag tag);
/**
* Return transaction element index.
* @param tsi transaction element iterator
* @return transaction element index
*/
-int rpmtsiOc(rpmtsi tsi)
- /*@*/;
+int rpmtsiOc(rpmtsi tsi);
/**
* Destroy transaction element iterator.
* @param tsi transaction element iterator
* @return NULL always
*/
-/*@unused@*/ /*@null@*/
-rpmtsi rpmtsiFree(/*@only@*//*@null@*/ rpmtsi tsi)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/;
+rpmtsi rpmtsiFree(rpmtsi tsi);
/**
* Destroy transaction element iterator.
* @param ln
* @return NULL always
*/
-/*@null@*/
-rpmtsi XrpmtsiFree(/*@only@*//*@null@*/ rpmtsi tsi,
- const char * fn, unsigned int ln)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/;
+rpmtsi XrpmtsiFree(rpmtsi tsi,
+ const char * fn, unsigned int ln);
#define rpmtsiFree(_tsi) XrpmtsiFree(_tsi, __FILE__, __LINE__)
/**
* @param ts transaction set
* @return transaction element iterator
*/
-/*@unused@*/ /*@only@*/
-rpmtsi rpmtsiInit(rpmts ts)
- /*@modifies ts @*/;
+rpmtsi rpmtsiInit(rpmts ts);
/**
* Create transaction element iterator.
* @param ln
* @return transaction element iterator
*/
-/*@unused@*/ /*@only@*/
rpmtsi XrpmtsiInit(rpmts ts,
- const char * fn, unsigned int ln)
- /*@modifies ts @*/;
+ const char * fn, unsigned int ln);
#define rpmtsiInit(_ts) XrpmtsiInit(_ts, __FILE__, __LINE__)
/**
* @param type transaction element type selector (0 for any)
* @return next transaction element of type, NULL on termination
*/
-/*@dependent@*/ /*@null@*/
-rpmte rpmtsiNext(rpmtsi tsi, rpmElementType type)
- /*@modifies tsi @*/;
+rpmte rpmtsiNext(rpmtsi tsi, rpmElementType type);
#ifdef __cplusplus
}
/* XXX FIXME: merge with existing (broken?) tests in system.h */
/* portability fiddles */
#if STATFS_IN_SYS_STATVFS
-/*@-incondefs@*/
#include <sys/statvfs.h>
#else
#include "debug.h"
-/*@access rpmdb @*/ /* XXX db->db_chrootDone, NULL */
-
-/*@access rpmps @*/
-/*@access rpmDiskSpaceInfo @*/
-/*@access rpmte @*/
-/*@access rpmtsi @*/
-/*@access fnpyKey @*/
-/*@access pgpDig @*/
-/*@access pgpDigParams @*/
-
-/*@unchecked@*/
int _rpmts_debug = 0;
-/*@unchecked@*/
int _rpmts_stats = 0;
char * hGetNEVR(Header h, const char ** np)
(void) headerNVR(h, &n, &v, &r);
NVR = t = xcalloc(1, strlen(n) + strlen(v) + strlen(r) + sizeof("--"));
-/*@-boundswrite@*/
t = stpcpy(t, n);
t = stpcpy(t, "-");
t = stpcpy(t, v);
t = stpcpy(t, r);
if (np)
*np = n;
-/*@=boundswrite@*/
return NVR;
}
(void) headerNVR(h, &n, &v, &r);
xx = headerGetEntry(h, RPMTAG_ARCH, NULL, (void **) &a, NULL);
NVRA = t = xcalloc(1, strlen(n) + strlen(v) + strlen(r) + strlen(a) + sizeof("--."));
-/*@-boundswrite@*/
t = stpcpy(t, n);
t = stpcpy(t, "-");
t = stpcpy(t, v);
t = stpcpy(t, a);
if (np)
*np = n;
-/*@=boundswrite@*/
return NVRA;
}
if (hge(h, RPMTAG_FILECOLORS, NULL, (void **)&fcolors, &ncolors)
&& fcolors != NULL && ncolors > 0)
{
-/*@-boundsread@*/
for (i = 0; i < ncolors; i++)
hcolor |= fcolors[i];
-/*@=boundsread@*/
}
hcolor &= 0x0f;
rpmts XrpmtsUnlink(rpmts ts, const char * msg, const char * fn, unsigned ln)
{
-/*@-modfilesys@*/
if (_rpmts_debug)
fprintf(stderr, "--> ts %p -- %d %s at %s:%u\n", ts, ts->nrefs, msg, fn, ln);
-/*@=modfilesys@*/
ts->nrefs--;
return NULL;
}
rpmts XrpmtsLink(rpmts ts, const char * msg, const char * fn, unsigned ln)
{
ts->nrefs++;
-/*@-modfilesys@*/
if (_rpmts_debug)
fprintf(stderr, "--> ts %p ++ %d %s at %s:%u\n", ts, ts->nrefs, msg, fn, ln);
-/*@=modfilesys@*/
- /*@-refcounttrans@*/ return ts; /*@=refcounttrans@*/
+ return ts;
}
int rpmtsCloseDB(rpmts ts)
return rpmdbVerify(ts->rootDir);
}
-/*@-boundsread@*/
static int isArch(const char * arch)
- /*@*/
{
const char ** av;
-/*@-nullassign@*/
- /*@observer@*/
static const char *arches[] = {
"i386", "i486", "i586", "i686", "athlon", "pentium3", "pentium4", "x86_64", "amd64", "ia32e",
"alpha", "alphaev5", "alphaev56", "alphapca56", "alphaev6", "alphaev67",
"noarch",
NULL,
};
-/*@=nullassign@*/
for (av = arches; *av != NULL; av++) {
if (!strcmp(arch, *av))
}
return 0;
}
-/*@=boundsread@*/
-/*@-compdef@*/ /* keyp might no be defined. */
+/* keyp might no be defined. */
rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
const void * keyp, size_t keylen)
{
return NULL;
/* Parse out "N(EVR).A" tokens from a label key. */
-/*@-bounds -branchstate@*/
if (rpmtag == RPMDBI_LABEL && keyp != NULL) {
const char * s = keyp;
const char *se;
switch (c) {
default:
*t++ = c;
- /*@switchbreak@*/ break;
+ break;
case '(':
/* XXX Fail if nested parens. */
if (level++ != 0) {
/* No Epoch: found. Convert '(' to '-' and chug. */
*t++ = '-';
}
- /*@switchbreak@*/ break;
+ break;
case ')':
/* XXX Fail if nested parens. */
if (--level != 0) {
return NULL;
}
/* Don't copy trailing ')' */
- /*@switchbreak@*/ break;
+ break;
}
}
if (level) {
arch = t;
}
}
-/*@=bounds =branchstate@*/
mi = rpmdbInitIterator(ts->rdb, rpmtag, keyp, keylen);
xx = rpmdbSetIteratorRE(mi, RPMTAG_ARCH, RPMMIRE_DEFAULT, arch);
return mi;
}
-/*@=compdef@*/
rpmRC rpmtsFindPubkey(rpmts ts)
{
continue;
hx = rpmdbGetIteratorOffset(mi);
ix = rpmdbGetIteratorFileNum(mi);
-/*@-boundsread@*/
if (ix >= pc
|| b64decode(pubkeys[ix], (void **) &ts->pkpkt, &ts->pkpktlen))
ix = -1;
-/*@=boundsread@*/
pubkeys = headerFreeData(pubkeys, pt);
break;
}
mi = rpmdbFreeIterator(mi);
-/*@-branchstate@*/
if (ix >= 0) {
char hnum[32];
sprintf(hnum, "h#%d", hx);
ts->pkpkt = _free(ts->pkpkt);
ts->pkpktlen = 0;
}
-/*@=branchstate@*/
}
/* Try keyserver lookup. */
xx = (pgpReadPkts(fn,&ts->pkpkt,&ts->pkpktlen) != PGPARMOR_PUBKEY);
}
fn = _free(fn);
-/*@-branchstate@*/
if (xx) {
ts->pkpkt = _free(ts->pkpkt);
ts->pkpktlen = 0;
/* Save new pubkey in local ts keyring for delayed import. */
pubkeysource = xstrdup("keyserver");
}
-/*@=branchstate@*/
}
#ifdef NOTNOW
/* XXX Verify any pubkey signatures. */
/* Pubkey packet looks good, save the signer id. */
-/*@-boundsread@*/
memcpy(ts->pksignid, pubp->signid, sizeof(ts->pksignid));
-/*@=boundsread@*/
if (pubkeysource)
rpmMessage(RPMMESS_DEBUG, "========== %s pubkey id %08x %08x (%s)\n",
* @return result of comparison
*/
static int sugcmp(const void * a, const void * b)
- /*@*/
{
-/*@-boundsread@*/
const char * astr = *(const char **)a;
const char * bstr = *(const char **)b;
-/*@=boundsread@*/
return strcmp(astr, bstr);
}
-/*@-bounds@*/
-int rpmtsSolve(rpmts ts, rpmds ds, /*@unused@*/ const void * data)
+int rpmtsSolve(rpmts ts, rpmds ds, const void * data)
{
const char * errstr;
const char * str;
qsort(ts->suggests, ts->nsuggests, sizeof(*ts->suggests), sugcmp);
exit:
-/*@-nullstate@*/ /* FIX: ts->suggests[] may be NULL */
+/* FIX: ts->suggests[] may be NULL */
return rc;
-/*@=nullstate@*/
}
-/*@=bounds@*/
int rpmtsAvailable(rpmts ts, const rpmds ds)
{
ts->suggests[ts->nsuggests] = NULL;
}
sugkey = _free(sugkey);
-/*@-nullstate@*/ /* FIX: ts->suggests[] may be NULL */
+/* FIX: ts->suggests[] may be NULL */
return rc;
-/*@=nullstate@*/
}
int rpmtsSetSolveCallback(rpmts ts,
{
int rc = 0;
-/*@-branchstate@*/
if (ts) {
-/*@-assignexpose -temptrans @*/
ts->solve = solve;
ts->solveData = solveData;
-/*@=assignexpose =temptrans @*/
}
-/*@=branchstate@*/
return rc;
}
if (ts == NULL)
return;
-/*@-nullstate@*/ /* FIX: partial annotations */
rpmtsClean(ts);
-/*@=nullstate@*/
for (pi = rpmtsiInit(ts), oc = 0; (p = rpmtsiNext(pi, 0)) != NULL; oc++) {
-/*@-type -unqualifiedtrans @*/
ts->order[oc] = rpmteFree(ts->order[oc]);
-/*@=type =unqualifiedtrans @*/
}
pi = rpmtsiFree(pi);
ts->maxDepth = 0;
ts->numRemovedPackages = 0;
-/*@-nullstate@*/ /* FIX: partial annotations */
return;
-/*@=nullstate@*/
}
-static void rpmtsPrintStat(const char * name, /*@null@*/ struct rpmop_s * op)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/
+static void rpmtsPrintStat(const char * name, struct rpmop_s * op)
{
static unsigned int scale = (1000 * 1000);
if (op != NULL && op->count > 0)
}
static void rpmtsPrintStats(rpmts ts)
- /*@globals fileSystem, internalState @*/
- /*@modifies fileSystem, internalState @*/
{
(void) rpmswExit(rpmtsOp(ts, RPMTS_OP_TOTAL), 0);
if (ts->nrefs > 1)
return rpmtsUnlink(ts, "tsCreate");
-/*@-nullstate@*/ /* FIX: partial annotations */
rpmtsEmpty(ts);
-/*@=nullstate@*/
(void) rpmtsCloseDB(ts);
ts->rootDir = _free(ts->rootDir);
ts->currDir = _free(ts->currDir);
-/*@-type +voidabstract @*/ /* FIX: double indirection */
ts->order = _free(ts->order);
-/*@=type =voidabstract @*/
ts->orderAlloced = 0;
if (ts->pkpkt != NULL)
rpmtsPrintStats(ts);
/* Free up the memory used by the rpmtsScore */
-/*@-kepttrans -onlytrans @*/
ts->score = rpmtsScoreFree(ts->score);
-/*@=kepttrans =onlytrans @*/
(void) rpmtsUnlink(ts, "tsCreate");
- /*@-refcounttrans -usereleased @*/
ts = _free(ts);
- /*@=refcounttrans =usereleased @*/
return NULL;
}
{
const char * rootDir = NULL;
-/*@-branchstate@*/
if (ts != NULL && ts->rootDir != NULL) {
urltype ut = urlPath(ts->rootDir, &rootDir);
switch (ut) {
break;
}
}
-/*@=branchstate@*/
return rootDir;
}
}
rootLen = strlen(rootDir);
-/*@-branchstate@*/
/* Make sure that rootDir has trailing / */
if (!(rootLen && rootDir[rootLen - 1] == '/')) {
char * t = alloca(rootLen + 2);
(void) stpcpy( stpcpy(t, rootDir), "/");
rootDir = t;
}
-/*@=branchstate@*/
ts->rootDir = xstrdup(rootDir);
}
}
if (ts != NULL) {
scriptFd = ts->scriptFd;
}
-/*@-compdef -refcounttrans -usereleased@*/
return scriptFd;
-/*@=compdef =refcounttrans =usereleased@*/
}
void rpmtsSetScriptFd(rpmts ts, FD_t scriptFd)
ts->scriptFd = fdFree(ts->scriptFd, "rpmtsSetScriptFd");
ts->scriptFd = NULL;
}
-/*@+voidabstract@*/
if (scriptFd != NULL)
ts->scriptFd = fdLink((void *)scriptFd, "rpmtsSetScriptFd");
-/*@=voidabstract@*/
}
}
ts->sig = headerFreeData(ts->sig, ts->sigtype);
ts->sigtag = sigtag;
ts->sigtype = (sig ? sigtype : 0);
-/*@-assignexpose -kepttrans@*/
ts->sig = sig;
-/*@=assignexpose =kepttrans@*/
ts->siglen = siglen;
}
return 0;
pgpDig rpmtsDig(rpmts ts)
{
-/*@-mods@*/ /* FIX: hide lazy malloc for now */
+/* FIX: hide lazy malloc for now */
if (ts->dig == NULL)
ts->dig = pgpNewDig();
-/*@=mods@*/
if (ts->dig == NULL)
return NULL;
return ts->dig;
{
pgpDig dig = rpmtsDig(ts);
if (dig == NULL) return NULL;
-/*@-immediatetrans@*/
return &dig->signature;
-/*@=immediatetrans@*/
}
pgpDigParams rpmtsPubkey(const rpmts ts)
{
pgpDig dig = rpmtsDig(ts);
if (dig == NULL) return NULL;
-/*@-immediatetrans@*/
return &dig->pubkey;
-/*@=immediatetrans@*/
}
rpmdb rpmtsGetRdb(rpmts ts)
if (ts != NULL) {
rdb = ts->rdb;
}
-/*@-compdef -refcounttrans -usereleased @*/
return rdb;
-/*@=compdef =refcounttrans =usereleased @*/
}
int rpmtsInitDSI(const rpmts ts)
case FA_ALTNAME:
dsi->ineeded++;
dsi->bneeded += bneeded;
- /*@switchbreak@*/ break;
+ break;
/*
* FIXME: If two packages share a file (same md5sum), and
case FA_CREATE:
dsi->bneeded += bneeded;
dsi->bneeded -= BLOCK_ROUND(prevSize, dsi->bsize);
- /*@switchbreak@*/ break;
+ break;
case FA_ERASE:
dsi->ineeded--;
dsi->bneeded -= bneeded;
- /*@switchbreak@*/ break;
+ break;
default:
- /*@switchbreak@*/ break;
+ break;
}
if (fixupSize)
void * ptr = NULL;
if (ts && ts->notify && te) {
assert(!(te->type == TR_ADDED && te->h == NULL));
- /*@-type@*/ /* FIX: cast? */
- /*@-noeffectuncon @*/ /* FIX: check rc */
+ /* FIX: cast? */
+ /* FIX: check rc */
ptr = ts->notify(te->h, what, amount, total,
rpmteKey(te), ts->notifyData);
- /*@=noeffectuncon @*/
- /*@=type@*/
}
return ptr;
}
if (ix >= 0 && ix < ts->orderCount)
te = ts->order[ix];
}
- /*@-compdef@*/
return te;
- /*@=compdef@*/
}
rpmprobFilterFlags rpmtsFilterFlags(rpmts ts)
Spec rpmtsSpec(rpmts ts)
{
-/*@-compdef -retexpose -usereleased@*/
return ts->spec;
-/*@=compdef =retexpose =usereleased@*/
}
Spec rpmtsSetSpec(rpmts ts, Spec spec)
{
Spec ospec = ts->spec;
-/*@-assignexpose -temptrans@*/
ts->spec = spec;
-/*@=assignexpose =temptrans@*/
return ospec;
}
rpmte rpmtsRelocateElement(rpmts ts)
{
-/*@-compdef -retexpose -usereleased@*/
return ts->relocateElement;
-/*@=compdef =retexpose =usereleased@*/
}
rpmte rpmtsSetRelocateElement(rpmts ts, rpmte relocateElement)
{
rpmte orelocateElement = ts->relocateElement;
-/*@-assignexpose -temptrans@*/
ts->relocateElement = relocateElement;
-/*@=assignexpose =temptrans@*/
return orelocateElement;
}
if (ts != NULL && opx >= 0 && opx < RPMTS_OP_MAX)
op = ts->ops + opx;
-/*@-usereleased -compdef @*/
return op;
-/*@=usereleased =compdef @*/
}
int rpmtsSetNotifyCallback(rpmts ts,
while ((p = rpmtsiNext(pi, 0)) != NULL) {
switch (rpmteType(p)) {
case TR_ADDED:
- /*@-dependenttrans@*/
*e = rpmteKey(p);
- /*@=dependenttrans@*/
- /*@switchbreak@*/ break;
+ break;
case TR_REMOVED:
default:
*e = NULL;
- /*@switchbreak@*/ break;
+ break;
}
e++;
}
se = score->scores[i];
if (strcmp(rpmteN(p), se->N) == 0) {
found = 1;
- /*@innerbreak@*/ break;
+ break;
}
}
/* If we did not find the entry then allocate space for it */
if (!found) {
-/*@-compdef -usereleased@*/ /* XXX p->fi->te undefined. */
+/* XXX p->fi->te undefined. */
rpmMessage(RPMMESS_DEBUG, _("\tAdding entry for %s to score board.\n"),
rpmteN(p));
-/*@=compdef =usereleased@*/
se = xcalloc(1, sizeof(*(*(score->scores))));
rpmMessage(RPMMESS_DEBUG, _("\t\tEntry address: %p\n"), se);
se->N = xstrdup(rpmteN(p));
rpmMessage(RPMMESS_DEBUG, _("\tRefcount is zero...will free\n"));
/* No more references, lets clean up */
/* First deallocate the score entries */
-/*@-branchstate@*/
for(i = 0; i < score->entries; i++) {
/* Get the score for the ith entry */
se = score->scores[i];
/* Deallocate the score entry itself */
se = _free(se);
}
-/*@=branchstate@*/
/* Next deallocate the score entry table */
score->scores = _free(score->scores);
}
}
-/*@-compdef@*/ /* XXX score->scores undefined. */
+/* XXX score->scores undefined. */
return ret;
-/*@=compdef@*/
}
#include "rpmps.h"
#include "rpmsw.h"
-/*@-exportlocal@*/
-/*@unchecked@*/
extern int _rpmts_debug;
-/*@unchecked@*/
extern int _rpmts_stats;
-/*@unchecked@*/
extern int _fps_debug;
-/*@=exportlocal@*/
/**
* Bit(s) to control digest and signature verification.
int erased; /*!<Was the old header removed */
};
-typedef /*@abstract@*/ struct rpmtsScoreEntry_s * rpmtsScoreEntry;
+typedef struct rpmtsScoreEntry_s * rpmtsScoreEntry;
struct rpmtsScore_s {
int entries; /*!< Number of scores */
int nrefs; /*!< Reference count. */
};
-typedef /*@abstract@*/ struct rpmtsScore_s * rpmtsScore;
+typedef struct rpmtsScore_s * rpmtsScore;
/** \ingroup rpmts
* @param rollbackTS Rollback Transaction.
* @return RPMRC_OK
*/
-rpmRC rpmtsScoreInit(rpmts runningTS, rpmts rollbackTS)
- /*@globals fileSystem @*/
- /*@modifies runningTS, rollbackTS, fileSystem @*/;
+rpmRC rpmtsScoreInit(rpmts runningTS, rpmts rollbackTS);
/** \ingroup rpmts
* Free rpmtsScore provided no more references exist against it.
* @param score rpmtsScore to free
* @return NULL always
*/
-/*@-exportlocal@*/
-/*@null@*/
-rpmtsScore rpmtsScoreFree(/*@only@*/ /*@null@*/ rpmtsScore score)
- /*@modifies score @*/;
-/*@=exportlocal@*/
+rpmtsScore rpmtsScoreFree(rpmtsScore score);
/** \ingroup rpmts
* Get rpmtsScore from transaction.
* @param ts RPM Transaction.
* @return rpmtsScore or NULL.
*/
-/*@exposed@*/ /*@null@*/
-rpmtsScore rpmtsGetScore(rpmts ts)
- /*@*/;
+rpmtsScore rpmtsGetScore(rpmts ts);
/** \ingroup rpmts
* Get rpmtsScoreEntry from rpmtsScore.
* @param score RPM Transaction Score.
* @return rpmtsScoreEntry or NULL.
*/
-/*@null@*/
-rpmtsScoreEntry rpmtsScoreGetEntry(rpmtsScore score, const char *N)
- /*@*/;
+rpmtsScoreEntry rpmtsScoreGetEntry(rpmtsScore score, const char *N);
/** \ingroup rpmts
* \file lib/rpmts.h
* END Transaction Scores *
**************************/
-/*@unchecked@*/
-/*@-exportlocal@*/
extern int _cacheDependsRC;
-/*@=exportlocal@*/
/** \ingroup rpmts
*/
-typedef /*@abstract@*/ struct diskspaceInfo_s * rpmDiskSpaceInfo;
+typedef struct diskspaceInfo_s * rpmDiskSpaceInfo;
/** \ingroup rpmts
*/
tsmStage goal; /*!< Transaction goal (i.e. mode) */
rpmtsType type; /*!< default, rollback, autorollback */
-/*@refcounted@*/ /*@null@*/
rpmdb sdb; /*!< Solve database handle. */
int sdbmode; /*!< Solve database open mode. */
-/*@null@*/
- int (*solve) (rpmts ts, rpmds key, const void * data)
- /*@modifies ts @*/; /*!< Search for NEVRA key. */
-/*@relnull@*/
+ int (*solve) (rpmts ts, rpmds key, const void * data);
+ /*!< Search for NEVRA key. */
const void * solveData; /*!< Solve callback data */
int nsuggests; /*!< No. of depCheck suggestions. */
-/*@only@*/ /*@null@*/
const void ** suggests; /*!< Possible depCheck suggestions. */
-/*@observer@*/ /*@null@*/
rpmCallbackFunction notify; /*!< Callback function. */
-/*@observer@*/ /*@null@*/
rpmCallbackData notifyData; /*!< Callback private data. */
-/*@refcounted@*/ /*@null@*/
rpmps probs; /*!< Current problems in transaction. */
rpmprobFilterFlags ignoreSet;
/*!< Bits to filter current problems. */
int filesystemCount; /*!< No. of mounted filesystems. */
-/*@dependent@*/ /*@null@*/
const char ** filesystems; /*!< Mounted filesystem names. */
-/*@only@*/ /*@null@*/
rpmDiskSpaceInfo dsi; /*!< Per filesystem disk/inode usage. */
-/*@refcounted@*/ /*@null@*/
rpmdb rdb; /*!< Install database handle. */
int dbmode; /*!< Install database open mode. */
-/*@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. */
-/*@only@*/
rpmal addedPackages; /*!< Set of packages being installed. */
int numAddedPackages; /*!< No. added package instances. */
#ifndef DYING
-/*@only@*/
rpmal availablePackages; /*!< Universe of available packages. */
int numAvailablePackages; /*!< No. available package instances. */
#endif
-/*@null@*/
rpmte relocateElement; /*!< Element to use when relocating packages. */
-/*@owned@*/ /*@relnull@*/
rpmte * order; /*!< Packages sorted by dependencies. */
int orderCount; /*!< No. of transaction elements. */
int orderAlloced; /*!< No. of allocated transaction elements. */
int selinuxEnabled; /*!< Is SE linux enabled? */
int chrootDone; /*!< Has chroot(2) been been done? */
-/*@only@*/ /*@null@*/
const char * rootDir; /*!< Path to top of install tree. */
-/*@only@*/ /*@null@*/
const char * currDir; /*!< Current working directory. */
-/*@null@*/
FD_t scriptFd; /*!< Scriptlet stdout/stderr. */
int delta; /*!< Delta for reallocation. */
int_32 tid; /*!< Transaction id. */
rpmVSFlags vsflags; /*!< Signature/digest verification flags. */
-/*@observer@*/ /*@dependent@*/ /*@null@*/
const char * fn; /*!< Current package fn. */
int_32 sigtag; /*!< Current package signature tag. */
int_32 sigtype; /*!< Current package signature data type. */
-/*@null@*/
const void * sig; /*!< Current package signature. */
int_32 siglen; /*!< Current package signature length. */
-/*@only@*/ /*@null@*/
const unsigned char * pkpkt;/*!< Current pubkey packet. */
size_t pkpktlen; /*!< Current pubkey packet length. */
unsigned char pksignid[8]; /*!< Current pubkey fingerprint. */
struct rpmop_s ops[RPMTS_OP_MAX];
-/*@null@*/
pgpDig dig; /*!< Current signature/pubkey parameters. */
-/*@null@*/
Spec spec; /*!< Spec file control structure. */
-/*@kept@*/ /*@null@*/
rpmtsScore score; /*!< Transaction Score (autorollback). */
-/*@refs@*/
int nrefs; /*!< Reference count. */
};
#endif /* _RPMTS_INTERNAL */
* @param ts transaction set
* @return 0 on success
*/
-int rpmtsCheck(rpmts ts)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
+int rpmtsCheck(rpmts ts);
/** \ingroup rpmts
* Determine package order in a transaction set according to dependencies.
* @param ts transaction set
* @return no. of (added) packages that could not be ordered
*/
-int rpmtsOrder(rpmts ts)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
+int rpmtsOrder(rpmts ts);
/** \ingroup rpmts
* Process all package elements in a transaction set. Before calling
* @param ignoreSet bits to filter problem types
* @return 0 on success, -1 on error, >0 with newProbs set
*/
-int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
+int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet);
/** \ingroup rpmts
* Unreference a transaction instance.
* @param msg
* @return NULL always
*/
-/*@unused@*/ /*@null@*/
-rpmts rpmtsUnlink (/*@killref@*/ /*@only@*/ rpmts ts,
- const char * msg)
- /*@modifies ts @*/;
+rpmts rpmtsUnlink (rpmts ts,
+ const char * msg);
/** @todo Remove debugging entry from the ABI. */
-/*@-exportlocal@*/
-/*@null@*/
-rpmts XrpmtsUnlink (/*@killref@*/ /*@only@*/ rpmts ts,
- const char * msg, const char * fn, unsigned ln)
- /*@modifies ts @*/;
-/*@=exportlocal@*/
+rpmts XrpmtsUnlink (rpmts ts,
+ const char * msg, const char * fn, unsigned ln);
#define rpmtsUnlink(_ts, _msg) XrpmtsUnlink(_ts, _msg, __FILE__, __LINE__)
/** \ingroup rpmts
* @param msg
* @return new transaction set reference
*/
-/*@unused@*/
-rpmts rpmtsLink (rpmts ts, const char * msg)
- /*@modifies ts @*/;
+rpmts rpmtsLink (rpmts ts, const char * msg);
/** @todo Remove debugging entry from the ABI. */
rpmts XrpmtsLink (rpmts ts,
- const char * msg, const char * fn, unsigned ln)
- /*@modifies ts @*/;
+ const char * msg, const char * fn, unsigned ln);
#define rpmtsLink(_ts, _msg) XrpmtsLink(_ts, _msg, __FILE__, __LINE__)
/** \ingroup rpmts
* @param ts transaction set
* @return 0 on success
*/
-int rpmtsCloseDB(rpmts ts)
- /*@globals fileSystem @*/
- /*@modifies ts, fileSystem @*/;
+int rpmtsCloseDB(rpmts ts);
/** \ingroup rpmts
* Open the database used by the transaction.
* @param dbmode O_RDONLY or O_RDWR
* @return 0 on success
*/
-int rpmtsOpenDB(rpmts ts, int dbmode)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
+int rpmtsOpenDB(rpmts ts, int dbmode);
/** \ingroup rpmts
* Initialize the database used by the transaction.
* @param dbmode O_RDONLY or O_RDWR
* @return 0 on success
*/
-int rpmtsInitDB(rpmts ts, int dbmode)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
+int rpmtsInitDB(rpmts ts, int dbmode);
/** \ingroup rpmts
* Rebuild the database used by the transaction.
* @param ts transaction set
* @return 0 on success
*/
-int rpmtsRebuildDB(rpmts ts)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
+int rpmtsRebuildDB(rpmts ts);
/** \ingroup rpmts
* Verify the database used by the transaction.
* @param ts transaction set
* @return 0 on success
*/
-int rpmtsVerifyDB(rpmts ts)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
+int rpmtsVerifyDB(rpmts ts);
/** \ingroup rpmts
* Return transaction database iterator.
* @param keylen key data length (0 will use strlen(keyp))
* @return NULL on failure
*/
-/*@only@*/ /*@null@*/
rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
- /*@null@*/ const void * keyp, size_t keylen)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
+ const void * keyp, size_t keylen);
/**
* Retrieve pubkey from rpm database.
* @param ts rpm transaction
* @return RPMRC_OK on success, RPMRC_NOKEY if not found
*/
-/*@-exportlocal@*/
-rpmRC rpmtsFindPubkey(rpmts ts)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState */;
-/*@=exportlocal@*/
+rpmRC rpmtsFindPubkey(rpmts ts);
/** \ingroup rpmts
* Close the database used by the transaction to solve dependencies.
* @param ts transaction set
* @return 0 on success
*/
-/*@-exportlocal@*/
-int rpmtsCloseSDB(rpmts ts)
- /*@globals fileSystem @*/
- /*@modifies ts, fileSystem @*/;
-/*@=exportlocal@*/
+int rpmtsCloseSDB(rpmts ts);
/** \ingroup rpmts
* Open the database used by the transaction to solve dependencies.
* @param dbmode O_RDONLY or O_RDWR
* @return 0 on success
*/
-/*@-exportlocal@*/
-int rpmtsOpenSDB(rpmts ts, int dbmode)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
-/*@=exportlocal@*/
+int rpmtsOpenSDB(rpmts ts, int dbmode);
/**
* Attempt to solve a needed dependency using the solve database.
* @param data opaque data associated with callback
* @return -1 retry, 0 ignore, 1 not found
*/
-/*@-exportlocal@*/
-int rpmtsSolve(rpmts ts, rpmds ds, const void * data)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
-/*@=exportlocal@*/
+int rpmtsSolve(rpmts ts, rpmds ds, const void * data);
/**
* Attempt to solve a needed dependency using memory resident tables.
* @param ds dependency set
* @return 0 if resolved (and added to ts), 1 not found
*/
-/*@unused@*/
-int rpmtsAvailable(rpmts ts, const rpmds ds)
- /*@globals fileSystem @*/
- /*@modifies ts, fileSystem @*/;
+int rpmtsAvailable(rpmts ts, const rpmds ds);
/**
* Set dependency solver callback.
*/
int rpmtsSetSolveCallback(rpmts ts,
int (*solve) (rpmts ts, rpmds ds, const void * data),
- const void * solveData)
- /*@modifies ts @*/;
+ const void * solveData);
/**
* Return the type of a transaction.
* @param ts transaction set
* @return 0 it is not, 1 it is.
*/
-rpmtsType rpmtsGetType(rpmts ts)
- /*@*/;
+rpmtsType rpmtsGetType(rpmts ts);
/**
* Set transaction type. Allowed types are:
* @param type transaction type
* @return void
*/
-void rpmtsSetType(rpmts ts, rpmtsType type)
- /*@modifies ts @*/;
+void rpmtsSetType(rpmts ts, rpmtsType type);
/**
* Return current transaction set problems.
* @param ts transaction set
* @return current problem set (or NULL)
*/
-/*@null@*/
-rpmps rpmtsProblems(rpmts ts)
- /*@modifies ts @*/;
+rpmps rpmtsProblems(rpmts ts);
/** \ingroup rpmts
* Free signature verification data.
* @param ts transaction set
*/
-void rpmtsCleanDig(rpmts ts)
- /*@modifies ts @*/;
+void rpmtsCleanDig(rpmts ts);
/** \ingroup rpmts
* Free memory needed only for dependency checks and ordering.
* @param ts transaction set
*/
-void rpmtsClean(rpmts ts)
- /*@globals fileSystem, internalState @*/
- /*@modifies ts, fileSystem , internalState@*/;
+void rpmtsClean(rpmts ts);
/** \ingroup rpmts
* Re-create an empty transaction set.
* @param ts transaction set
*/
-void rpmtsEmpty(rpmts ts)
- /*@globals fileSystem, internalState @*/
- /*@modifies ts, fileSystem, internalState @*/;
+void rpmtsEmpty(rpmts ts);
/** \ingroup rpmts
* Destroy transaction set, closing the database as well.
* @param ts transaction set
* @return NULL always
*/
-/*@null@*/
-rpmts rpmtsFree(/*@killref@*/ /*@only@*//*@null@*/ rpmts ts)
- /*@globals fileSystem, internalState @*/
- /*@modifies ts, fileSystem, internalState @*/;
+rpmts rpmtsFree(rpmts ts);
/** \ingroup rpmts
* Get verify signatures flag(s).
* @param ts transaction set
* @return verify signatures flags
*/
-rpmVSFlags rpmtsVSFlags(rpmts ts)
- /*@*/;
+rpmVSFlags rpmtsVSFlags(rpmts ts);
/** \ingroup rpmts
* Set verify signatures flag(s).
* @param vsflags new verify signatures flags
* @return previous value
*/
-rpmVSFlags rpmtsSetVSFlags(rpmts ts, rpmVSFlags vsflags)
- /*@modifies ts @*/;
+rpmVSFlags rpmtsSetVSFlags(rpmts ts, rpmVSFlags vsflags);
/** \ingroup rpmts
* Set index of 1st element of successors.
* @param first new index of 1st element of successors
* @return previous value
*/
-int rpmtsUnorderedSuccessors(rpmts ts, int first)
- /*@modifies ts @*/;
+int rpmtsUnorderedSuccessors(rpmts ts, int first);
/** \ingroup rpmts
* Get transaction rootDir, i.e. path to chroot(2).
* @param ts transaction set
* @return transaction rootDir
*/
-/*@observer@*/ /*@null@*/
-extern const char * rpmtsRootDir(rpmts ts)
- /*@*/;
+extern const char * rpmtsRootDir(rpmts ts);
/** \ingroup rpmts
* Set transaction rootDir, i.e. path to chroot(2).
* @param ts transaction set
* @param rootDir new transaction rootDir (or NULL)
*/
-void rpmtsSetRootDir(rpmts ts, /*@null@*/ const char * rootDir)
- /*@modifies ts @*/;
+void rpmtsSetRootDir(rpmts ts, const char * rootDir);
/** \ingroup rpmts
* Get transaction currDir, i.e. current directory before chroot(2).
* @param ts transaction set
* @return transaction currDir
*/
-/*@observer@*/ /*@null@*/
-extern const char * rpmtsCurrDir(rpmts ts)
- /*@*/;
+extern const char * rpmtsCurrDir(rpmts ts);
/** \ingroup rpmts
* Set transaction currDir, i.e. current directory before chroot(2).
* @param ts transaction set
* @param currDir new transaction currDir (or NULL)
*/
-void rpmtsSetCurrDir(rpmts ts, /*@null@*/ const char * currDir)
- /*@modifies ts @*/;
+void rpmtsSetCurrDir(rpmts ts, const char * currDir);
/** \ingroup rpmts
* Get transaction script file handle, i.e. stdout/stderr on scriptlet execution
* @param ts transaction set
* @return transaction script file handle
*/
-/*@null@*/
-FD_t rpmtsScriptFd(rpmts ts)
- /*@*/;
+FD_t rpmtsScriptFd(rpmts ts);
/** \ingroup rpmts
* Set transaction script file handle, i.e. stdout/stderr on scriptlet execution
* @param ts transaction set
* @param scriptFd new script file handle (or NULL)
*/
-void rpmtsSetScriptFd(rpmts ts, /*@null@*/ FD_t scriptFd)
- /*@modifies ts, scriptFd @*/;
+void rpmtsSetScriptFd(rpmts ts, FD_t scriptFd);
/** \ingroup rpmts
* Get selinuxEnabled flag, i.e. is SE linux enabled?
* @param ts transaction set
* @return selinuxEnabled flag
*/
-int rpmtsSELinuxEnabled(rpmts ts)
- /*@*/;
+int rpmtsSELinuxEnabled(rpmts ts);
/** \ingroup rpmts
* Get chrootDone flag, i.e. has chroot(2) been performed?
* @param ts transaction set
* @return chrootDone flag
*/
-int rpmtsChrootDone(rpmts ts)
- /*@*/;
+int rpmtsChrootDone(rpmts ts);
/** \ingroup rpmts
* Set chrootDone flag, i.e. has chroot(2) been performed?
* @param chrootDone new chrootDone flag
* @return previous chrootDone flag
*/
-int rpmtsSetChrootDone(rpmts ts, int chrootDone)
- /*@modifies ts @*/;
+int rpmtsSetChrootDone(rpmts ts, int chrootDone);
/** \ingroup rpmts
* Get transaction id, i.e. transaction time stamp.
* @param ts transaction set
* @return transaction id
*/
-int_32 rpmtsGetTid(rpmts ts)
- /*@*/;
+int_32 rpmtsGetTid(rpmts ts);
/** \ingroup rpmts
* Set transaction id, i.e. transaction time stamp.
* @param tid new transaction id
* @return previous transaction id
*/
-int_32 rpmtsSetTid(rpmts ts, int_32 tid)
- /*@modifies ts @*/;
+int_32 rpmtsSetTid(rpmts ts, int_32 tid);
/** \ingroup rpmts
* Get signature tag.
* @param ts transaction set
* @return signature tag
*/
-int_32 rpmtsSigtag(const rpmts ts)
- /*@*/;
+int_32 rpmtsSigtag(const rpmts ts);
/** \ingroup rpmts
* Get signature tag type.
* @param ts transaction set
* @return signature tag type
*/
-int_32 rpmtsSigtype(const rpmts ts)
- /*@*/;
+int_32 rpmtsSigtype(const rpmts ts);
/** \ingroup rpmts
* Get signature tag data, i.e. from header.
* @param ts transaction set
* @return signature tag data
*/
-/*@observer@*/ /*@null@*/
-extern const void * rpmtsSig(const rpmts ts)
- /*@*/;
+extern const void * rpmtsSig(const rpmts ts);
/** \ingroup rpmts
* Get signature tag data length, i.e. no. of bytes of data.
* @param ts transaction set
* @return signature tag data length
*/
-int_32 rpmtsSiglen(const rpmts ts)
- /*@*/;
+int_32 rpmtsSiglen(const rpmts ts);
/** \ingroup rpmts
* Set signature tag info, i.e. from header.
*/
int rpmtsSetSig(rpmts ts,
int_32 sigtag, int_32 sigtype,
- /*@kept@*/ /*@null@*/ const void * sig, int_32 siglen)
- /*@modifies ts @*/;
+ const void * sig, int_32 siglen);
/** \ingroup rpmts
* Get OpenPGP packet parameters, i.e. signature/pubkey constants.
* @param ts transaction set
* @return signature/pubkey constants.
*/
-/*@exposed@*/ /*@null@*/
-pgpDig rpmtsDig(rpmts ts)
- /*@*/;
+pgpDig rpmtsDig(rpmts ts);
/** \ingroup rpmts
* Get OpenPGP signature constants.
* @param ts transaction set
* @return signature constants.
*/
-/*@exposed@*/ /*@null@*/
-pgpDigParams rpmtsSignature(const rpmts ts)
- /*@*/;
+pgpDigParams rpmtsSignature(const rpmts ts);
/** \ingroup rpmts
* Get OpenPGP pubkey constants.
* @param ts transaction set
* @return pubkey constants.
*/
-/*@exposed@*/ /*@null@*/
-pgpDigParams rpmtsPubkey(const rpmts ts)
- /*@*/;
+pgpDigParams rpmtsPubkey(const rpmts ts);
/** \ingroup rpmts
* Get transaction set database handle.
* @param ts transaction set
* @return transaction database handle
*/
-/*@null@*/
-rpmdb rpmtsGetRdb(rpmts ts)
- /*@*/;
+rpmdb rpmtsGetRdb(rpmts ts);
/** \ingroup rpmts
* Initialize disk space info for each and every mounted file systems.
* @param ts transaction set
* @return 0 on success
*/
-int rpmtsInitDSI(const rpmts ts)
- /*@globals fileSystem, internalState @*/
- /*@modifies ts, fileSystem, internalState @*/;
+int rpmtsInitDSI(const rpmts ts);
/** \ingroup rpmts
* Update disk space info for a file.
*/
void rpmtsUpdateDSI(const rpmts ts, dev_t dev,
uint_32 fileSize, uint_32 prevSize, uint_32 fixupSize,
- fileAction action)
- /*@modifies ts @*/;
+ fileAction action);
/** \ingroup rpmts
* Check a transaction element for disk space problems.
* @param ts transaction set
* @param te current transaction element
*/
-void rpmtsCheckDSIProblems(const rpmts ts, const rpmte te)
- /*@modifies ts @*/;
+void rpmtsCheckDSIProblems(const rpmts ts, const rpmte te);
/**
* Perform transaction progress notify callback.
* @param total final value
* @return callback dependent pointer
*/
-/*@null@*/
void * rpmtsNotify(rpmts ts, rpmte te,
- rpmCallbackType what, unsigned long amount, unsigned long total)
- /*@*/;
+ rpmCallbackType what, unsigned long amount, unsigned long total);
/**
* Return number of (ordered) transaction set elements.
* @param ts transaction set
* @return no. of transaction set elements
*/
-int rpmtsNElements(rpmts ts)
- /*@*/;
+int rpmtsNElements(rpmts ts);
/**
* Return (ordered) transaction set element.
* @param ix transaction element index
* @return transaction element (or NULL)
*/
-/*@null@*/ /*@dependent@*/
-rpmte rpmtsElement(rpmts ts, int ix)
- /*@*/;
+rpmte rpmtsElement(rpmts ts, int ix);
/** \ingroup rpmts
* Get problem ignore bit mask, i.e. bits to filter encountered problems.
* @param ts transaction set
* @return ignore bit mask
*/
-rpmprobFilterFlags rpmtsFilterFlags(rpmts ts)
- /*@*/;
+rpmprobFilterFlags rpmtsFilterFlags(rpmts ts);
/** \ingroup rpmts
* Get transaction flags, i.e. bits that control rpmtsRun().
* @param ts transaction set
* @return transaction flags
*/
-rpmtransFlags rpmtsFlags(rpmts ts)
- /*@*/;
+rpmtransFlags rpmtsFlags(rpmts ts);
/** \ingroup rpmts
* Set transaction flags, i.e. bits that control rpmtsRun().
* @param transFlags new transaction flags
* @return previous transaction flags
*/
-rpmtransFlags rpmtsSetFlags(rpmts ts, rpmtransFlags transFlags)
- /*@modifies ts @*/;
+rpmtransFlags rpmtsSetFlags(rpmts ts, rpmtransFlags transFlags);
/** \ingroup rpmts
* Get spec control structure from transaction set.
* @param ts transaction set
* @return spec control structure
*/
-/*@null@*/
-Spec rpmtsSpec(rpmts ts)
- /*@*/;
+Spec rpmtsSpec(rpmts ts);
/** \ingroup rpmts
* Set a spec control structure in transaction set.
* @param spec new spec control structure
* @return previous spec control structure
*/
-/*@null@*/
-Spec rpmtsSetSpec(rpmts ts, /*@null@*/ Spec spec)
- /*@modifies ts @*/;
+Spec rpmtsSetSpec(rpmts ts, Spec spec);
/** \ingroup rpmts
* Get current relocate transaction element.
* @param ts transaction set
* @return current relocate transaction element
*/
-/*@null@*/
-rpmte rpmtsRelocateElement(rpmts ts)
- /*@*/;
+rpmte rpmtsRelocateElement(rpmts ts);
/** \ingroup rpmts
* Set current relocate transaction element.
* @param relocateElement new relocate transaction element
* @return previous relocate transaction element
*/
-/*@null@*/
-rpmte rpmtsSetRelocateElement(rpmts ts, /*@null@*/ rpmte relocateElement)
- /*@modifies ts @*/;
+rpmte rpmtsSetRelocateElement(rpmts ts, rpmte relocateElement);
/**
* Retrieve color bits of transaction set.
* @param ts transaction set
* @return color bits
*/
-uint_32 rpmtsColor(rpmts ts)
- /*@*/;
+uint_32 rpmtsColor(rpmts ts);
/**
* Retrieve prefered file color
* @param ts transaction set
* @return color bits
*/
-uint_32 rpmtsPrefColor(rpmts ts)
- /*@*/;
+uint_32 rpmtsPrefColor(rpmts ts);
/**
* Set color bits of transaction set.
* @param color new color bits
* @return previous color bits
*/
-uint_32 rpmtsSetColor(rpmts ts, uint_32 color)
- /*@modifies ts @*/;
+uint_32 rpmtsSetColor(rpmts ts, uint_32 color);
/**
* Retrieve operation timestamp from a transaction set.
* @param opx operation timestamp index
* @return pointer to operation timestamp.
*/
-/*@relnull@*/
-rpmop rpmtsOp(rpmts ts, rpmtsOpX opx)
- /*@*/;
+rpmop rpmtsOp(rpmts ts, rpmtsOpX opx);
/** \ingroup rpmts
* Set transaction notify callback function and argument.
* @return 0 on success
*/
int rpmtsSetNotifyCallback(rpmts ts,
- /*@observer@*/ rpmCallbackFunction notify,
- /*@observer@*/ rpmCallbackData notifyData)
- /*@modifies ts @*/;
+ rpmCallbackFunction notify,
+ rpmCallbackData notifyData);
/** \ingroup rpmts
* Create an empty transaction set.
* @return new transaction set
*/
-/*@newref@*/
-rpmts rpmtsCreate(void)
- /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
- /*@modifies rpmGlobalMacroContext, internalState @*/;
+rpmts rpmtsCreate(void);
/** \ingroup rpmts
* Add package to be installed to transaction set.
* @return 0 on success, 1 on I/O error, 2 needs capabilities
*/
int rpmtsAddInstallElement(rpmts ts, Header h,
- /*@exposed@*/ /*@null@*/ const fnpyKey key, int upgrade,
- /*@null@*/ rpmRelocation * relocs)
- /*@globals rpmcliPackagesTotal, rpmGlobalMacroContext, h_errno,
- fileSystem, internalState @*/
- /*@modifies ts, h, rpmcliPackagesTotal, rpmGlobalMacroContext,
- fileSystem, internalState @*/;
+ const fnpyKey key, int upgrade,
+ rpmRelocation * relocs);
/** \ingroup rpmts
* Add package to be erased to transaction set.
* @param dboffset rpm database instance
* @return 0 on success
*/
-int rpmtsAddEraseElement(rpmts ts, Header h, int dboffset)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies ts, h, rpmGlobalMacroContext, fileSystem, internalState @*/;
+int rpmtsAddEraseElement(rpmts ts, Header h, int dboffset);
/** \ingroup rpmts
* Retrieve keys from ordered transaction set.
* @retval nep address of no. of returned elements (or NULL)
* @return 0 always
*/
-/*@unused@*/
int rpmtsGetKeys(rpmts ts,
- /*@null@*/ /*@out@*/ fnpyKey ** ep,
- /*@null@*/ /*@out@*/ int * nep)
- /*@globals fileSystem, internalState @*/
- /*@modifies ts, ep, nep, fileSystem, internalState @*/;
+ fnpyKey ** ep,
+ int * nep);
/**
* Return (malloc'd) header name-version-release string.
* @retval np name tag value
* @return name-version-release string
*/
-/*@only@*/ char * hGetNEVR(Header h, /*@null@*/ /*@out@*/ const char ** np )
- /*@modifies *np @*/;
+char * hGetNEVR(Header h, const char ** np );
/**
* Return (malloc'd) header name-version-release.arch string.
* @retval np name tag value
* @return name-version-release string
*/
-/*@only@*/ char * hGetNEVRA(Header h, /*@null@*/ /*@out@*/ const char ** np )
- /*@modifies *np @*/;
+char * hGetNEVRA(Header h, const char ** np );
/**
* Return header color.
* @param h header
* @return header color
*/
-uint_32 hGetColor(Header h)
- /*@modifies h @*/;
+uint_32 hGetColor(Header h);
#ifdef __cplusplus
}
two = str2;
/* loop through each version segment of str1 and str2 and compare them */
- /*@-branchstate@*/
-/*@-boundsread@*/
while (*one && *two) {
while (*one && !xisalnum(*one)) one++;
while (*two && !xisalnum(*two)) two++;
/* save character at the end of the alpha or numeric segment */
/* so that they can be restored after the comparison */
-/*@-boundswrite@*/
oldch1 = *str1;
*str1 = '\0';
oldch2 = *str2;
*str2 = '\0';
-/*@=boundswrite@*/
/* this cannot happen, as we previously tested to make sure that */
/* the first string has a non-null segment */
if (rc) return (rc < 1 ? -1 : 1);
/* restore character that was replaced by null above */
-/*@-boundswrite@*/
*str1 = oldch1;
one = str1;
*str2 = oldch2;
two = str2;
-/*@=boundswrite@*/
}
- /*@=branchstate@*/
-/*@=boundsread@*/
/* this catches the case where all numeric and alpha segments have */
/* compared identically but the segment sepparating characters were */
/* different */
-/*@-boundsread@*/
if ((!*one) && (!*two)) return 0;
/* whichever version still has characters left over wins */
if (!*one) return -1; else return 1;
-/*@=boundsread@*/
}
#include "header_internal.h"
#include "debug.h"
-/*@access FD_t@*/ /* XXX ufdio->read arg1 is void ptr */
-/*@access Header@*/ /* XXX compared with NULL */
-/*@access entryInfo @*/ /* XXX rpmReadSignature */
-/*@access indexEntry @*/ /* XXX rpmReadSignature */
-/*@access DIGEST_CTX@*/ /* XXX compared with NULL */
-/*@access pgpDig@*/
-/*@access pgpDigParams@*/
-
#if !defined(__GLIBC__) && !defined(__APPLE__)
char ** environ = NULL;
#endif
int rpmLookupSignatureType(int action)
{
- /*@unchecked@*/
static int disabled = 0;
int rc = 0;
break;
case RPMLOOKUPSIG_ENABLE:
disabled = 0;
- /*@fallthrough@*/
case RPMLOOKUPSIG_QUERY:
if (disabled)
break; /* Disabled */
-/*@-boundsread@*/
{ const char *name = rpmExpand("%{?_signature}", NULL);
if (!(name && *name != '\0'))
rc = 0;
rc = -1; /* Invalid %_signature spec in macro file */
name = _free(name);
} break;
-/*@=boundsread@*/
}
return rc;
}
char *pgpvbin;
struct stat st;
-/*@-boundsread@*/
if (!(pgpbin && pgpbin[0] != '\0')) {
pgpbin = _free(pgpbin);
saved_pgp_version = -1;
return NULL;
}
-/*@=boundsread@*/
-/*@-boundswrite@*/
pgpvbin = (char *)alloca(strlen(pgpbin) + sizeof("v"));
(void)stpcpy(stpcpy(pgpvbin, pgpbin), "v");
-/*@=boundswrite@*/
if (stat(pgpvbin, &st) == 0)
saved_pgp_version = PGP_5;
saved_pgp_version = PGP_NOTDETECTED;
}
-/*@-boundswrite@*/
if (pgpVer && pgpbin)
*pgpVer = saved_pgp_version;
-/*@=boundswrite@*/
return pgpbin;
}
* @return rpmRC return code
*/
static inline rpmRC printSize(FD_t fd, int siglen, int pad, int datalen)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/
{
struct stat st;
int fdno = Fileno(fd);
/* HACK: workaround for davRead wiring. */
if (fdno == 123456789) {
st.st_size = 0;
-/*@-sizeoftype@*/
st.st_size -= sizeof(struct rpmlead)+siglen+pad+datalen;
-/*@=sizeoftype@*/
} else if (fstat(fdno, &st) < 0)
return RPMRC_FAIL;
-/*@-sizeoftype@*/
rpmMessage(RPMMESS_DEBUG,
_("Expected size: %12d = lead(%d)+sigs(%d)+pad(%d)+data(%d)\n"),
(int)sizeof(struct rpmlead)+siglen+pad+datalen,
(int)sizeof(struct rpmlead), siglen, pad, datalen);
-/*@=sizeoftype@*/
rpmMessage(RPMMESS_DEBUG,
_(" Actual size: %12d\n"), (int)st.st_size);
return RPMRC_OK;
}
-/*@unchecked@*/
static unsigned char header_magic[8] = {
0x8e, 0xad, 0xe8, 0x01, 0x00, 0x00, 0x00, 0x00
};
int xx;
int i;
-/*@-boundswrite@*/
if (sighp)
*sighp = NULL;
buf[0] = '\0';
-/*@=boundswrite@*/
if (sig_type != RPMSIGTYPE_HEADERSIG)
goto exit;
_("sigh magic: BAD\n"));
goto exit;
}
-/*@-boundsread@*/
il = ntohl(block[2]);
-/*@=boundsread@*/
if (il < 0 || il > 32) {
(void) snprintf(buf, sizeof(buf),
_("sigh tags: BAD, no. of tags(%d) out of range\n"), il);
goto exit;
}
-/*@-boundsread@*/
dl = ntohl(block[3]);
-/*@=boundsread@*/
if (dl < 0 || dl > 8192) {
(void) snprintf(buf, sizeof(buf),
_("sigh data: BAD, no. of bytes(%d) out of range\n"), dl);
goto exit;
}
-/*@-sizeoftype@*/
nb = (il * sizeof(struct entryInfo_s)) + dl;
-/*@=sizeoftype@*/
ei = xmalloc(sizeof(il) + sizeof(dl) + nb);
-/*@-bounds@*/
ei[0] = block[2];
ei[1] = block[3];
pe = (entryInfo) &ei[2];
-/*@=bounds@*/
dataStart = (unsigned char *) (pe + il);
if ((xx = timedRead(fd, (void *)pe, nb)) != nb) {
(void) snprintf(buf, sizeof(buf),
}
/* Is there an immutable header region tag? */
-/*@-sizeoftype@*/
if (entry->info.tag == RPMTAG_HEADERSIGNATURES
&& entry->info.type == RPM_BIN_TYPE
&& entry->info.count == REGION_TAG_COUNT)
{
-/*@=sizeoftype@*/
if (entry->info.offset >= dl) {
(void) snprintf(buf, sizeof(buf),
/* Is there an immutable header region tag trailer? */
dataEnd = dataStart + entry->info.offset;
-/*@-sizeoftype@*/
-/*@-bounds@*/
(void) memcpy(info, dataEnd, REGION_TAG_COUNT);
/* XXX Really old packages have HEADER_IMAGE, not HEADER_SIGNATURES. */
if (info->tag == htonl(RPMTAG_HEADERIMAGE)) {
info->tag = stag;
memcpy(dataEnd, &stag, sizeof(stag));
}
-/*@=bounds@*/
dataEnd += REGION_TAG_COUNT;
xx = headerVerifyInfo(1, dl, info, &entry->info, 1);
entry->info.offset, entry->info.count);
goto exit;
}
-/*@=sizeoftype@*/
-/*@-boundswrite@*/
memset(info, 0, sizeof(*info));
-/*@=boundswrite@*/
/* Is the no. of tags in the region less than the total no. of tags? */
ril = entry->info.offset/sizeof(*pe);
}
/* Sanity check signature tags */
-/*@-boundswrite@*/
memset(info, 0, sizeof(*info));
-/*@=boundswrite@*/
for (i = 1; i < il; i++) {
xx = headerVerifyInfo(1, dl, pe+i, &entry->info, 0);
if (xx != -1) {
}
exit:
-/*@-boundswrite@*/
if (sighp && sigh && rc == RPMRC_OK)
*sighp = headerLink(sigh);
sigh = headerFree(sigh);
buf[sizeof(buf)-1] = '\0';
*msg = xstrdup(buf);
}
-/*@=boundswrite@*/
return rc;
}
sigSize = headerSizeof(sigh, HEADER_MAGIC_YES);
pad = (8 - (sigSize % 8)) % 8;
if (pad) {
-/*@-boundswrite@*/
if (Fwrite(buf, sizeof(buf[0]), pad, fd) != pad)
rc = 1;
-/*@=boundswrite@*/
}
rpmMessage(RPMMESS_DEBUG, _("Signature: size(%d)+pad(%d)\n"), sigSize, pad);
return rc;
* @return 0 on success, 1 on failure
*/
static int makePGPSignature(const char * file, int_32 * sigTagp,
- /*@out@*/ byte ** pktp, /*@out@*/ int_32 * pktlenp,
- /*@null@*/ const char * passPhrase)
- /*@globals errno, rpmGlobalMacroContext, h_errno,
- fileSystem, internalState @*/
- /*@modifies errno, *pktp, *pktlenp, rpmGlobalMacroContext,
- fileSystem, internalState @*/
+ byte ** pktp, int_32 * pktlenp,
+ const char * passPhrase)
{
char * sigfile = alloca(1024);
int pid, status;
#endif
int rc;
-/*@-boundswrite@*/
(void) stpcpy( stpcpy(sigfile, file), ".sig");
-/*@=boundswrite@*/
addMacro(NULL, "__plaintext_filename", NULL, file, -1);
addMacro(NULL, "__signature_filename", NULL, sigfile, -1);
inpipe[0] = inpipe[1] = 0;
-/*@-boundsread@*/
(void) pipe(inpipe);
-/*@=boundsread@*/
if (!(pid = fork())) {
const char *pgp_path = rpmExpand("%{?_pgp_path}", NULL);
(void) close(inpipe[1]);
(void) dosetenv("PGPPASSFD", "3", 1);
-/*@-boundsread@*/
if (pgp_path && *pgp_path != '\0')
(void) dosetenv("PGPPATH", pgp_path, 1);
-/*@=boundsread@*/
/* dosetenv("PGPPASS", passPhrase, 1); */
case PGP_2:
cmd = rpmExpand("%{?__pgp_sign_cmd}", NULL);
rc = poptParseArgvString(cmd, NULL, (const char ***)&av);
-/*@-boundsread@*/
if (!rc)
rc = execve(av[0], av+1, environ);
-/*@=boundsread@*/
break;
case PGP_5:
cmd = rpmExpand("%{?__pgp5_sign_cmd}", NULL);
rc = poptParseArgvString(cmd, NULL, (const char ***)&av);
-/*@-boundsread@*/
if (!rc)
rc = execve(av[0], av+1, environ);
-/*@=boundsread@*/
break;
case PGP_UNKNOWN:
case PGP_NOTDETECTED:
return 1;
}
-/*@-boundswrite@*/
*pktlenp = st.st_size;
rpmMessage(RPMMESS_DEBUG, _("PGP sig size: %d\n"), *pktlenp);
*pktp = xmalloc(*pktlenp);
-/*@=boundswrite@*/
-/*@-boundsread@*/
{ FD_t fd;
rc = 0;
(void) Fclose(fd);
}
if (rc != *pktlenp) {
-/*@-boundswrite@*/
*pktp = _free(*pktp);
-/*@=boundswrite@*/
rpmError(RPMERR_SIGGEN, _("unable to read the signature\n"));
return 1;
}
}
rpmMessage(RPMMESS_DEBUG, _("Got %d bytes of PGP sig\n"), *pktlenp);
-/*@=boundsread@*/
#ifdef NOTYET
/* Parse the signature, change signature tag as appropriate. */
* @return 0 on success, 1 on failure
*/
static int makeGPGSignature(const char * file, int_32 * sigTagp,
- /*@out@*/ byte ** pktp, /*@out@*/ int_32 * pktlenp,
- /*@null@*/ const char * passPhrase)
- /*@globals rpmGlobalMacroContext, h_errno,
- fileSystem, internalState @*/
- /*@modifies *pktp, *pktlenp, rpmGlobalMacroContext,
- fileSystem, internalState @*/
+ byte ** pktp, int_32 * pktlenp,
+ const char * passPhrase)
{
char * sigfile = alloca(strlen(file)+sizeof(".sig"));
int pid, status;
pgpDigParams sigp = NULL;
int rc;
-/*@-boundswrite@*/
(void) stpcpy( stpcpy(sigfile, file), ".sig");
-/*@=boundswrite@*/
addMacro(NULL, "__plaintext_filename", NULL, file, -1);
addMacro(NULL, "__signature_filename", NULL, sigfile, -1);
inpipe[0] = inpipe[1] = 0;
-/*@-boundsread@*/
(void) pipe(inpipe);
-/*@=boundsread@*/
if (!(pid = fork())) {
const char *gpg_path = rpmExpand("%{?_gpg_path}", NULL);
(void) dup2(inpipe[0], 3);
(void) close(inpipe[1]);
-/*@-boundsread@*/
if (gpg_path && *gpg_path != '\0')
(void) dosetenv("GNUPGHOME", gpg_path, 1);
-/*@=boundsread@*/
(void) dosetenv("LC_ALL", "C", 1);
unsetenv("MALLOC_CHECK_");
cmd = rpmExpand("%{?__gpg_sign_cmd}", NULL);
rc = poptParseArgvString(cmd, NULL, (const char ***)&av);
-/*@-boundsread@*/
if (!rc)
rc = execve(av[0], av+1, environ);
-/*@=boundsread@*/
rpmError(RPMERR_EXEC, _("Could not exec %s: %s\n"), "gpg",
strerror(errno));
return 1;
}
-/*@-boundswrite@*/
*pktlenp = st.st_size;
rpmMessage(RPMMESS_DEBUG, _("GPG sig size: %d\n"), *pktlenp);
*pktp = xmalloc(*pktlenp);
-/*@=boundswrite@*/
-/*@-boundsread@*/
{ FD_t fd;
rc = 0;
(void) Fclose(fd);
}
if (rc != *pktlenp) {
-/*@-boundswrite@*/
*pktp = _free(*pktp);
-/*@=boundswrite@*/
rpmError(RPMERR_SIGGEN, _("unable to read the signature\n"));
return 1;
}
}
rpmMessage(RPMMESS_DEBUG, _("Got %d bytes of GPG sig\n"), *pktlenp);
-/*@=boundsread@*/
/* Parse the signature, change signature tag as appropriate. */
dig = pgpNewDig();
* @return 0 on success, -1 on failure
*/
static int makeHDRSignature(Header sigh, const char * file, int_32 sigTag,
- /*@null@*/ const char * passPhrase)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies sigh, rpmGlobalMacroContext, fileSystem, internalState @*/
+ const char * passPhrase)
{
Header h = NULL;
FD_t fd = NULL;
case RPMSIGTAG_PGP:
case RPMSIGTAG_GPG:
goto exit;
- /*@notreached@*/ break;
+ break;
case RPMSIGTAG_SHA1:
fd = Fopen(file, "r.fdio");
if (fd == NULL || Ferror(fd))
}
static int checkPassPhrase(const char * passPhrase, const int sigTag)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/
{
int passPhrasePipe[2];
int pid, status;
int xx;
passPhrasePipe[0] = passPhrasePipe[1] = 0;
-/*@-boundsread@*/
xx = pipe(passPhrasePipe);
-/*@=boundsread@*/
if (!(pid = fork())) {
const char * cmd;
char *const *av;
case RPMSIGTAG_GPG:
{ const char *gpg_path = rpmExpand("%{?_gpg_path}", NULL);
-/*@-boundsread@*/
if (gpg_path && *gpg_path != '\0')
(void) dosetenv("GNUPGHOME", gpg_path, 1);
-/*@=boundsread@*/
cmd = rpmExpand("%{?__gpg_check_password_cmd}", NULL);
rc = poptParseArgvString(cmd, NULL, (const char ***)&av);
-/*@-boundsread@*/
if (!rc)
rc = execve(av[0], av+1, environ);
-/*@=boundsread@*/
rpmError(RPMERR_EXEC, _("Could not exec %s: %s\n"), "gpg",
strerror(errno));
- } /*@notreached@*/ break;
+ } break;
case RPMSIGTAG_RSA:
case RPMSIGTAG_PGP5: /* XXX legacy */
case RPMSIGTAG_PGP:
pgpVersion pgpVer;
(void) dosetenv("PGPPASSFD", "3", 1);
-/*@-boundsread@*/
if (pgp_path && *pgp_path != '\0')
xx = dosetenv("PGPPATH", pgp_path, 1);
-/*@=boundsread@*/
if ((path = rpmDetectPGPVersion(&pgpVer)) != NULL) {
switch(pgpVer) {
case PGP_2:
cmd = rpmExpand("%{?__pgp_check_password_cmd}", NULL);
rc = poptParseArgvString(cmd, NULL, (const char ***)&av);
-/*@-boundsread@*/
if (!rc)
rc = execve(av[0], av+1, environ);
-/*@=boundsread@*/
- /*@innerbreak@*/ break;
+ break;
case PGP_5: /* XXX legacy */
cmd = rpmExpand("%{?__pgp5_check_password_cmd}", NULL);
rc = poptParseArgvString(cmd, NULL, (const char ***)&av);
-/*@-boundsread@*/
if (!rc)
rc = execve(av[0], av+1, environ);
-/*@=boundsread@*/
- /*@innerbreak@*/ break;
+ break;
case PGP_UNKNOWN:
case PGP_NOTDETECTED:
- /*@innerbreak@*/ break;
+ break;
}
}
rpmError(RPMERR_EXEC, _("Could not exec %s: %s\n"), "pgp",
strerror(errno));
_exit(RPMERR_EXEC);
- } /*@notreached@*/ break;
+ } break;
default: /* This case should have been screened out long ago. */
rpmError(RPMERR_SIGGEN, _("Invalid %%_signature spec in macro file\n"));
_exit(RPMERR_SIGGEN);
- /*@notreached@*/ break;
+ break;
}
}
switch (sigTag) {
case RPMSIGTAG_DSA:
case RPMSIGTAG_GPG:
-/*@-boundsread@*/
{ const char *name = rpmExpand("%{?_gpg_name}", NULL);
aok = (name && *name != '\0');
name = _free(name);
}
-/*@=boundsread@*/
if (aok)
break;
rpmError(RPMERR_SIGGEN,
case RPMSIGTAG_RSA:
case RPMSIGTAG_PGP5: /* XXX legacy */
case RPMSIGTAG_PGP:
-/*@-boundsread@*/
{ const char *name = rpmExpand("%{?_pgp_name}", NULL);
aok = (name && *name != '\0');
name = _free(name);
}
-/*@=boundsread@*/
if (aok)
break;
rpmError(RPMERR_SIGGEN,
}
if (aok) {
-/*@-moduncon -nullpass -unrecog @*/
pass = getpass( (prompt ? prompt : "") );
-/*@=moduncon =nullpass =unrecog @*/
if (checkPassPhrase(pass, sigTag))
pass = NULL;
return pass;
}
-static /*@observer@*/ const char * rpmSigString(rpmRC res)
- /*@*/
+static const char * rpmSigString(rpmRC res)
{
const char * str;
switch (res) {
return str;
}
-/*@-boundswrite@*/
static rpmRC
-verifySizeSignature(const rpmts ts, /*@out@*/ char * t)
- /*@modifies *t @*/
+verifySizeSignature(const rpmts ts, char * t)
{
const void * sig = rpmtsSig(ts);
pgpDig dig = rpmtsDig(ts);
t = stpcpy(t, "\n");
return res;
}
-/*@=boundswrite@*/
-/*@-boundswrite@*/
static rpmRC
-verifyMD5Signature(const rpmts ts, /*@out@*/ char * t,
- /*@null@*/ DIGEST_CTX md5ctx)
- /*@globals internalState @*/
- /*@modifies *t, internalState @*/
+verifyMD5Signature(const rpmts ts, char * t,
+ DIGEST_CTX md5ctx)
{
const void * sig = rpmtsSig(ts);
int_32 siglen = rpmtsSiglen(ts);
t = stpcpy(t, "\n");
return res;
}
-/*@=boundswrite@*/
-/*@-boundswrite@*/
/**
* Verify header immutable region SHA1 digest.
* @param ts transaction set
* @return RPMRC_OK on success
*/
static rpmRC
-verifySHA1Signature(const rpmts ts, /*@out@*/ char * t,
- /*@null@*/ DIGEST_CTX sha1ctx)
- /*@globals internalState @*/
- /*@modifies *t, internalState @*/
+verifySHA1Signature(const rpmts ts, char * t,
+ DIGEST_CTX sha1ctx)
{
const void * sig = rpmtsSig(ts);
#ifdef NOTYET
t = stpcpy(t, "\n");
return res;
}
-/*@=boundswrite@*/
/**
* Convert hex to binary nibble.
* @return binary nibble
*/
static inline unsigned char nibble(char c)
- /*@*/
{
if (c >= '0' && c <= '9')
return (c - '0');
return 0;
}
-/*@-boundswrite@*/
/**
* Verify RSA signature.
* @param ts transaction set
* @return RPMRC_OK on success
*/
static rpmRC
-verifyRSASignature(rpmts ts, /*@out@*/ char * t,
- /*@null@*/ DIGEST_CTX md5ctx)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies ts, *t, rpmGlobalMacroContext, fileSystem, internalState */
+verifyRSASignature(rpmts ts, char * t,
+ DIGEST_CTX md5ctx)
{
const void * sig = rpmtsSig(ts);
#ifdef NOTYET
case PGPPUBKEYALGO_RSA:
if (sigtag == RPMSIGTAG_PGP || sigtag == RPMSIGTAG_PGP5 || sigtag == RPMSIGTAG_RSA)
break;
- /*@fallthrough@*/
default:
res = RPMRC_NOKEY;
break;
t = stpcpy(t, "\n");
return res;
}
-/*@=boundswrite@*/
/**
* Verify DSA signature.
* @param sha1ctx
* @return RPMRC_OK on success
*/
-/*@-boundswrite@*/
static rpmRC
-verifyDSASignature(rpmts ts, /*@out@*/ char * t,
- /*@null@*/ DIGEST_CTX sha1ctx)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies ts, *t, rpmGlobalMacroContext, fileSystem, internalState */
+verifyDSASignature(rpmts ts, char * t,
+ DIGEST_CTX sha1ctx)
{
const void * sig = rpmtsSig(ts);
#ifdef NOTYET
t = stpcpy(t, "\n");
return res;
}
-/*@=boundswrite@*/
rpmRC
rpmVerifySignature(const rpmts ts, char * result)
* Return new, empty (signature) header instance.
* @return signature header
*/
-Header rpmNewSignature(void)
- /*@*/;
+Header rpmNewSignature(void);
/** \ingroup signature
* Read (and verify header+payload size) signature header.
* @retval msg failure msg
* @return rpmRC return code
*/
-rpmRC rpmReadSignature(FD_t fd, /*@null@*/ /*@out@*/ Header *sighp,
- sigType sig_type, /*@null@*/ /*@out@*/ const char ** msg)
- /*@globals fileSystem @*/
- /*@modifies fd, *sighp, *msg, fileSystem @*/;
+rpmRC rpmReadSignature(FD_t fd, Header *sighp,
+ sigType sig_type, const char ** msg);
/** \ingroup signature
* Write signature header.
* @param h (signature) header
* @return 0 on success, 1 on error
*/
-int rpmWriteSignature(FD_t fd, Header h)
- /*@globals fileSystem @*/
- /*@modifies fd, h, fileSystem @*/;
+int rpmWriteSignature(FD_t fd, Header h);
/** \ingroup signature
* Generate signature(s) from a header+payload file, save in signature header.
* @return 0 on success, -1 on failure
*/
int rpmAddSignature(Header sigh, const char * file,
- int_32 sigTag, /*@null@*/ const char * passPhrase)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies sigh, rpmGlobalMacroContext, fileSystem, internalState @*/;
+ int_32 sigTag, const char * passPhrase);
/******************************************************************/
* @param action enable/disable/query action
* @return sigTag to use, 0 if none, -1 on error
*/
-int rpmLookupSignatureType(int action)
- /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
- /*@modifies rpmGlobalMacroContext, internalState @*/;
+int rpmLookupSignatureType(int action);
/** \ingroup signature
* Read a pass phrase using getpass(3), confirm with gpg/pgp helper binaries.
* @param sigTag signature type/tag
* @return pass phrase
*/
-/*@dependent@*/ /*@null@*/
-char * rpmGetPassPhrase(/*@null@*/ const char * prompt,
- const int sigTag)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/;
+char * rpmGetPassPhrase(const char * prompt,
+ const int sigTag);
/** \ingroup signature
* Return path to pgp executable of given type, or NULL when not found.
* @retval pgpVer pgp version
* @return path to pgp executable
*/
-/*@-exportlocal -redecl@*/
-/*@null@*/ const char * rpmDetectPGPVersion(
- /*@null@*/ /*@out@*/ pgpVersion * pgpVer)
- /*@globals rpmGlobalMacroContext, h_errno @*/
- /*@modifies *pgpVer, rpmGlobalMacroContext @*/;
-/*@=exportlocal =redecl@*/
+const char * rpmDetectPGPVersion(
+ pgpVersion * pgpVer);
#ifdef __cplusplus
}
#define BUF_CHUNK 1024
struct StringBufRec {
-/*@owned@*/
char *buf;
-/*@dependent@*/
char *tail; /* Points to first "free" char */
int allocated;
int free;
/**
* Locale insensitive isspace(3).
*/
-/*@unused@*/ static inline int xisspace(int c) /*@*/ {
+static inline int xisspace(int c) {
return (c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '\f' || c == '\v');
}
* @param p memory to free
* @return NULL always
*/
-/*@unused@*/ static inline /*@null@*/ void *
-_free(/*@only@*/ /*@null@*/ /*@out@*/ const void * p) /*@modifies *p @*/
+static inline void *
+_free(const void * p)
{
if (p != NULL) free((void *)p);
return NULL;
void truncStringBuf(StringBuf sb)
{
-/*@-boundswrite@*/
sb->buf[0] = '\0';
-/*@=boundswrite@*/
sb->tail = sb->buf;
sb->free = sb->allocated;
}
void stripTrailingBlanksStringBuf(StringBuf sb)
{
-/*@-bounds@*/
while (sb->free != sb->allocated) {
if (! xisspace(*(sb->tail - 1)))
break;
sb->tail--;
}
sb->tail[0] = '\0';
-/*@=bounds@*/
}
char * getStringBuf(StringBuf sb)
sb->tail = sb->buf + (sb->allocated - sb->free);
}
-/*@-boundswrite@*/
- /*@-mayaliasunique@*/ /* FIX: shrug */
+ /* FIX: shrug */
strcpy(sb->tail, s);
- /*@=mayaliasunique@*/
sb->tail += l;
sb->free -= l;
if (nl) {
sb->tail++;
sb->free--;
}
-/*@=boundswrite@*/
}
/**
*/
-typedef /*@abstract@*/ struct StringBufRec *StringBuf;
+typedef struct StringBufRec *StringBuf;
#ifdef __cplusplus
extern "C" {
/**
*/
-/*@only@*/ StringBuf newStringBuf(void)
- /*@*/;
+StringBuf newStringBuf(void);
/**
*/
-/*@null@*/ StringBuf freeStringBuf( /*@only@*/ /*@null@*/ StringBuf sb)
- /*@modifies sb @*/;
+StringBuf freeStringBuf( StringBuf sb);
/**
*/
-/*@unused@*/
-void truncStringBuf(StringBuf sb)
- /*@modifies sb @*/;
+void truncStringBuf(StringBuf sb);
/**
*/
-/*@observer@*/ char * getStringBuf(StringBuf sb)
- /*@*/;
+char * getStringBuf(StringBuf sb);
/**
*/
-void stripTrailingBlanksStringBuf(StringBuf sb)
- /*@modifies sb @*/;
+void stripTrailingBlanksStringBuf(StringBuf sb);
/**
*/
/**
*/
-void appendStringBufAux(StringBuf sb, const char * s, int nl)
- /*@modifies sb @*/;
+void appendStringBufAux(StringBuf sb, const char * s, int nl);
#ifdef __cplusplus
}
static const char * defaultQueryFormat =
"%{name}-%{version}-%{release}.%|SOURCERPM?{%{arch}.rpm}:{%|ARCH?{src.rpm}:{pubkey}|}|";
-/*@only@*/ /*@null@*/
static const char * rpmgiPathOrQF(const rpmgi gi)
- /*@*/
{
const char * fmt = ((queryFormat != NULL)
? queryFormat : defaultQueryFormat);
#include "idtx.h"
-/*@access Header @*/ /* XXX ts->notify arg1 is void ptr */
-/*@access rpmps @*/ /* XXX need rpmProblemSetOK() */
-/*@access dbiIndexSet @*/
-
-/*@access rpmpsm @*/
-
-/*@access alKey @*/
-/*@access fnpyKey @*/
-
-/*@access rpmfi @*/
-
-/*@access rpmte @*/
-/*@access rpmtsi @*/
-/*@access rpmts @*/
-
-/*@access IDT @*/
-/*@access IDTX @*/
-/*@access FD_t @*/
/* XXX: This is a hack. I needed a to setup a notify callback
* for the rollback transaction, but I did not want to create
* a header for rpminstall.c.
*/
-extern void * rpmShowProgress(/*@null@*/ const void * arg,
+extern void * rpmShowProgress(const void * arg,
const rpmCallbackType what,
const unsigned long amount,
const unsigned long total,
- /*@null@*/ fnpyKey key,
- /*@null@*/ void * data)
- /*@*/;
+ fnpyKey key,
+ void * data)
+ ;
/**
*/
-static int archOkay(/*@null@*/ const char * pkgArch)
- /*@*/
+static int archOkay(const char * pkgArch)
{
if (pkgArch == NULL) return 0;
return (rpmMachineScore(RPM_MACHTABLE_INSTARCH, pkgArch) ? 1 : 0);
/**
*/
-static int osOkay(/*@null@*/ const char * pkgOs)
- /*@*/
+static int osOkay(const char * pkgOs)
{
if (pkgOs == NULL) return 0;
return (rpmMachineScore(RPM_MACHTABLE_INSTOS, pkgOs) ? 1 : 0);
/**
*/
static int sharedCmp(const void * one, const void * two)
- /*@*/
{
sharedFileInfo a = (sharedFileInfo) one;
sharedFileInfo b = (sharedFileInfo) two;
* @param reportConflicts
*/
/* XXX only ts->{probs,rpmdb} modified */
-/*@-bounds@*/
static int handleInstInstalledFiles(const rpmts ts,
rpmte p, rpmfi fi,
sharedFileInfo shared,
int sharedCount, int reportConflicts)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies ts, fi, rpmGlobalMacroContext, fileSystem, internalState @*/
{
uint_32 tscolor = rpmtsColor(ts);
uint_32 prefcolor = rpmtsPrefColor(ts);
}
/* Save file identifier to mark as state REPLACED. */
if ( !(isCfgFile || XFA_SKIPPING(fi->actions[fileNum])) ) {
- /*@-assignexpose@*/ /* FIX: p->replaced, not fi */
+ /* FIX: p->replaced, not fi */
if (!shared->isRemoved)
fi->replaced[numReplaced++] = *shared;
- /*@=assignexpose@*/
}
}
return 0;
}
-/*@=bounds@*/
/**
*/
/* XXX only ts->rpmdb modified */
static int handleRmvdInstalledFiles(const rpmts ts, rpmfi fi,
sharedFileInfo shared, int sharedCount)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies ts, fi, rpmGlobalMacroContext, fileSystem, internalState @*/
{
HGE_t hge = fi->hge;
Header h;
xx = hge(h, RPMTAG_FILESTATES, NULL, (void **) &otherStates, NULL);
-/*@-boundswrite@*/
for (i = 0; i < sharedCount; i++, shared++) {
int otherFileNum, fileNum;
otherFileNum = shared->otherFileNum;
fi->actions[fileNum] = FA_SKIP;
}
-/*@=boundswrite@*/
mi = rpmdbFreeIterator(mi);
#define ISROOT(_d) (((_d)[0] == '/' && (_d)[1] == '\0') ? "" : (_d))
-/*@unchecked@*/
int _fps_debug = 0;
static int fpsCompare (const void * one, const void * two)
- /*@*/
{
const struct fingerPrint_s * a = (const struct fingerPrint_s *)one;
const struct fingerPrint_s * b = (const struct fingerPrint_s *)two;
if (adnlen == 1 && asnlen != 0) adnlen = 0;
if (bdnlen == 1 && bsnlen != 0) bdnlen = 0;
-/*@-boundswrite@*/
afn = t = alloca(adnlen+asnlen+abnlen+2);
if (adnlen) t = stpcpy(t, a->entry->dirName);
*t++ = '/';
if (b->subDir && bsnlen) t = stpcpy(t, b->subDir);
if (bbnlen) t = stpcpy(t, b->baseName);
if (bfn[0] == '/' && bfn[1] == '/') bfn++;
-/*@=boundswrite@*/
rc = strcmp(afn, bfn);
-/*@-modfilesys@*/
if (_fps_debug)
fprintf(stderr, "\trc(%d) = strcmp(\"%s\", \"%s\")\n", rc, afn, bfn);
-/*@=modfilesys@*/
-/*@-modfilesys@*/
if (_fps_debug)
fprintf(stderr, "\t%s/%s%s\trc %d\n",
ISROOT(b->entry->dirName),
b->baseName,
rc
);
-/*@=modfilesys@*/
return rc;
}
-/*@unchecked@*/
static int _linear_fps_search = 0;
static int findFps(const struct fingerPrint_s * fiFps,
const struct fingerPrint_s * otherFps,
int otherFc)
- /*@*/
{
int otherFileNum;
-/*@-modfilesys@*/
if (_fps_debug)
fprintf(stderr, "==> %s/%s%s\n",
ISROOT(fiFps->entry->dirName),
(fiFps->subDir ? fiFps->subDir : ""),
fiFps->baseName);
-/*@=modfilesys@*/
if (_linear_fps_search) {
linear:
for (otherFileNum = 0; otherFileNum < otherFc; otherFileNum++, otherFps++) {
-/*@-modfilesys@*/
if (_fps_debug)
fprintf(stderr, "\t%4d %s/%s%s\n", otherFileNum,
ISROOT(otherFps->entry->dirName),
(otherFps->subDir ? otherFps->subDir : ""),
otherFps->baseName);
-/*@=modfilesys@*/
/* If the addresses are the same, so are the values. */
if (fiFps == otherFps)
break;
/* Otherwise, compare fingerprints by value. */
- /*@-nullpass@*/ /* LCL: looks good to me */
if (FP_EQUAL((*fiFps), (*otherFps)))
break;
- /*@=nullpass@*/
}
if (otherFileNum == otherFc) {
-/*@-modfilesys@*/
if (_fps_debug)
fprintf(stderr, "*** FP_EQUAL NULL %s/%s%s\n",
ISROOT(fiFps->entry->dirName),
(fiFps->subDir ? fiFps->subDir : ""),
fiFps->baseName);
-/*@=modfilesys@*/
}
return otherFileNum;
const struct fingerPrint_s * bingoFps;
-/*@-boundswrite@*/
bingoFps = bsearch(fiFps, otherFps, otherFc, sizeof(*otherFps), fpsCompare);
-/*@=boundswrite@*/
if (bingoFps == NULL) {
-/*@-modfilesys@*/
if (_fps_debug)
fprintf(stderr, "*** bingoFps NULL %s/%s%s\n",
ISROOT(fiFps->entry->dirName),
(fiFps->subDir ? fiFps->subDir : ""),
fiFps->baseName);
-/*@=modfilesys@*/
goto linear;
}
/* If the addresses are the same, so are the values. */
- /*@-nullpass@*/ /* LCL: looks good to me */
+ /* LCL: looks good to me */
if (!(fiFps == bingoFps || FP_EQUAL((*fiFps), (*bingoFps)))) {
-/*@-modfilesys@*/
if (_fps_debug)
fprintf(stderr, "*** BAD %s/%s%s\n",
ISROOT(bingoFps->entry->dirName),
(bingoFps->subDir ? bingoFps->subDir : ""),
bingoFps->baseName);
-/*@=modfilesys@*/
goto linear;
}
/* XXX only ts->{probs,di} modified */
static void handleOverlappedFiles(const rpmts ts,
const rpmte p, rpmfi fi)
- /*@globals h_errno, fileSystem, internalState @*/
- /*@modifies ts, fi, fileSystem, internalState @*/
{
uint_32 fixupSize = 0;
rpmps ps;
/* Added packages need only look at other added packages. */
if (rpmteType(p) == TR_ADDED && rpmteType(otherFi->te) != TR_ADDED)
- /*@innercontinue@*/ continue;
+ continue;
otherFps = otherFi->fps;
otherFc = rpmfiFC(otherFi);
/* XXX Happens iff fingerprint for incomplete package install. */
if (otherFi->actions[otherFileNum] != FA_UNKNOWN)
- /*@innerbreak@*/ break;
+ break;
}
oFColor = rpmfiFColor(otherFi);
oFColor &= tscolor;
-/*@-boundswrite@*/
switch (rpmteType(p)) {
case TR_ADDED:
{
if (otherPkgNum < 0) {
/* XXX is this test still necessary? */
if (fi->actions[i] != FA_UNKNOWN)
- /*@switchbreak@*/ break;
+ break;
if (rpmfiConfigConflict(fi)) {
/* Here is a non-overlapped pre-existing config file. */
fi->actions[i] = (FFlags & RPMFILE_NOREPLACE)
} else {
fi->actions[i] = FA_CREATE;
}
- /*@switchbreak@*/ break;
+ break;
}
assert(otherFi != NULL);
if (!done)
fi->actions[i] = FA_CREATE;
}
- } /*@switchbreak@*/ break;
+ } break;
case TR_REMOVED:
if (otherPkgNum >= 0) {
if (otherFi->actions[otherFileNum] != FA_ERASE) {
/* On updates, don't remove files. */
fi->actions[i] = FA_SKIP;
- /*@switchbreak@*/ break;
+ break;
}
/* Here is an overlapped removed file: skip in previous. */
otherFi->actions[otherFileNum] = FA_SKIP;
}
if (XFA_SKIPPING(fi->actions[i]))
- /*@switchbreak@*/ break;
+ break;
if (rpmfiFState(fi) != RPMFILE_STATE_NORMAL)
- /*@switchbreak@*/ break;
+ break;
if (!(S_ISREG(FMode) && (FFlags & RPMFILE_CONFIG))) {
fi->actions[i] = FA_ERASE;
- /*@switchbreak@*/ break;
+ break;
}
/* Here is a pre-existing modified config file that needs saving. */
const unsigned char * MD5 = rpmfiMD5(fi);
if (!domd5(fn, md5sum, 0, NULL) && memcmp(MD5, md5sum, 16)) {
fi->actions[i] = FA_BACKUP;
- /*@switchbreak@*/ break;
+ break;
}
}
fi->actions[i] = FA_ERASE;
- /*@switchbreak@*/ break;
+ break;
}
-/*@=boundswrite@*/
/* Update disk space info for a file. */
rpmtsUpdateDSI(ts, fiFps->entry->dev, rpmfiFSize(fi),
*/
static int ensureOlder(rpmts ts,
const rpmte p, const Header h)
- /*@modifies ts @*/
{
int_32 reqFlags = (RPMSENSE_LESS | RPMSENSE_EQUAL);
const char * reqEVR;
if (p == NULL || h == NULL)
return 1;
-/*@-boundswrite@*/
nb = strlen(rpmteNEVR(p)) + (rpmteE(p) != NULL ? strlen(rpmteE(p)) : 0) + 1;
t = alloca(nb);
*t = '\0';
if (rpmteV(p) != NULL) t = stpcpy(t, rpmteV(p));
*t++ = '-';
if (rpmteR(p) != NULL) t = stpcpy(t, rpmteR(p));
-/*@=boundswrite@*/
req = rpmdsSingle(RPMTAG_REQUIRENAME, rpmteN(p), reqEVR, reqFlags);
rc = rpmdsNVRMatchesDep(h, req, _rpmds_nopromote);
* @param ts transaction set
* @param fi file info set
*/
-/*@-mustmod@*/ /* FIX: fi->actions is modified. */
-/*@-bounds@*/
+/* FIX: fi->actions is modified. */
static void skipFiles(const rpmts ts, rpmfi fi)
- /*@globals rpmGlobalMacroContext, h_errno @*/
- /*@modifies fi, rpmGlobalMacroContext @*/
{
uint_32 tscolor = rpmtsColor(ts);
uint_32 FColor;
noDocs = rpmExpandNumeric("%{_excludedocs}");
{ const char *tmpPath = rpmExpand("%{_netsharedpath}", NULL);
- /*@-branchstate@*/
if (tmpPath && *tmpPath != '%')
netsharedPaths = splitString(tmpPath, strlen(tmpPath), ':');
- /*@=branchstate@*/
tmpPath = _free(tmpPath);
}
s = rpmExpand("%{_install_langs}", NULL);
- /*@-branchstate@*/
if (!(s && *s != '%'))
s = _free(s);
if (s) {
s = _free(s);
} else
languages = NULL;
- /*@=branchstate@*/
/* Compute directory refcount, skip directory if now empty. */
dc = rpmfiDC(fi);
len = strlen(*nsp);
if (dnlen >= len) {
if (strncmp(dn, *nsp, len))
- /*@innercontinue@*/ continue;
+ continue;
/* Only directories or complete file paths can be net shared */
if (!(dn[len] == '/' || dn[len] == '\0'))
- /*@innercontinue@*/ continue;
+ continue;
} else {
if (len < (dnlen + bnlen))
- /*@innercontinue@*/ continue;
+ continue;
if (strncmp(dn, *nsp, dnlen))
- /*@innercontinue@*/ continue;
+ continue;
/* Insure that only the netsharedpath basename is compared. */
if ((s = strchr((*nsp) + dnlen, '/')) != NULL && s[1] != '\0')
- /*@innercontinue@*/ continue;
+ continue;
if (strncmp(bn, (*nsp) + dnlen, bnlen))
- /*@innercontinue@*/ continue;
+ continue;
len = dnlen + bnlen;
/* Only directories or complete file paths can be net shared */
if (!((*nsp)[len] == '/' || (*nsp)[len] == '\0'))
- /*@innercontinue@*/ continue;
+ continue;
}
- /*@innerbreak@*/ break;
+ break;
}
if (nsp && *nsp) {
const char **lang, *l, *le;
for (lang = languages; *lang != NULL; lang++) {
if (!strcmp(*lang, "all"))
- /*@innerbreak@*/ break;
+ break;
for (l = fi->flangs[i]; *l != '\0'; l = le) {
for (le = l; *le != '\0' && *le != '|'; le++)
{};
if ((le-l) > 0 && !strncmp(*lang, l, (le-l)))
- /*@innerbreak@*/ break;
+ break;
if (*le == '|') le++; /* skip over | */
}
if (*l != '\0')
- /*@innerbreak@*/ break;
+ break;
}
if (*lang == NULL) {
drc[ix]--; dff[ix] = 1;
int_16 fFMode;
if (XFA_SKIPPING(fi->actions[i]))
- /*@innercontinue@*/ continue;
+ continue;
fFMode = rpmfiFMode(fi);
if (whatis(fFMode) != XDIR)
- /*@innercontinue@*/ continue;
+ continue;
fdn = rpmfiDN(fi);
if (strlen(fdn) != dnlen)
- /*@innercontinue@*/ continue;
+ continue;
if (strncmp(fdn, dn, dnlen))
- /*@innercontinue@*/ continue;
+ continue;
fbn = rpmfiBN(fi);
if (strlen(fbn) != bnlen)
- /*@innercontinue@*/ continue;
+ continue;
if (strncmp(fbn, bn, bnlen))
- /*@innercontinue@*/ continue;
+ continue;
rpmMessage(RPMMESS_DEBUG, _("excluding directory %s\n"), dn);
fi->actions[i] = FA_SKIPNSTATE;
- /*@innerbreak@*/ break;
+ break;
}
}
-/*@-dependenttrans@*/
if (netsharedPaths) freeSplitString(netsharedPaths);
#ifdef DYING /* XXX freeFi will deal with this later. */
fi->flangs = _free(fi->flangs);
#endif
if (languages) freeSplitString((char **)languages);
-/*@=dependenttrans@*/
}
-/*@=bounds@*/
-/*@=mustmod@*/
/**
* Return transaction element's file info.
* @param tsi transaction element iterator
* @return transaction element file info
*/
-static /*@null@*/
+static
rpmfi rpmtsiFi(const rpmtsi tsi)
- /*@*/
{
rpmfi fi = NULL;
if (tsi != NULL && tsi->ocsave != -1) {
- /*@-type -abstract@*/ /* FIX: rpmte not opaque */
+ /* FIX: rpmte not opaque */
rpmte te = rpmtsElement(tsi->ts, tsi->ocsave);
- /*@-assignexpose@*/
if (te != NULL && (fi = te->fi) != NULL)
fi->te = te;
- /*@=assignexpose@*/
- /*@=type =abstract@*/
}
- /*@-compdef -refcounttrans -usereleased @*/
return fi;
- /*@=compdef =refcounttrans =usereleased @*/
}
/**
* @return RPMRC_OK, or RPMRC_FAIL
*/
static rpmRC _rpmtsRollback(rpmts rollbackTransaction)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies rollbackTransaction,
- rpmGlobalMacroContext, fileSystem, internalState @*/
{
int rc = 0;
int numAdded = 0;
switch (rpmteType(te)) {
case TR_ADDED:
numAdded++;
- /*@switchbreak@*/ break;
+ break;
case TR_REMOVED:
numRemoved++;
- /*@switchbreak@*/ break;
+ break;
default:
- /*@switchbreak@*/ break;
+ break;
}
}
tsi = rpmtsiFree(tsi);
rpmMessage(RPMMESS_NORMAL, _("\tRemoving %s:\n"), te->key);
(void) unlink(te->key); /* XXX: Should check for an error? */
}
- /*@switchbreak@*/ break;
+ break;
/* Ignore erase elements...nothing to do */
default:
- /*@switchbreak@*/ break;
+ break;
}
}
tsi = rpmtsiFree(tsi);
* @return RPMRC_NOTFOUND or RPMRC_OK
*/
static rpmRC getRepackageHeaderFromTE(rpmts ts, rpmte te,
- /*@out@*/ /*@null@*/ Header *hdrp,
- /*@out@*/ /*@null@*/ const char **fnp)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies ts, *hdrp, *fnp,
- rpmGlobalMacroContext, fileSystem, internalState @*/
+ Header *hdrp,
+ const char **fnp)
{
int_32 tid;
const char * name;
/* Now walk through index until we find the package (or we have
* exhausted the index.
*/
-/*@-branchstate@*/
do {
/* If index is null we have exhausted the list and need to
* get out of here...the repackaged package was not found.
else
rpIDT = NULL;
} while (1);
-/*@=branchstate@*/
exit:
if (rc != RPMRC_NOTFOUND && h != NULL && hdrp != NULL) {
rpmMessage(RPMMESS_DEBUG, _("\tRepackaged Package was %s...\n"), rp);
if (hdrp != NULL)
*hdrp = headerLink(h);
-/*@-branchstate@*/
if (fnp != NULL)
*fnp = rp;
else
rp = _free(rp);
-/*@=branchstate@*/
}
if (h != NULL)
h = headerFree(h);
*/
static rpmRC _rpmtsAddRollbackElement(rpmts rollbackTransaction,
rpmts runningTransaction, rpmte te)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies rollbackTransaction, runningTransaction,
- rpmGlobalMacroContext, fileSystem, internalState @*/
{
Header h = NULL;
Header rph = NULL;
_("\tAdded from install element %s.\n"), rpmteNEVRA(te));
rc = rpmtsAddInstallElement(rollbackTransaction, headerLink(rph),
(fnpyKey) rpn, 1, te->relocs);
- /*@innerbreak@*/ break;
+ break;
case RPMRC_NOTFOUND:
/* Add the header as an erase element, we did not
rpmMessage(RPMMESS_DEBUG,
_("\tAdded from install element %s.\n"), rpmteNEVRA(te));
rc = rpmtsAddEraseElement(rollbackTransaction, h, db_instance);
- /*@innerbreak@*/ break;
+ break;
default:
/* Not sure what to do on failure...just give up */
rpmMessage(RPMMESS_FATALERROR,
_("Could not get repackaged header for auto-rollback transaction!\n"));
- /*@innerbreak@*/ break;
+ break;
}
} break;
if (rc != RPMRC_OK)
rpmMessage(RPMMESS_FATALERROR,
_("Could not add erase element to auto-rollback transaction.\n"));
- /*@innerbreak@*/ break;
+ break;
case RPMRC_NOTFOUND:
/* Just did not have a repackaged package */
rpmMessage(RPMMESS_DEBUG,
_("\tNo repackaged package...nothing to do.\n"));
rc = RPMRC_OK;
- /*@innerbreak@*/ break;
+ break;
default:
rpmMessage(RPMMESS_FATALERROR,
_("Failure reading repackaged package!\n"));
- /*@innerbreak@*/ break;
+ break;
}
break;
return rc;
}
-#define NOTIFY(_ts, _al) /*@i@*/ if ((_ts)->notify) (void) (_ts)->notify _al
+#define NOTIFY(_ts, _al) if ((_ts)->notify) (void) (_ts)->notify _al
int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
{
/* If we are in test mode, there is no need to rollback on
* failure, nor acquire the transaction lock.
*/
-/*@-branchstate@*/
/* If we are in test mode, then there's no need for transaction lock. */
if (rpmtsFlags(ts) & RPMTRANS_FLAG_TEST) {
rollbackOnFailure = 0;
if (lock == NULL)
return -1; /* XXX W2DO? */
}
-/*@=branchstate@*/
if (rpmtsFlags(ts) & RPMTRANS_FLAG_NOSCRIPTS)
(void) rpmtsSetFlags(ts, (rpmtsFlags(ts) | _noTransScripts | _noTransTriggers));
rpmteNEVR(p), rpmteKey(p),
NULL, NULL,
NULL, 0);
- /*@innerbreak@*/ break;
+ break;
}
mi = rpmdbFreeIterator(mi);
}
vsflags = rpmtsSetVSFlags(ts, ovsflags);
switch (rpmrc) {
default:
- /*@-noeffectuncon@*/ /* FIX: notify annotations */
+ /* FIX: notify annotations */
p->fd = ts->notify(p->h, RPMCALLBACK_INST_CLOSE_FILE,
0, 0,
rpmteKey(p), ts->notifyData);
- /*@=noeffectuncon@*/
p->fd = NULL;
- /*@switchbreak@*/ break;
+ break;
case RPMRC_NOTTRUSTED:
case RPMRC_NOKEY:
case RPMRC_OK:
- /*@switchbreak@*/ break;
+ break;
}
}
-/*@-branchstate@*/
if (rpmteFd(p) != NULL) {
fi = rpmfiNew(ts, p->h, RPMTAG_BASENAMES, 1);
if (fi != NULL) { /* XXX can't happen */
fi->te = p;
p->fi = fi;
}
-/*@-compdef -usereleased@*/ /* p->fi->te undefined */
psm = rpmpsmNew(ts, p, p->fi);
-/*@=compdef =usereleased@*/
assert(psm != NULL);
psm->scriptTag = RPMTAG_PRETRANS;
psm->progTag = RPMTAG_PRETRANSPROG;
xx = rpmpsmStage(psm, PSM_SCRIPT);
psm = rpmpsmFree(psm);
-/*@-noeffectuncon -compdef -usereleased @*/
(void) ts->notify(p->h, RPMCALLBACK_INST_CLOSE_FILE, 0, 0,
rpmteKey(p), ts->notifyData);
-/*@=noeffectuncon =compdef =usereleased @*/
p->fd = NULL;
p->h = headerFree(p->h);
}
-/*@=branchstate@*/
}
pi = rpmtsiFree(pi);
}
continue; /* XXX can't happen */
fc = rpmfiFC(fi);
- /*@-branchstate@*/
switch (rpmteType(p)) {
case TR_ADDED:
numAdded++;
/* Skip netshared paths, not our i18n files, and excluded docs */
if (fc > 0)
skipFiles(ts, fi);
- /*@switchbreak@*/ break;
+ break;
case TR_REMOVED:
numRemoved++;
fi->record = rpmteDBOffset(p);
- /*@switchbreak@*/ break;
+ break;
}
- /*@=branchstate@*/
fi->fps = (fc > 0 ? xmalloc(fc * sizeof(*fi->fps)) : NULL);
}
if (!rpmtsChrootDone(ts)) {
const char * rootDir = rpmtsRootDir(ts);
xx = chdir("/");
- /*@-superuser -noeffect @*/
if (rootDir != NULL && strcmp(rootDir, "/") && *rootDir == '/') {
/* opening db before chroot not optimal, see rhbz#103852 c#3 */
xx = rpmdbOpenAll(ts->rdb);
xx = chroot(rootDir);
}
- /*@=superuser =noeffect @*/
(void) rpmtsSetChrootDone(ts, 1);
}
(void) rpmswEnter(rpmtsOp(ts, RPMTS_OP_FINGERPRINT), 0);
fpLookupList(fpc, fi->dnl, fi->bnl, fi->dil, fc, fi->fps);
- /*@-branchstate@*/
fi = rpmfiInit(fi, 0);
if (fi != NULL) /* XXX lclint */
while ((i = rpmfiNext(fi)) >= 0) {
if (XFA_SKIPPING(fi->actions[i]))
- /*@innercontinue@*/ continue;
- /*@-dependenttrans@*/
+ continue;
htAddEntry(ts->ht, fi->fps + i, (void *) fi);
- /*@=dependenttrans@*/
}
- /*@=branchstate@*/
(void) rpmswExit(rpmtsOp(ts, RPMTS_OP_FINGERPRINT), fc);
}
qi = rpmtsiInit(ts);
while ((q = rpmtsiNext(qi, TR_REMOVED)) != NULL) {
if (ro == knownBad)
- /*@innerbreak@*/ break;
+ break;
if (rpmteDBOffset(q) == ro)
knownBad = ro;
}
qsort(sharedList, numShared, sizeof(*shared), sharedCmp);
/* For all files from this package that are in the database ... */
- /*@-branchstate@*/
for (i = 0; i < numShared; i = nexti) {
int beingRemoved;
/* Find the end of the files in the other package. */
for (nexti = i + 1; nexti < numShared; nexti++) {
if (sharedList[nexti].otherPkg != shared->otherPkg)
- /*@innerbreak@*/ break;
+ break;
}
/* Is this file from a package being removed? */
if (ts->removedPackages != NULL)
for (j = 0; j < ts->numRemovedPackages; j++) {
if (ts->removedPackages[j] != shared->otherPkg)
- /*@innercontinue@*/ continue;
+ continue;
beingRemoved = 1;
- /*@innerbreak@*/ break;
+ break;
}
/* Determine the fate of each file. */
case TR_ADDED:
xx = handleInstInstalledFiles(ts, p, fi, shared, nexti - i,
!(beingRemoved || (rpmtsFilterFlags(ts) & RPMPROB_FILTER_REPLACEOLDFILES)));
- /*@switchbreak@*/ break;
+ break;
case TR_REMOVED:
if (!beingRemoved)
xx = handleRmvdInstalledFiles(ts, fi, shared, nexti - i);
- /*@switchbreak@*/ break;
+ break;
}
}
- /*@=branchstate@*/
free(sharedList);
switch (rpmteType(p)) {
case TR_ADDED:
rpmtsCheckDSIProblems(ts, p);
- /*@switchbreak@*/ break;
+ break;
case TR_REMOVED:
- /*@switchbreak@*/ break;
+ break;
}
/* check for s-bit files to be removed */
if (rpmteType(p) == TR_REMOVED) {
if (rpmtsChrootDone(ts)) {
const char * rootDir = rpmtsRootDir(ts);
const char * currDir = rpmtsCurrDir(ts);
- /*@-superuser -noeffect @*/
if (rootDir != NULL && strcmp(rootDir, "/") && *rootDir == '/')
xx = chroot(".");
- /*@=superuser =noeffect @*/
(void) rpmtsSetChrootDone(ts, 0);
if (currDir != NULL)
xx = chdir(currDir);
continue; /* XXX can't happen */
switch (rpmteType(p)) {
case TR_ADDED:
- /*@switchbreak@*/ break;
+ break;
case TR_REMOVED:
if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_REPACKAGE))
- /*@switchbreak@*/ break;
+ break;
if (!progress)
NOTIFY(ts, (NULL, RPMCALLBACK_REPACKAGE_START,
7, numRemoved, NULL, ts->notifyData));
(void) rpmswExit(rpmtsOp(ts, RPMTS_OP_REPACKAGE), 0);
- /*@switchbreak@*/ break;
+ break;
}
}
pi = rpmtsiFree(pi);
*/
lastFailKey = (alKey)-2; /* erased packages have -1 */
pi = rpmtsiInit(ts);
- /*@-branchstate@*/ /* FIX: fi reload needs work */
+ /* FIX: fi reload needs work */
while ((p = rpmtsiNext(pi, 0)) != NULL) {
alKey pkgKey;
int gotfd;
rpmteNEVR(p), rpmteA(p), rpmteO(p), rpmteColor(p));
p->h = NULL;
- /*@-type@*/ /* FIX: rpmte not opaque */
+ /* FIX: rpmte not opaque */
{
- /*@-noeffectuncon@*/ /* FIX: notify annotations */
+ /* FIX: notify annotations */
p->fd = ts->notify(p->h, RPMCALLBACK_INST_OPEN_FILE, 0, 0,
rpmteKey(p), ts->notifyData);
- /*@=noeffectuncon@*/
if (rpmteFd(p) != NULL) {
rpmVSFlags ovsflags = rpmtsVSFlags(ts);
rpmVSFlags vsflags = ovsflags | RPMVSF_NEEDPAYLOAD;
switch (rpmrc) {
default:
- /*@-noeffectuncon@*/ /* FIX: notify annotations */
+ /* FIX: notify annotations */
p->fd = ts->notify(p->h, RPMCALLBACK_INST_CLOSE_FILE,
0, 0,
rpmteKey(p), ts->notifyData);
- /*@=noeffectuncon@*/
p->fd = NULL;
ourrc++;
xx = _rpmtsRollback(rollbackTransaction);
return -1;
}
- /*@innerbreak@*/ break;
+ break;
case RPMRC_NOTTRUSTED:
case RPMRC_NOKEY:
case RPMRC_OK:
- /*@innerbreak@*/ break;
+ break;
}
if (rpmteFd(p) != NULL) gotfd = 1;
}
}
- /*@=type@*/
if (rpmteFd(p) != NULL) {
/*
fi->fstates = NULL;
fi->actions = NULL;
fi->replaced = NULL;
-/*@-nullstate@*/ /* FIX: fi->actions is NULL */
+/* FIX: fi->actions is NULL */
fi = rpmfiFree(fi);
-/*@=nullstate@*/
savep = rpmtsSetRelocateElement(ts, p);
fi = rpmfiNew(ts, p->h, RPMTAG_BASENAMES, 1);
}
psm->fi = rpmfiLink(p->fi, NULL);
-/*@-nullstate@*/ /* FIX: psm->fi may be NULL */
+/* FIX: psm->fi may be NULL */
if (rpmpsmStage(psm, PSM_PKGINSTALL)) {
ourrc++;
lastFailKey = pkgKey;
return -1;
}
}
-/*@=nullstate@*/
} else {
ourrc++;
lastFailKey = pkgKey;
}
if (gotfd) {
- /*@-noeffectuncon @*/ /* FIX: check rc */
+ /* FIX: check rc */
(void) ts->notify(p->h, RPMCALLBACK_INST_CLOSE_FILE, 0, 0,
rpmteKey(p), ts->notifyData);
- /*@=noeffectuncon @*/
- /*@-type@*/
p->fd = NULL;
- /*@=type@*/
}
p->h = headerFree(p->h);
(void) rpmswExit(rpmtsOp(ts, RPMTS_OP_INSTALL), 0);
- /*@switchbreak@*/ break;
+ break;
case TR_REMOVED:
(void) rpmswEnter(rpmtsOp(ts, RPMTS_OP_ERASE), 0);
(void) rpmswExit(rpmtsOp(ts, RPMTS_OP_ERASE), 0);
- /*@switchbreak@*/ break;
+ break;
}
xx = rpmdbSync(rpmtsGetRdb(ts));
-/*@-nullstate@*/ /* FIX: psm->fi may be NULL */
+/* FIX: psm->fi may be NULL */
psm = rpmpsmFree(psm);
-/*@=nullstate@*/
#ifdef DYING
-/*@-type@*/ /* FIX: p is almost opaque */
+/* FIX: p is almost opaque */
p->fi = rpmfiFree(p->fi);
-/*@=type@*/
#endif
}
- /*@=branchstate@*/
pi = rpmtsiFree(pi);
/* If we created a rollback transaction lets get rid of it */
p->fd = ts->notify(p->h, RPMCALLBACK_INST_CLOSE_FILE,
0, 0, rpmteKey(p), ts->notifyData);
p->fd = NULL;
- /*@switchbreak@*/ break;
+ break;
case RPMRC_NOTTRUSTED:
case RPMRC_NOKEY:
case RPMRC_OK:
- /*@switchbreak@*/ break;
+ break;
}
}
p->fi = rpmfiNew(ts, p->h, RPMTAG_BASENAMES, 1);
if (p->fi != NULL) /* XXX can't happen */
p->fi->te = p;
-/*@-compdef -usereleased@*/ /* p->fi->te undefined */
psm = rpmpsmNew(ts, p, p->fi);
-/*@=compdef =usereleased@*/
assert(psm != NULL);
psm->scriptTag = RPMTAG_POSTTRANS;
psm->progTag = RPMTAG_POSTTRANSPROG;
xx = rpmpsmStage(psm, PSM_SCRIPT);
psm = rpmpsmFree(psm);
-/*@-noeffectuncon -compdef -usereleased @*/
(void) ts->notify(p->h, RPMCALLBACK_INST_CLOSE_FILE, 0, 0,
rpmteKey(p), ts->notifyData);
-/*@=noeffectuncon =compdef =usereleased @*/
p->fd = NULL;
p->fi = rpmfiFree(p->fi);
p->h = headerFree(p->h);
rpmtsFreeLock(lock);
- /*@-nullstate@*/ /* FIX: ts->flList may be NULL */
+ /* FIX: ts->flList may be NULL */
if (ourrc)
return -1;
else
return 0;
- /*@=nullstate@*/
}
#include "ugid.h"
#include "debug.h"
-/*@access rpmps @*/
-/*@access rpmProblem @*/
-/*@access rpmpsm @*/ /* XXX for %verifyscript through rpmpsmStage() */
-
#define S_ISDEV(m) (S_ISBLK((m)) || S_ISCHR((m)))
-/*@unchecked@*/
extern int _rpmds_unspecified_epoch_noise;
int rpmVerifyFile(const rpmts ts, const rpmfi fi,
int rc;
/* Prepend the path to root (if specified). */
-/*@-bounds@*/
if (rootDir && *rootDir != '\0'
&& !(rootDir[0] == '/' && rootDir[1] == '\0'))
{
t = stpcpy(t, fn);
fn = tb;
}
-/*@=bounds@*/
*res = RPMVERIFY_NONE;
case RPMFILE_STATE_NOTINSTALLED:
case RPMFILE_STATE_WRONGCOLOR:
return 0;
- /*@notreached@*/ break;
+ break;
case RPMFILE_STATE_NORMAL:
break;
}
*/
flags &= ~(omitMask | RPMVERIFY_FAILURES);
-/*@=branchstate@*/
if (flags & RPMVERIFY_MD5) {
unsigned char md5sum[16];
* @param scriptFd file handle to use for stderr (or NULL)
* @return 0 on success
*/
-static int rpmVerifyScript(/*@unused@*/ QVA_t qva, rpmts ts,
- rpmfi fi, /*@null@*/ FD_t scriptFd)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies ts, fi, scriptFd, rpmGlobalMacroContext,
- fileSystem, internalState @*/
+static int rpmVerifyScript(QVA_t qva, rpmts ts,
+ rpmfi fi, FD_t scriptFd)
{
rpmpsm psm = rpmpsmNew(ts, NULL, fi);
int rc = 0;
* @return 0 no problems, 1 problems found
*/
static int verifyHeader(QVA_t qva, const rpmts ts, rpmfi fi)
- /*@globals h_errno, fileSystem, internalState @*/
- /*@modifies ts, fi, fileSystem, internalState @*/
{
rpmVerifyAttrs verifyResult = 0;
- /*@-type@*/ /* FIX: union? */
+ /* FIX: union? */
rpmVerifyAttrs omitMask = ((qva->qva_flags & VERIFY_ATTRS) ^ VERIFY_ATTRS);
- /*@=type@*/
int ec = 0; /* assume no problems */
char * t, * te;
char buf[BUFSIZ];
&& (fileAttrs & RPMFILE_GHOST))
continue;
-/*@-boundswrite@*/
rc = rpmVerifyFile(ts, fi, &verifyResult, omitMask);
-/*@=boundswrite@*/
if (rc) {
if (!(fileAttrs & (RPMFILE_MISSINGOK|RPMFILE_GHOST)) || rpmIsVerbose()) {
sprintf(te, _("missing %c %s"),
} else if (verifyResult || rpmIsVerbose()) {
const char * size, * MD5, * link, * mtime, * mode;
const char * group, * user, * rdev;
- /*@observer@*/ static const char *const aok = ".";
- /*@observer@*/ static const char *const unknown = "?";
+ static const char *const aok = ".";
+ static const char *const unknown = "?";
ec = 1;
te += strlen(te);
}
-/*@-boundswrite@*/
if (te > t) {
*te++ = '\n';
*te = '\0';
te = t = buf;
*t = '\0';
}
-/*@=boundswrite@*/
}
fi = rpmfiUnlink(fi, "verifyHeader");
* @param h header
* @return 0 no problems, 1 problems found
*/
-static int verifyDependencies(/*@unused@*/ QVA_t qva, rpmts ts,
+static int verifyDependencies(QVA_t qva, rpmts ts,
Header h)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies ts, h, rpmGlobalMacroContext, fileSystem, internalState @*/
{
rpmps ps;
int numProblems;
ps = rpmtsProblems(ts);
numProblems = rpmpsNumProblems(ps);
- /*@-branchstate@*/
if (ps != NULL && numProblems > 0) {
const char * pkgNEVR, * altNEVR;
rpmProblem p;
nb += strlen(altNEVR+2) + sizeof(", ") - 1;
}
te = t = alloca(nb);
-/*@-boundswrite@*/
*te = '\0';
pkgNEVR = (ps->probs->pkgNEVR ? ps->probs->pkgNEVR : "?pkgNEVR?");
sprintf(te, _("Unsatisfied dependencies for %s: "), pkgNEVR);
te = t;
*t = '\0';
}
-/*@=boundswrite@*/
rc = 1;
}
- /*@=branchstate@*/
ps = rpmpsFree(ps);
if (qva->qva_flags & VERIFY_DEPS) {
int save_noise = _rpmds_unspecified_epoch_noise;
-/*@-mods@*/
if (rpmIsVerbose())
_rpmds_unspecified_epoch_noise = 1;
if ((rc = verifyDependencies(qva, ts, h)) != 0)
ec = rc;
_rpmds_unspecified_epoch_noise = save_noise;
-/*@=mods@*/
}
if (qva->qva_flags & VERIFY_FILES) {
if ((rc = verifyHeader(qva, ts, fi)) != 0)