Converging on lclint-3.0.17 strict level.

CVS patchset: 5118
CVS date: 2001/10/17 16:43:36
This commit is contained in:
jbj 2001-10-17 16:43:36 +00:00
parent 96a3f7a55d
commit d57a29baac
66 changed files with 1320 additions and 1104 deletions

View File

@ -1,7 +1,7 @@
-I. -I./build -I./lib -I./rpmdb -I./rpmio -I./beecrypt -I./popt -I/usr/lib/gcc-lib/i386-redhat-linux/2.96/include -DHAVE_CONFIG_H -D_GNU_SOURCE -D_REENTRANT -DHAVE_DEV_DSP -DHAVE_SYS_SOUNDCARD
#+partial
#+forcehints
+forcehints
-warnunixlib
-warnposix
@ -26,7 +26,6 @@
-ifblock # tedious
-incondefs # <bits/{ipc,pthreadtypes}.h> heartburn
-matchfields # <bits/ipc.h> heartburn
-mods # 281 occurences, errno will be a pita
-namechecks # tedious ANSI compliance checks
-numenummembers 1024 # RPMTAG has 138 members
-numstructfields 256 # Java jni.h has 229 fields
@ -34,7 +33,6 @@
-strictops
-strictusereleased
-stringliterallen 4096 # redhat*PubKey's are big
-usedef # 303 occurences, HGE_t needs work
-whileblock # tedious
# --- random anal-retentive parameters
@ -54,13 +52,12 @@
+enumint # 93 occurences
-mustfree # 1612 occurences, _free and alloca are painful
-predboolptr # 773 occurences
-usedef # 303 occurences, HGE_t needs work
# --- not-yet at standard level
-boolops # 1898 occurences
-predboolint # 1248 occurences
#-type # 3019 occurences
+boolint
+charint
+ignorequals
+ignoresigns
+matchanyintegral
+boolint # 74 occurences
+charint # 529 occurences
+ignorequals # 138 occurences
+matchanyintegral # 225 occurences

View File

@ -18,7 +18,7 @@
*/
static int checkSpec(Header h)
/*@globals rpmGlobalMacroContext, fileSystem @*/
/*@modifies h, fileSystem @*/
/*@modifies h, rpmGlobalMacroContext, fileSystem @*/
{
const char * rootdir = NULL;
rpmdb db = NULL;
@ -109,7 +109,7 @@ static int buildForTarget(const char * arg, BTA_t ba,
const char * passPhrase, char * cookie)
/*@globals rpmGlobalMacroContext,
fileSystem, internalState @*/
/*@modifies fileSystem, internalState @*/
/*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/
{
int buildAmount = ba->buildAmount;
const char * buildRootURL = NULL;

View File

@ -7,9 +7,10 @@ extern "C" {
int build(const char * arg, BTA_t ba, const char * passPhrase,
char * cookie, /*@null@*/ const char * rcfile)
/*@globals rpmGlobalMacroContext,
/*@globals rpmGlobalMacroContext, rpmCLIMacroContext,
fileSystem, internalState @*/
/*@modifies ba->buildAmount, fileSystem, internalState @*/;
/*@modifies ba->buildAmount, rpmGlobalMacroContext, rpmCLIMacroContext,
fileSystem, internalState @*/;
#ifdef __cplusplus
}

View File

@ -22,7 +22,7 @@ static int _build_debug = 0;
static void doRmSource(Spec spec)
/*@globals rpmGlobalMacroContext,
fileSystem@*/
/*@modifies fileSystem @*/
/*@modifies rpmGlobalMacroContext, fileSystem @*/
{
struct Source *p;
Package pkg;
@ -211,7 +211,9 @@ fprintf(stderr, "*** addMacros\n");
rpmMessage(RPMMESS_NORMAL, _("Executing(%s): %s\n"), name, buildCmd);
if (!(child = fork())) {
/*@-mods@*/
errno = 0;
/*@=mods@*/
(void) execvp(argv[0], (char *const *)argv);
rpmError(RPMERR_SCRIPT, _("Exec of %s failed (%s): %s\n"),

View File

@ -41,7 +41,7 @@ extern "C" {
/*@globals rpmGlobalMacroContext,
fileSystem, internalState @*/
/*@modifies *specp, *lead, *sigs, csa, csa->cpioFdIn,
fileSystem, internalState @*/;
rpmGlobalMacroContext, fileSystem, internalState @*/;
/**
* Write rpm package to file.
@ -66,7 +66,7 @@ int writeRPM(Header * hdrp,
/*@globals rpmGlobalMacroContext,
fileSystem, internalState @*/
/*@modifies *hdrp, *cookie, csa, csa->cpioArchiveSize,
fileSystem, internalState @*/;
rpmGlobalMacroContext, fileSystem, internalState @*/;
#ifdef __cplusplus
}

View File

@ -183,7 +183,8 @@ static const char *prToken(int val)
*/
static int rdToken(ParseState state)
/*@globals rpmGlobalMacroContext @*/
/*@modifies state->nextToken @*/
/*@modifies state->nextToken, state->p, state->tokenValue,
rpmGlobalMacroContext @*/
{
int token;
Value v = NULL;
@ -319,14 +320,16 @@ static int rdToken(ParseState state)
static Value doLogical(ParseState state)
/*@globals rpmGlobalMacroContext @*/
/*@modifies state->nextToken @*/;
/*@modifies state->nextToken, state->p, state->tokenValue,
rpmGlobalMacroContext @*/;
/**
* @param state expression parser state
*/
static Value doPrimary(ParseState state)
/*@globals rpmGlobalMacroContext @*/
/*@modifies state->nextToken @*/
/*@modifies state->nextToken, state->p, state->tokenValue,
rpmGlobalMacroContext @*/
{
Value v;
@ -406,7 +409,8 @@ static Value doPrimary(ParseState state)
*/
static Value doMultiplyDivide(ParseState state)
/*@globals rpmGlobalMacroContext @*/
/*@modifies state->nextToken @*/
/*@modifies state->nextToken, state->p, state->tokenValue,
rpmGlobalMacroContext @*/
{
Value v1, v2 = NULL;
@ -459,7 +463,8 @@ static Value doMultiplyDivide(ParseState state)
*/
static Value doAddSubtract(ParseState state)
/*@globals rpmGlobalMacroContext @*/
/*@modifies state->nextToken @*/
/*@modifies state->nextToken, state->p, state->tokenValue,
rpmGlobalMacroContext @*/
{
Value v1, v2 = NULL;
@ -521,7 +526,8 @@ static Value doAddSubtract(ParseState state)
*/
static Value doRelational(ParseState state)
/*@globals rpmGlobalMacroContext @*/
/*@modifies state->nextToken @*/
/*@modifies state->nextToken, state->p, state->tokenValue,
rpmGlobalMacroContext @*/
{
Value v1, v2 = NULL;
@ -616,7 +622,8 @@ static Value doRelational(ParseState state)
*/
static Value doLogical(ParseState state)
/*@globals rpmGlobalMacroContext @*/
/*@modifies state->nextToken, rpmGlobalMacroContext @*/
/*@modifies state->nextToken, state->p, state->tokenValue,
rpmGlobalMacroContext @*/
{
Value v1, v2 = NULL;

View File

@ -782,7 +782,7 @@ static int parseForLang(char * buf, FileList fl)
*/
static int parseForRegexLang(const char * fileName, /*@out@*/ char ** lang)
/*@globals rpmGlobalMacroContext @*/
/*@modifies *lang @*/
/*@modifies *lang, rpmGlobalMacroContext @*/
{
static int initialized = 0;
static int hasRegex = 0;
@ -889,7 +889,7 @@ static int parseForSimple(/*@unused@*/Spec spec, Package pkg, char * buf,
fl->currentFlags,
fl->docDirs, fl->docDirCount, fl->isDir,
fl->passedSpecialDoc, fl->isSpecialDoc,
pkg->specialDoc @*/
pkg->specialDoc, rpmGlobalMacroContext @*/
{
char *s, *t;
int res, specialDoc = 0;
@ -1113,7 +1113,7 @@ static void genCpioListAndHeader(/*@partial@*/ FileList fl,
/*@globals rpmGlobalMacroContext,
fileSystem @*/
/*@modifies h, *cpioList, fl->processingFailed, fl->fileList,
fileSystem @*/
rpmGlobalMacroContext, fileSystem @*/
{
int _addDotSlash = !(isSrc || rpmExpandNumeric("%{_noPayloadPrefix}"));
uint_32 multiLibMask = 0;
@ -1436,7 +1436,7 @@ static /*@null@*/ FileListRec freeFileList(/*@only@*/ FileListRec fileList,
static int addFile(FileList fl, const char * diskURL, struct stat * statp)
/*@globals rpmGlobalMacroContext,
fileSystem@*/
/*@modifies *statp, fl->processingFailed,
/*@modifies *statp, *fl, fl->processingFailed,
fl->fileList, fl->fileListRecsAlloced, fl->fileListRecsUsed,
fl->totalFileSize, fl->fileCount, fl->inFtw, fl->isDir,
rpmGlobalMacroContext, fileSystem @*/
@ -1652,10 +1652,10 @@ static int processBinaryFile(/*@unused@*/ Package pkg, FileList fl,
const char * fileURL)
/*@globals rpmGlobalMacroContext,
fileSystem@*/
/*@modifies fl->processingFailed,
/*@modifies *fl, fl->processingFailed,
fl->fileList, fl->fileListRecsAlloced, fl->fileListRecsUsed,
fl->totalFileSize, fl->fileCount, fl->inFtw, fl->isDir,
fileSystem @*/
rpmGlobalMacroContext, fileSystem @*/
{
int doGlob;
const char *diskURL = NULL;
@ -1729,7 +1729,7 @@ static int processPackageFiles(Spec spec, Package pkg,
fileSystem, internalState@*/
/*@modifies spec->macros,
pkg->cpioList, pkg->fileList, pkg->specialDoc, pkg->header,
fileSystem, internalState @*/
rpmGlobalMacroContext, fileSystem, internalState @*/
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
struct FileList_s fl;
@ -2386,7 +2386,8 @@ DepMsg_t depMsgs[] = {
static int generateDepends(Spec spec, Package pkg, TFI_t cpioList, int multiLib)
/*@globals rpmGlobalMacroContext,
fileSystem, internalState @*/
/*@modifies cpioList, fileSystem, internalState @*/
/*@modifies cpioList, rpmGlobalMacroContext,
fileSystem, internalState @*/
{
TFI_t fi = cpioList;
StringBuf writeBuf;

View File

@ -57,8 +57,8 @@ myftw_dir (DIR **dirs, int level, int descriptors,
char *dir, size_t len,
myftwFunc func,
void *fl)
/*@globals fileSystem@*/
/*@modifies fileSystem@*/
/*@globals errno, fileSystem @*/
/*@modifies *dirs, *dir, errno, fileSystem @*/
{
int got;
struct dirent *entry;
@ -237,7 +237,9 @@ int myftw (const char *dir,
save = errno;
(void) Closedir (dirs[0]);
/*@-mods@*/
errno = save;
/*@=mods@*/
}
}

View File

@ -1,3 +1,4 @@
/*@-mods@*/
/** \ingroup rpmbuild
* \file build/names.c
* Simple user/group name/id cache (plus hostname and buildtime)
@ -197,3 +198,4 @@ const char *const buildHost(void)
}
return(hostname);
}
/*@=mods@*/

View File

@ -50,7 +50,7 @@ static int cpio_doio(FD_t fdo, /*@unused@*/ Header h, CSA_t csa,
const char * fmodeMacro)
/*@globals rpmGlobalMacroContext,
fileSystem@*/
/*@modifies fdo, csa, fileSystem @*/
/*@modifies fdo, csa, rpmGlobalMacroContext, fileSystem @*/
{
const char * rootDir = "/";
rpmdb rpmdb = NULL;
@ -125,7 +125,7 @@ static /*@only@*/ /*@null@*/ StringBuf addFileToTagAux(Spec spec,
const char * file, /*@only@*/ StringBuf sb)
/*@globals rpmGlobalMacroContext,
fileSystem@*/
/*@modifies fileSystem @*/
/*@modifies rpmGlobalMacroContext, fileSystem @*/
{
char buf[BUFSIZ];
const char * fn = buf;
@ -163,7 +163,7 @@ static /*@only@*/ /*@null@*/ StringBuf addFileToTagAux(Spec spec,
static int addFileToTag(Spec spec, const char * file, Header h, int tag)
/*@globals rpmGlobalMacroContext,
fileSystem@*/
/*@modifies h, fileSystem @*/
/*@modifies h, rpmGlobalMacroContext, fileSystem @*/
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
StringBuf sb = newStringBuf();
@ -188,7 +188,7 @@ static int addFileToTag(Spec spec, const char * file, Header h, int tag)
static int addFileToArrayTag(Spec spec, const char *file, Header h, int tag)
/*@globals rpmGlobalMacroContext,
fileSystem@*/
/*@modifies h, fileSystem @*/
/*@modifies h, rpmGlobalMacroContext, fileSystem @*/
{
StringBuf sb = newStringBuf();
char *s;
@ -208,7 +208,7 @@ static int addFileToArrayTag(Spec spec, const char *file, Header h, int tag)
static int processScriptFiles(Spec spec, Package pkg)
/*@globals rpmGlobalMacroContext,
fileSystem@*/
/*@modifies pkg->header, fileSystem @*/
/*@modifies pkg->header, rpmGlobalMacroContext, fileSystem @*/
{
struct TriggerFileEntry *p;
@ -363,8 +363,8 @@ static unsigned char header_magic[8] = {
static int rpmpkg_version = -1;
static int rpmLeadVersion(void)
/*@globals rpmGlobalMacroContext @*/
/*@modifies rpmGlobalMacroContext @*/
/*@globals rpmpkg_version, rpmGlobalMacroContext @*/
/*@modifies rpmpkg_version, rpmGlobalMacroContext @*/
{
int rpmlead_version;

View File

@ -38,8 +38,10 @@ int parseDescription(Spec spec)
poptContext optCon = NULL;
spectag t = NULL;
/*@-mods@*/
name = NULL;
lang = RPMBUILD_DEFAULT_LANG;
/*@=mods@*/
if ((rc = poptParseArgvString(spec->line, &argc, &argv))) {
rpmError(RPMERR_BADSPEC, _("line %d: Error parsing %%description: %s\n"),
@ -65,8 +67,10 @@ int parseDescription(Spec spec)
}
if (poptPeekArg(optCon)) {
/*@-mods@*/
if (name == NULL)
name = poptGetArg(optCon);
/*@=mods@*/
if (poptPeekArg(optCon)) {
rpmError(RPMERR_BADSPEC, _("line %d: Too many names: %s\n"),
spec->lineNum,

View File

@ -33,7 +33,10 @@ int parseFiles(Spec spec)
int flag = PART_SUBNAME;
poptContext optCon = NULL;
name = file = NULL;
/*@-mods@*/
name = NULL;
file = NULL;
/*@=mods@*/
if ((rc = poptParseArgvString(spec->line, &argc, &argv))) {
rpmError(RPMERR_BADSPEC, _("line %d: Error parsing %%files: %s\n"),
@ -59,8 +62,10 @@ int parseFiles(Spec spec)
}
if (poptPeekArg(optCon)) {
/*@-mods@*/
if (name == NULL)
name = poptGetArg(optCon);
/*@=mods@*/
if (poptPeekArg(optCon)) {
rpmError(RPMERR_BADSPEC, _("line %d: Too many names: %s\n"),
spec->lineNum,

View File

@ -322,7 +322,7 @@ static struct optionalTag {
*/
static void fillOutMainPackage(Header h)
/*@globals rpmGlobalMacroContext @*/
/*@modifies h @*/
/*@modifies h, rpmGlobalMacroContext @*/
{
struct optionalTag *ot;
@ -341,7 +341,7 @@ static void fillOutMainPackage(Header h)
static int readIcon(Header h, const char * file)
/*@globals rpmGlobalMacroContext,
fileSystem@*/
/*@modifies h, fileSystem @*/
/*@modifies h, rpmGlobalMacroContext, fileSystem @*/
{
const char *fn = NULL;
char *icon;
@ -450,7 +450,7 @@ static int handlePreambleTag(Spec spec, Package pkg, int tag, const char *macro,
spec->buildRestrictions, spec->BANames, spec->BACount,
spec->line, spec->gotBuildRootURL,
pkg->header, pkg->autoProv, pkg->autoReq, pkg->icon,
fileSystem @*/
rpmGlobalMacroContext, fileSystem @*/
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
HFD_t hfd = headerFreeData;

View File

@ -68,7 +68,7 @@ static int checkOwners(const char * urlfn)
int reverse, int removeEmpties)
/*@globals rpmGlobalMacroContext,
fileSystem@*/
/*@modifies fileSystem @*/
/*@modifies rpmGlobalMacroContext, fileSystem @*/
{
const char *fn, *urlfn;
static char buf[BUFSIZ];
@ -161,7 +161,7 @@ static int checkOwners(const char * urlfn)
/*@observer@*/ static const char *doUntar(Spec spec, int c, int quietly)
/*@globals rpmGlobalMacroContext,
fileSystem@*/
/*@modifies fileSystem @*/
/*@modifies rpmGlobalMacroContext, fileSystem @*/
{
const char *fn, *urlfn;
static char buf[BUFSIZ];
@ -280,7 +280,7 @@ static int doSetupMacro(Spec spec, char *line)
/*@globals rpmGlobalMacroContext,
fileSystem@*/
/*@modifies spec->buildSubdir, spec->macros, spec->prep,
fileSystem @*/
rpmGlobalMacroContext, fileSystem @*/
{
char buf[BUFSIZ];
StringBuf before;
@ -293,9 +293,11 @@ static int doSetupMacro(Spec spec, char *line)
int rc;
int num;
/*@-mods@*/
leaveDirs = skipDefaultAction = 0;
createDir = quietly = 0;
dirName = NULL;
/*@=mods@*/
if ((rc = poptParseArgvString(line, &argc, &argv))) {
rpmError(RPMERR_BADSPEC, _("Error parsing %%setup: %s\n"),
@ -433,7 +435,7 @@ static int doSetupMacro(Spec spec, char *line)
static int doPatchMacro(Spec spec, char *line)
/*@globals rpmGlobalMacroContext,
fileSystem@*/
/*@modifies spec->prep, fileSystem @*/
/*@modifies spec->prep, rpmGlobalMacroContext, fileSystem @*/
{
char *opt_b;
int opt_P, opt_p, opt_R, opt_E;

View File

@ -96,9 +96,11 @@ int parseScript(Spec spec, int parsePart)
poptContext optCon = NULL;
reqargs[0] = '\0';
/*@-mods@*/
name = NULL;
prog = "/bin/sh";
file = NULL;
/*@=mods@*/
/*@-branchstate@*/
switch (parsePart) {
@ -203,8 +205,10 @@ int parseScript(Spec spec, int parsePart)
}
if (poptPeekArg(optCon)) {
/*@-mods@*/
if (name == NULL)
name = poptGetArg(optCon);
/*@=mods@*/
if (poptPeekArg(optCon)) {
rpmError(RPMERR_BADSPEC, _("line %d: Too many names: %s\n"),
spec->lineNum,

View File

@ -118,8 +118,10 @@ static void forceIncludeFile(Spec spec, const char * fileName)
*/
static int copyNextLine(Spec spec, OFI_t *ofi, int strip)
/*@globals rpmGlobalMacroContext,
fileSystem@*/
/*@modifies spec->nextline, fileSystem @*/
fileSystem @*/
/*@modifies spec->nextline, spec->nextpeekc, spec->lbuf, spec->line,
ofi->readPtr,
rpmGlobalMacroContext, fileSystem @*/
{
char *last;
char ch;

View File

@ -156,7 +156,8 @@ int readLine(Spec spec, int strip)
/*@globals rpmGlobalMacroContext,
fileSystem@*/
/*@modifies spec->fileStack, spec->readStack, spec->line, spec->lineNum,
spec->sl, fileSystem @*/;
spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl,
rpmGlobalMacroContext, fileSystem @*/;
/** \ingroup rpmbuild
* Stop reading from spec file, freeing resources.
@ -197,7 +198,7 @@ int parseNum(/*@null@*/ const char * line, /*@null@*/ /*@out@*/int * res)
* @param text description of change
*/
void addChangelogEntry(Header h, time_t time, const char * name,
const char * text)
const char * text)
/*@modifies h @*/;
/** \ingroup rpmbuild
@ -211,7 +212,8 @@ int parseBuildInstallClean(Spec spec, rpmParseState parsePart)
fileSystem @*/
/*@modifies spec->build, spec->install, spec->clean, spec->macros,
spec->fileStack, spec->readStack, spec->line, spec->lineNum,
spec->sl, fileSystem @*/;
spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl,
rpmGlobalMacroContext, fileSystem @*/;
/** \ingroup rpmbuild
* Parse %%changelog section of a spec file.
@ -222,8 +224,9 @@ int parseChangelog(Spec spec)
/*@globals rpmGlobalMacroContext,
fileSystem@*/
/*@modifies spec->fileStack, spec->readStack, spec->line, spec->lineNum,
spec->sl,
spec->packages->header, fileSystem @*/;
spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl,
spec->packages->header,
rpmGlobalMacroContext, fileSystem @*/;
/** \ingroup rpmbuild
* Parse %%description section of a spec file.
@ -235,7 +238,9 @@ int parseDescription(Spec spec)
fileSystem@*/
/*@modifies spec->packages,
spec->fileStack, spec->readStack, spec->line, spec->lineNum,
spec->sl, spec->st, fileSystem @*/;
spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl,
spec->st,
rpmGlobalMacroContext, fileSystem @*/;
/** \ingroup rpmbuild
* Parse %%files section of a spec file.
@ -247,7 +252,8 @@ int parseFiles(Spec spec)
fileSystem@*/
/*@modifies spec->packages,
spec->fileStack, spec->readStack, spec->line, spec->lineNum,
spec->sl, fileSystem @*/;
spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl,
rpmGlobalMacroContext, fileSystem @*/;
/** \ingroup rpmbuild
* Parse tags from preamble of a spec file.
@ -260,11 +266,13 @@ int parsePreamble(Spec spec, int initialPackage)
fileSystem, internalState @*/
/*@modifies spec->packages,
spec->fileStack, spec->readStack, spec->line, spec->lineNum,
spec->buildSubdir, spec->sl,
spec->buildSubdir,
spec->macros, spec->st, spec->buildRootURL,
spec->sources, spec->numSources, spec->noSource,
spec->buildRestrictions, spec->BANames, spec->BACount,
spec->gotBuildRootURL, fileSystem, internalState @*/;
spec->gotBuildRootURL,
spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl,
rpmGlobalMacroContext, fileSystem, internalState @*/;
/** \ingroup rpmbuild
* Parse %%prep section of a spec file.
@ -276,7 +284,8 @@ int parsePrep(Spec spec)
fileSystem@*/
/*@modifies spec->prep, spec->buildSubdir, spec->macros,
spec->fileStack, spec->readStack, spec->line, spec->lineNum,
spec->sl, fileSystem @*/;
spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl,
rpmGlobalMacroContext, fileSystem @*/;
/** \ingroup rpmbuild
* Parse dependency relations from spec file and/or autogenerated output buffer.
@ -304,7 +313,8 @@ int parseScript(Spec spec, int parsePart)
fileSystem@*/
/*@modifies spec->packages,
spec->fileStack, spec->readStack, spec->line, spec->lineNum,
spec->sl, fileSystem @*/;
spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl,
rpmGlobalMacroContext, fileSystem @*/;
/** \ingroup rpmbuild
* Evaluate boolean expression.
@ -417,7 +427,7 @@ int processBinaryFiles(Spec spec, int installSpecialDoc, int test)
/*@modifies spec->macros,
spec->packages->cpioList, spec->packages->fileList,
spec->packages->specialDoc, spec->packages->header,
fileSystem, internalState @*/;
rpmGlobalMacroContext, fileSystem, internalState @*/;
/** \ingroup rpmbuild
* Create and initialize header for source package.
@ -439,7 +449,7 @@ int processSourceFiles(Spec spec)
/*@modifies spec->sourceHeader, spec->sourceCpioList,
spec->buildRestrictions, spec->BANames,
spec->packages->header,
fileSystem @*/;
rpmGlobalMacroContext, fileSystem @*/;
/** \ingroup rpmbuild
* Parse spec file into spec control structure.
@ -464,7 +474,7 @@ int parseSpec(/*@out@*/ Spec * specp, const char * specFile,
/*@globals rpmGlobalMacroContext,
fileSystem, internalState @*/
/*@modifies *specp,
fileSystem, internalState @*/;
rpmGlobalMacroContext, fileSystem, internalState @*/;
/** \ingroup rpmbuild
* @retval specp spec file control structure
@ -489,7 +499,7 @@ extern int (*parseSpecVec) (Spec * specp, const char * specFile,
/*@globals rpmGlobalMacroContext,
fileSystem, internalState @*/
/*@modifies *specp,
fileSystem, internalState @*/;
rpmGlobalMacroContext, fileSystem, internalState @*/;
/*@=declundef@*/
/** \ingroup rpmbuild
@ -508,7 +518,7 @@ int buildSpec(Spec spec, int what, int test)
spec->buildRestrictions, spec->BANames,
spec->packages->cpioList, spec->packages->fileList,
spec->packages->specialDoc, spec->packages->header,
fileSystem, internalState @*/;
rpmGlobalMacroContext, fileSystem, internalState @*/;
/** \ingroup rpmbuild
* Generate binary package(s).
@ -520,7 +530,7 @@ int packageBinaries(Spec spec)
fileSystem, internalState @*/
/*@modifies spec->packages->header,
spec->sourceRpmName,
fileSystem, internalState @*/;
rpmGlobalMacroContext, fileSystem, internalState @*/;
/** \ingroup rpmbuild
* Generate source package.
@ -532,7 +542,7 @@ int packageSources(Spec spec)
fileSystem, internalState @*/
/*@modifies spec->sourceHeader, spec->cookie,
spec->sourceRpmName,
fileSystem, internalState @*/;
rpmGlobalMacroContext, fileSystem, internalState @*/;
/*@=redecl@*/
#ifdef __cplusplus

View File

@ -220,7 +220,8 @@ int addSource(Spec spec, Package pkg, const char * field, int tag)
/*@globals rpmGlobalMacroContext @*/
/*@modifies spec->sources, spec->numSources,
spec->st, spec->macros,
pkg->icon @*/;
pkg->icon,
rpmGlobalMacroContext @*/;
/** \ingroup rpmbuild
* @param spec spec file control structure

View File

@ -454,7 +454,7 @@ Spec newSpec(void)
spec->force = 0;
spec->anyarch = 0;
spec->macros = rpmGlobalMacroContext;
/*@i@*/ spec->macros = rpmGlobalMacroContext;
return spec;
}

View File

@ -1,46 +1,59 @@
-I. -I.. -I../build -I../rpmdb -I../rpmio -I../popt -DHAVE_CONFIG_H -D_GNU_SOURCE
+partial
+forcehints
-warnunixlib
-warnposix
+unixlib
# XXX ignore doxygen markings
-unrecogcomments
-unrecogcomments # XXX ignore doxygen markings
#+mustmod # segfault in psm.c:597
+proto-param-match
+strict # lclint level
#-cpp-names
#-declundef # db3 is noisy
#-deepbreak # 485 cases
#-export-local
#-export-header
#-export-header-var
# --- +partial artifacts
-declundef
-exportheadervar
-exportlocal
# don't-bother-me-yet parameters
-branchstate # ~140 painful
-mustfree # ~588 alloca is painful
-enummemuse
-fcnuse
-typeuse
-varuse
# not-yet normal parameters
-boolops # ~831 w->n
-predboolint # ~574 w->n
-type # ~872
# --- not-yet at strict level
-bitwisesigned # pita
-elseifcomplete # 95 occurences
-exportconst # 839 occurences
-exportfcn
-exporttype
-exportvar
-fielduse # 1 occurence <bits/sigset.h>
-forblock # tedious
-ifblock # tedious
-incondefs # <bits/{ipc,pthreadtypes}.h> heartburn
-matchfields # <bits/ipc.h> heartburn
-namechecks # tedious ANSI compliance checks
-numenummembers 1024 # RPMTAG has 138 members
-numstructfields 256 # Java jni.h has 229 fields
-ptrarith # tedious
-strictops
-strictusereleased
-stringliterallen 4096 # redhat*PubKey's are big
-whileblock # tedious
# -weak paramaters
#+boolint
#-boolops
#+ignorequals
#+ignoresigns
#-mustfree
#+longintegral
#+matchanyintegral
#-nullpass
#-observertrans
#-predboolint
#-predboolothers
#-retvalint
#-retvalother
#-shiftsigned
# --- not-yet at checks level
-ansi-reserved
+enumint
-mustfree
-predboolptr
-usedef
# --- not-yet at standard level
-boolops
-predboolint
+boolint
+charint
+ignorequals
+matchanyintegral

View File

@ -69,6 +69,7 @@ getdate.c: getdate.y
echo "/*@-retvalint -usedef -varuse -nullderef -nullassign @*/";\
echo "/*@-readonlytrans -modunconnomods -compdef -noeffectuncon @*/";\
echo "/*@-globs -evalorderuncon -modobserveruncon -modnomods @*/";\
echo "/*@unused@*/";\
sed -e 's,y.tab.c,getdate.c,' y.tab.c \
-e 's,^YYSTYPE ,static &,' \
-e 's,^short ,static &,' \

View File

@ -15,11 +15,6 @@
/*@access FSM_t @*/
/*@-exportheadervar@*/
/*@unchecked@*/
extern int _fsm_debug;
/*@=exportheadervar@*/
/**
* Convert string to unsigned integer (with buffer size check).
* @param input string

View File

@ -528,12 +528,16 @@ static void parseEVR(char * evr,
if (rp) *rp = release;
}
/*@-exportheadervar@*/
/*@observer@*/ /*@unchecked@*/
const char *rpmNAME = PACKAGE;
/*@observer@*/ /*@unchecked@*/
const char *rpmEVR = VERSION;
/*@unchecked@*/
int rpmFLAGS = RPMSENSE_EQUAL;
/*@=exportheadervar@*/
int rpmRangesOverlap(const char * AName, const char * AEVR, int AFlags,
const char * BName, const char * BEVR, int BFlags)
@ -1047,7 +1051,7 @@ alAllFileSatisfiesDepend(const availableList al,
exit:
dirName = _free(dirName);
/*@-mods@*/ /* FIX: al->list might be modified. */
/*@-mods@*/ /* AOK: al->list not modified through ret alias. */
if (ret)
ret[found] = NULL;
/*@=mods@*/
@ -1211,8 +1215,8 @@ static int unsatisfiedDepend(rpmTransactionSet ts,
const char * keyType, const char * keyDepend,
const char * keyName, const char * keyEVR, int keyFlags,
/*@null@*/ /*@out@*/ struct availablePackage *** suggestion)
/*@globals fileSystem @*/
/*@modifies ts, *suggestion, fileSystem @*/
/*@globals _cacheDependsRC, fileSystem @*/
/*@modifies ts, *suggestion, _cacheDependsRC, fileSystem @*/
{
rpmdbMatchIterator mi;
Header h;
@ -1254,7 +1258,7 @@ static int unsatisfiedDepend(rpmTransactionSet ts,
}
}
#ifdef DYING
#if defined(DYING) || defined(__LCLINT__)
{ static /*@observer@*/ const char noProvidesString[] = "nada";
static /*@observer@*/ const char * rcProvidesString = noProvidesString;
const char * start;

View File

@ -131,8 +131,8 @@ struct transactionElement {
struct rpmTransactionSet_s {
rpmtransFlags transFlags; /*!< Bit(s) to control operation. */
/*@null@*/ rpmCallbackFunction notify; /*!< Callback function. */
/*@observer@*/ /*@null@*/ rpmCallbackData notifyData;
/*!< Callback private data. */
/*@observer@*/ /*@null@*/
rpmCallbackData notifyData; /*!< Callback private data. */
/*@dependent@*/ rpmProblemSet probs; /*!< Current problems in transaction. */
rpmprobFilterFlags ignoreSet; /*!< Bits to filter current problems. */
int filesystemCount; /*!< No. of mounted filesystems. */
@ -176,7 +176,7 @@ extern "C" {
/** \ingroup rpmdep
* Compare package name-version-release from header with dependency, looking
* for overlap.
* @deprecated Remove from API when obsoletes is correctly eliminated.
* @deprecated Remove from API when obsoletes is correctly implemented.
* @param h header
* @param reqName dependency name
* @param reqEVR dependency [epoch:]version[-release]

View File

@ -251,8 +251,9 @@ static int instprefixTag(Header h, /*@null@*/ /*@out@*/ rpmTagType * type,
static int fssizesTag(Header h, /*@out@*/ rpmTagType * type,
/*@out@*/ const void ** data, /*@out@*/ int_32 * count,
/*@out@*/ int * freeData)
/*@globals fileSystem, internalState @*/
/*@modifies *type, *data, *count, *freeData,
/*@globals rpmGlobalMacroContext,
fileSystem, internalState @*/
/*@modifies *type, *data, *count, *freeData, rpmGlobalMacroContext,
fileSystem, internalState @*/
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
@ -467,7 +468,7 @@ static int i18nTag(Header h, int_32 tag, /*@out@*/ rpmTagType * type,
/*@out@*/ const void ** data, /*@out@*/ int_32 * count,
/*@out@*/ int * freeData)
/*@globals rpmGlobalMacroContext @*/
/*@modifies *type, *data, *count, *freeData @*/
/*@modifies *type, *data, *count, *freeData, rpmGlobalMacroContext @*/
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
char * dstring = rpmExpand(_macro_i18ndomains, NULL);
@ -496,7 +497,7 @@ static int i18nTag(Header h, int_32 tag, /*@out@*/ rpmTagType * type,
/* change to en_US for msgkey -> msgid resolution */
langval = getenv(language);
(void) setenv(language, "en_US", 1);
++_nl_msg_cat_cntr;
/*@i@*/ ++_nl_msg_cat_cntr;
msgid = NULL;
for (domain = dstring; domain != NULL; domain = de) {
@ -511,7 +512,7 @@ static int i18nTag(Header h, int_32 tag, /*@out@*/ rpmTagType * type,
(void) setenv(language, langval, 1);
else
unsetenv(language);
++_nl_msg_cat_cntr;
/*@i@*/ ++_nl_msg_cat_cntr;
if (domain && msgid) {
*data = /*@-unrecog@*/ dgettext(domain, msgid) /*@=unrecog@*/;
@ -552,7 +553,7 @@ static int summaryTag(Header h, /*@out@*/ rpmTagType * type,
/*@out@*/ const void ** data, /*@out@*/ int_32 * count,
/*@out@*/ int * freeData)
/*@globals rpmGlobalMacroContext @*/
/*@modifies *type, *data, *count, *freeData @*/
/*@modifies *type, *data, *count, *freeData, rpmGlobalMacroContext @*/
{
return i18nTag(h, RPMTAG_SUMMARY, type, data, count, freeData);
}
@ -569,7 +570,7 @@ static int descriptionTag(Header h, /*@out@*/ rpmTagType * type,
/*@out@*/ const void ** data, /*@out@*/ int_32 * count,
/*@out@*/ int * freeData)
/*@globals rpmGlobalMacroContext @*/
/*@modifies *type, *data, *count, *freeData @*/
/*@modifies *type, *data, *count, *freeData, rpmGlobalMacroContext @*/
{
return i18nTag(h, RPMTAG_DESCRIPTION, type, data, count, freeData);
}
@ -586,7 +587,7 @@ static int groupTag(Header h, /*@out@*/ rpmTagType * type,
/*@out@*/ const void ** data, /*@out@*/ int_32 * count,
/*@out@*/ int * freeData)
/*@globals rpmGlobalMacroContext @*/
/*@modifies *type, *data, *count, *freeData @*/
/*@modifies *type, *data, *count, *freeData, rpmGlobalMacroContext @*/
{
return i18nTag(h, RPMTAG_GROUP, type, data, count, freeData);
}

View File

@ -1,3 +1,4 @@
/*@-mods@*/
/**
* \file lib/fs.c
*/
@ -262,9 +263,7 @@ int rpmGetFilesystemUsage(const char ** fileList, int_32 * fssizes, int numFiles
usages = xcalloc(numFilesystems, sizeof(usages));
/*@-globs@*/ /* FIX: rpmGlobalMacroContext not in <rpmlib.h> */
sourceDir = rpmGetPath("%{_sourcedir}", NULL);
/*@=globs@*/
maxLen = strlen(sourceDir);
for (i = 0; i < numFiles; i++) {
@ -347,3 +346,4 @@ int rpmGetFilesystemUsage(const char ** fileList, int_32 * fssizes, int numFiles
return 0;
}
/*@=usereleased =onlytrans@*/
/*@=mods@*/

View File

@ -28,17 +28,13 @@ int strict_erasures = 0;
rpmTransactionSet fsmGetTs(const FSM_t fsm) {
const FSMI_t iter = fsm->iter;
/*@-retexpose@*/
return (iter ? iter->ts : NULL);
/*@=retexpose@*/
}
TFI_t fsmGetFi(const FSM_t fsm)
{
const FSMI_t iter = fsm->iter;
/*@-retexpose@*/
return (iter ? iter->fi : NULL);
/*@=retexpose@*/
}
#define SUFFIX_RPMORIG ".rpmorig"
@ -90,7 +86,7 @@ const char * fsmFsPath(/*@special@*/ /*@null@*/ const FSM_t fsm,
static /*@null@*/ void * mapFreeIterator(/*@only@*//*@null@*/const void * p)
/*@modifies *p @*/
{
return _free((void *)p);
return _free(p);
}
/*@=mustmod@*/
@ -109,10 +105,8 @@ mapInitIterator(/*@kept@*/ const void * a, /*@kept@*/ const void * b)
FSMI_t iter = NULL;
iter = xcalloc(1, sizeof(*iter));
/*@-assignexpose@*/
iter->ts = ts;
iter->fi = fi;
/*@=assignexpose@*/
iter->reverse = (fi->type == TR_REMOVED && fi->action != FA_COPYOUT);
iter->i = (iter->reverse ? (fi->fc - 1) : 0);
iter->isave = iter->i;
@ -125,19 +119,21 @@ mapInitIterator(/*@kept@*/ const void * a, /*@kept@*/ const void * b)
* @return next index, -1 on termination
*/
/*@-mustmod@*/ /* LCL: *a is modified */
static int mapNextIterator(void * a)
static int mapNextIterator(/*@null@*/ void * a)
/*@modifies *a @*/
{
FSMI_t iter = a;
const TFI_t fi = iter->fi;
int i = -1;
if (iter->reverse) {
if (iter->i >= 0) i = iter->i--;
} else {
if (iter->i < fi->fc) i = iter->i++;
if (iter) {
const TFI_t fi = iter->fi;
if (iter->reverse) {
if (iter->i >= 0) i = iter->i--;
} else {
if (iter->i < fi->fc) i = iter->i++;
}
iter->isave = i;
}
iter->isave = i;
return i;
}
/*@=mustmod@*/
@ -167,22 +163,24 @@ static int cpioStrCmp(const void * a, const void * b)
* @param fsmPath archive path
* @return index into file info, -1 if archive path was not found
*/
static int mapFind(void * a, const char * fsmPath)
/*@*/
static int mapFind(/*@null@*/ void * a, const char * fsmPath)
/*@modifies *a @*/
{
FSMI_t iter = a;
const TFI_t fi = iter->fi;
int ix = -1;
if (fi && fi->fc > 0 && fi->apath && fsmPath && *fsmPath) {
const char ** p = NULL;
if (iter) {
const TFI_t fi = iter->fi;
if (fi && fi->fc > 0 && fi->apath && fsmPath && *fsmPath) {
const char ** p = NULL;
if (fi->apath != NULL)
p = bsearch(&fsmPath, fi->apath, fi->fc, sizeof(fsmPath),
if (fi->apath != NULL)
p = bsearch(&fsmPath, fi->apath, fi->fc, sizeof(fsmPath),
cpioStrCmp);
if (p) {
iter->i = p - fi->apath;
ix = mapNextIterator(iter);
if (p) {
iter->i = p - fi->apath;
ix = mapNextIterator(iter);
}
}
}
return ix;
@ -426,9 +424,7 @@ static int saveHardLink(/*@special@*/ /*@partial@*/ FSM_t fsm)
fsm->path = _free(fsm->path);
fsm->ix = ix;
rc = fsmStage(fsm, FSM_MAP);
/*@-nullstate@*/ /* FIX: fsm->path null annotation? */
return rc;
/*@=nullstate@*/
}
/** \ingroup payload
@ -525,7 +521,8 @@ int fsmSetup(FSM_t fsm, fileStage goal,
return ec;
}
int fsmTeardown(FSM_t fsm) {
int fsmTeardown(FSM_t fsm)
{
int rc = fsm->rc;
if (!rc)
@ -539,9 +536,7 @@ int fsmTeardown(FSM_t fsm) {
fsm->cfd = NULL;
}
fsm->failedFile = NULL;
/*@-nullstate@*/ /* FIX: fsm->iter null annotation? */
return rc;
/*@=nullstate@*/
}
int fsmMapPath(FSM_t fsm)
@ -630,10 +625,8 @@ assert(fi->type == TR_ADDED);
if ((fsm->mapFlags & CPIO_MAP_PATH) || fsm->nsuffix) {
const struct stat * st = &fsm->sb;
fsm->path = _free(fsm->path);
/*@-nullstate@*/ /* FIX: fsm->path null annotation? */
fsm->path = fsmFsPath(fsm, st, fsm->subdir,
(fsm->suffix ? fsm->suffix : fsm->nsuffix));
/*@=nullstate@*/
}
}
return rc;
@ -1412,7 +1405,9 @@ int fsmStage(FSM_t fsm, fileStage stage)
fsm->ix = -1;
fsm->links = NULL;
fsm->li = NULL;
/*@-mods@*/
errno = 0; /* XXX get rid of EBADF */
/*@=mods@*/
/* Detect and create directories not explicitly in package. */
if (fsm->goal == FSM_PKGINSTALL) {
@ -1476,7 +1471,9 @@ int fsmStage(FSM_t fsm, fileStage stage)
rc = fsmStage(fsm, (!(fsm->mapFlags & CPIO_FOLLOW_SYMLINKS)
? FSM_LSTAT : FSM_STAT));
if (rc == CPIOERR_LSTAT_FAILED && errno == ENOENT) {
/*@-mods@*/
errno = saveerrno;
/*@=mods@*/
rc = 0;
fsm->exists = 0;
} else if (rc == 0) {
@ -1662,7 +1659,9 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break;
if (fsm->dnlx)
(void) fsmStage(fsm, FSM_RMDIRS);
#endif
/*@-mods@*/
errno = saveerrno;
/*@=mods@*/
}
if (fsm->failedFile && *fsm->failedFile == NULL)
*fsm->failedFile = xstrdup(fsm->path);
@ -1687,12 +1686,8 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break;
if (fsm->diskchecked && fsm->exists && fsm->osuffix) {
const char * opath = fsm->opath;
const char * path = fsm->path;
/*@-nullstate@*/ /* FIX: fsm->opath null annotation? */
fsm->opath = fsmFsPath(fsm, st, NULL, NULL);
/*@=nullstate@*/
/*@-nullstate@*/ /* FIX: fsm->path null annotation? */
fsm->path = fsmFsPath(fsm, st, NULL, fsm->osuffix);
/*@=nullstate@*/
rc = fsmStage(fsm, FSM_RENAME);
if (!rc) {
rpmMessage(RPMMESS_WARNING, _("%s saved as %s\n"),
@ -1853,14 +1848,18 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break;
rc = fsmStage(fsm, FSM_STAT);
if (rc == CPIOERR_STAT_FAILED && errno == ENOENT) rc = 0;
if (rc) break;
/*@-mods@*/
errno = saveerrno;
/*@=mods@*/
if (S_ISDIR(ost->st_mode)) return 0;
}
} else if (S_ISLNK(st->st_mode)) {
if (S_ISLNK(ost->st_mode)) {
/* XXX NUL terminated result in fsm->rdbuf, len in fsm->rdnb. */
rc = fsmStage(fsm, FSM_READLINK);
/*@-mods@*/
errno = saveerrno;
/*@=mods@*/
if (rc) break;
if (!strcmp(fsm->opath, fsm->rdbuf)) return 0;
}
@ -2102,7 +2101,9 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break;
if (_fsm_debug && (stage & FSM_SYSCALL))
rpmMessage(RPMMESS_DEBUG, " %8s (%p)\n", cur, fsm->rfd);
(void) Fclose(fsm->rfd);
/*@-mods@*/
errno = saveerrno;
/*@=mods@*/
}
fsm->rfd = NULL;
break;
@ -2130,7 +2131,9 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break;
if (_fsm_debug && (stage & FSM_SYSCALL))
rpmMessage(RPMMESS_DEBUG, " %8s (%p)\n", cur, fsm->wfd);
(void) Fclose(fsm->wfd);
/*@-mods@*/
errno = saveerrno;
/*@=mods@*/
}
fsm->wfd = NULL;
break;

View File

@ -8,6 +8,11 @@
#include "cpio.h"
/*@-exportlocal@*/
/*@unchecked@*/
extern int _fsm_debug;
/*@=exportlocal@*/
/**
*/
#define FSM_VERBOSE 0x8000
@ -100,8 +105,8 @@ struct hardLink {
* Iterator across package file info, forward on install, backward on erase.
*/
struct fsmIterator_s {
/*@kept@*/ rpmTransactionSet ts; /*!< transaction set. */
/*@kept@*/ TFI_t fi; /*!< transaction element file info. */
/*@kept@*/ /*@exposed@*/ rpmTransactionSet ts; /*!< transaction set. */
/*@kept@*/ /*@exposed@*/ TFI_t fi; /*!< transaction element file info. */
int reverse; /*!< reversed traversal? */
int isave; /*!< last returned iterator index. */
int i; /*!< iterator index. */
@ -126,7 +131,7 @@ struct fsm_s {
size_t wrsize; /*!< write: Buffer allocated size. */
size_t wrlen; /*!< write: Number of bytes requested.*/
size_t wrnb; /*!< write: Number of bytes returned. */
/*@only@*/ FSMI_t iter; /*!< File iterator. */
/*@only@*/ /*@null@*/ FSMI_t iter; /*!< File iterator. */
int ix; /*!< Current file iterator index. */
/*@only@*/ struct hardLink * links; /*!< Pending hard linked file(s). */
/*@only@*/ struct hardLink * li; /*!< Current hard linked file(s). */
@ -221,7 +226,7 @@ int fsmSetup(FSM_t fsm, fileStage goal,
* @return 0 on success
*/
int fsmTeardown(FSM_t fsm)
/*@globals fileSystem@*/
/*@globals fileSystem @*/
/*@modifies fsm, fileSystem @*/;
/*@-exportlocal@*/
@ -230,7 +235,7 @@ int fsmTeardown(FSM_t fsm)
* @param fsm file state machine data
* @return transaction set
*/
/*@kept@*/ rpmTransactionSet fsmGetTs(const FSM_t fsm)
/*@kept@*/ /*@exposed@*/ rpmTransactionSet fsmGetTs(const FSM_t fsm)
/*@*/;
/**
@ -238,7 +243,7 @@ int fsmTeardown(FSM_t fsm)
* @param fsm file state machine data
* @return transaction element file info
*/
/*@kept@*/ TFI_t fsmGetFi(/*@partial@*/const FSM_t fsm)
/*@kept@*/ /*@exposed@*/ TFI_t fsmGetFi(/*@partial@*/const FSM_t fsm)
/*@*/;
/**

View File

@ -2,6 +2,7 @@
/*@-retvalint -usedef -varuse -nullderef -nullassign @*/
/*@-readonlytrans -modunconnomods -compdef -noeffectuncon @*/
/*@-globs -evalorderuncon -modobserveruncon -modnomods @*/
/*@unused@*/
#ifndef lint
static char const
yyrcsid[] = "$FreeBSD: src/usr.bin/yacc/skeleton.c,v 1.28 2000/01/17 02:04:06 bde Exp $";

View File

@ -1,4 +1,3 @@
/*@-sizeoftype@*/
/** \ingroup header
* \file lib/header.c
*/
@ -1418,8 +1417,10 @@ headerFindI18NString(Header h, indexEntry entry)
(lang = getenv("LANG")) == NULL)
return entry->data;
/*@-mods@*/
if ((table = findEntry(h, HEADER_I18NTABLE, RPM_STRING_ARRAY_TYPE)) == NULL)
return entry->data;
/*@=mods@*/
for (l = lang; *l != '\0'; l = le) {
const char *td;
@ -2831,7 +2832,7 @@ char * headerSprintf(Header h, const char * fmt,
const char * piece;
int pieceLength;
/*@=mods@*/
/*@-mods@*/
piece = singleSprintf(h, format + i, exts, extCache, 0);
/*@=mods@*/
if (piece) {
@ -3178,4 +3179,3 @@ static struct HV_s hdrVec1 = {
/*@observer@*/ /*@unchecked@*/
HV_t hdrVec = &hdrVec1;
/*@=compmempass =redef@*/
/*@=sizeoftype@*/

View File

@ -24,14 +24,17 @@ char * rpmPermsString(int mode)
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))
perms[0] = 'b';
else
perms[0] = '?';
/*@-unrecog@*/
if (mode & S_IRUSR) perms[1] = 'r';
if (mode & S_IWUSR) perms[2] = 'w';
if (mode & S_IXUSR) perms[3] = 'x';
@ -52,7 +55,6 @@ char * rpmPermsString(int mode)
if (mode & S_ISVTX)
perms[9] = ((mode & S_IXOTH) ? 't' : 'T');
/*@=unrecog@*/
return perms;
}
@ -161,7 +163,7 @@ exit:
}
/*@=branchstate@*/
sb = freeStringBuf(sb);
/*@-nullstate@*/
/*@-nullstate@*/ /* FIX: *argvPtr may be NULL. */
return rc;
/*@=nullstate@*/
}

View File

@ -221,9 +221,7 @@ int makeTempFile(const char * prefix, const char ** fnptr, FD_t * fdptr)
/*@-branchstate@*/
if (!_initialized) {
_initialized = 1;
/*@-globs@*/ /* FIX: rpmGlobalMacroContext not in <rpmlib.h> */
tempfn = rpmGenPath(prefix, tpmacro, NULL);
/*@=globs@*/
if (rpmMkpath(tempfn, 0755, (uid_t) -1, (gid_t) -1))
goto errxit;
}
@ -237,7 +235,6 @@ int makeTempFile(const char * prefix, const char ** fnptr, FD_t * fdptr)
do {
char tfnbuf[64];
/*@-globs@*/ /* FIX: rpmGlobalMacroContext not in <rpmlib.h> */
#ifndef NOTYET
sprintf(tfnbuf, "rpm-tmp.%d", ran++);
tempfn = _free(tempfn);
@ -247,7 +244,6 @@ int makeTempFile(const char * prefix, const char ** fnptr, FD_t * fdptr)
tempfn = _free(tempfn);
tempfn = rpmGenPath(prefix, tpmacro, mktemp(tfnbuf));
#endif
/*@=globs@*/
temput = urlPath(tempfn, &tfn);
if (*tfn == '\0') goto errxit;
@ -326,8 +322,10 @@ char * currentDirectory(void)
return currDir;
}
/*@-exportheadervar@*/
/*@unchecked@*/
int _noDirTokens = 0;
/*@=exportheadervar@*/
static int dncmp(const void * a, const void * b)
{

View File

@ -144,8 +144,10 @@ int doputenv(const char * str)
int makeTempFile(/*@null@*/ const char * prefix,
/*@null@*/ /*@out@*/ const char ** fnptr,
/*@out@*/ FD_t * fdptr)
/*@globals fileSystem, internalState@*/
/*@modifies *fnptr, *fdptr, fileSystem, internalState @*/;
/*@globals rpmGlobalMacroContext,
fileSystem, internalState @*/
/*@modifies *fnptr, *fdptr, rpmGlobalMacroContext,
fileSystem, internalState @*/;
/**
* Return (malloc'd) current working directory.
@ -177,7 +179,9 @@ void buildOrigFileList(Header h, /*@out@*/ const char *** fileListPtr,
/**
*/
/*@-exportlocal@*/
int myGlobPatternP (const char *patternURL) /*@*/;
/*@=exportlocal@*/
/**
*/

View File

@ -47,19 +47,28 @@ struct rpmBuildArguments_s rpmBTArgs;
/*@-redecl@*/
/*@unchecked@*/
extern int _noDirTokens;
/*@unchecked@*/
extern int _fsm_debug;
/*@=redecl@*/
/*@unchecked@*/
static int force = 0;
/*@-exportlocal@*/
/*@unchecked@*/
int noLang = 0;
/*@=exportlocal@*/
/*@unchecked@*/
static int noBuild = 0;
/*@unchecked@*/
static int noDeps = 0;
/*@unchecked@*/
static int signIt = 0;
/*@unchecked@*/
static int useCatalog = 0;

View File

@ -24,11 +24,6 @@
/*@access FD_t @*/ /* compared with NULL */
/*@access rpmdb @*/ /* compared with NULL */
/*@-redecl@*/
/*@unchecked@*/
extern int _fsm_debug;
/*@=redecl@*/
/*@-redecl -declundef -exportheadervar@*/
/*@unchecked@*/
extern const char * chroot_prefix;
@ -662,9 +657,7 @@ rpmRC rpmInstallSourcePackage(const char * rootDir, FD_t fd,
hfd = (fi->hfd ? fi->hfd : headerFreeData);
h = headerFree(h); /* XXX reference held by transaction set */
/*@-globs@*/ /* FIX: rpmGlobalMacroContext not in <rpmlib.h> */
(void) rpmInstallLoadMacros(fi, fi->h);
/*@=globs@*/
memset(psm, 0, sizeof(*psm));
psm->ts = ts;
@ -715,18 +708,14 @@ rpmRC rpmInstallSourcePackage(const char * rootDir, FD_t fd,
}
}
/*@-globs@*/ /* FIX: rpmGlobalMacroContext not in <rpmlib.h> */
_sourcedir = rpmGenPath(ts->rootDir, "%{_sourcedir}", "");
/*@=globs@*/
rc = chkdir(_sourcedir, "sourcedir");
if (rc) {
rc = RPMRC_FAIL;
goto exit;
}
/*@-globs@*/ /* FIX: rpmGlobalMacroContext not in <rpmlib.h> */
_specdir = rpmGenPath(ts->rootDir, "%{_specdir}", "");
/*@=globs@*/
rc = chkdir(_specdir, "specdir");
if (rc) {
rc = RPMRC_FAIL;
@ -765,11 +754,9 @@ rpmRC rpmInstallSourcePackage(const char * rootDir, FD_t fd,
psm->goal = PSM_PKGINSTALL;
/*@-compmempass@*/ /* FIX: psm->fi->dnl should be owned. */
/*@-globs@*/ /* FIX: rpmGlobalMacroContext not in <rpmlib.h> */
rc = psmStage(psm, PSM_PROCESS);
(void) psmStage(psm, PSM_FINI);
/*@=globs@*/
/*@=compmempass@*/
if (rc) rc = RPMRC_FAIL;
@ -839,7 +826,7 @@ static int runScript(PSM_t psm, Header h,
const char * script, int arg1, int arg2)
/*@globals rpmGlobalMacroContext,
fileSystem, internalState@*/
/*@modifies psm, fileSystem, internalState @*/
/*@modifies psm, rpmGlobalMacroContext, fileSystem, internalState @*/
{
const rpmTransactionSet ts = psm->ts;
TFI_t fi = psm->fi;
@ -1066,8 +1053,9 @@ static int runScript(PSM_t psm, Header h,
*/
static rpmRC runInstScript(PSM_t psm)
/*@globals rpmGlobalMacroContext,
fileSystem, internalState@*/
/*@modifies psm, fileSystem, internalState @*/
fileSystem, internalState @*/
/*@modifies psm, rpmGlobalMacroContext,
fileSystem, internalState @*/
{
TFI_t fi = psm->fi;
HGE_t hge = fi->hge;
@ -1116,7 +1104,8 @@ static int handleOneTrigger(PSM_t psm, Header sourceH, Header triggeredH,
int arg2, unsigned char * triggersAlreadyRun)
/*@globals rpmGlobalMacroContext,
fileSystem, internalState@*/
/*@modifies psm, *triggersAlreadyRun, fileSystem, internalState @*/
/*@modifies psm, *triggersAlreadyRun, rpmGlobalMacroContext,
fileSystem, internalState @*/
{
const rpmTransactionSet ts = psm->ts;
TFI_t fi = psm->fi;
@ -1229,7 +1218,8 @@ static int handleOneTrigger(PSM_t psm, Header sourceH, Header triggeredH,
static int runTriggers(PSM_t psm)
/*@globals rpmGlobalMacroContext,
fileSystem, internalState @*/
/*@modifies psm, fileSystem, internalState @*/
/*@modifies psm, rpmGlobalMacroContext,
fileSystem, internalState @*/
{
const rpmTransactionSet ts = psm->ts;
TFI_t fi = psm->fi;
@ -1265,7 +1255,8 @@ static int runTriggers(PSM_t psm)
static int runImmedTriggers(PSM_t psm)
/*@globals rpmGlobalMacroContext,
fileSystem, internalState @*/
/*@modifies psm, fileSystem, internalState @*/
/*@modifies psm, rpmGlobalMacroContext,
fileSystem, internalState @*/
{
const rpmTransactionSet ts = psm->ts;
TFI_t fi = psm->fi;
@ -1646,7 +1637,9 @@ assert(psm->mi == NULL);
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 = psmStage(psm, PSM_COMMIT);
@ -1713,7 +1706,9 @@ assert(psm->mi == NULL);
saveerrno = errno; /* XXX FIXME: Fclose with libio destroys errno */
xx = Fclose(psm->cfd);
psm->cfd = NULL;
/*@-mods@*/
errno = saveerrno;
/*@=mods@*/
fi->action = action;
fi->actions = actions;
@ -1822,7 +1817,9 @@ assert(psm->mi == NULL);
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) {
@ -1916,7 +1913,9 @@ assert(psm->mi == NULL);
psm->chrootDone = ts->chrootDone = 1;
if (ts->rpmdb != NULL) ts->rpmdb->db_chrootDone = 1;
/*@-onlytrans@*/
/*@-mods@*/
chroot_prefix = ts->rootDir;
/*@=mods@*/
/*@=onlytrans@*/
}
break;
@ -1928,7 +1927,9 @@ assert(psm->mi == NULL);
/*@=superuser@*/
psm->chrootDone = ts->chrootDone = 0;
if (ts->rpmdb != NULL) ts->rpmdb->db_chrootDone = 0;
/*@-mods@*/
chroot_prefix = NULL;
/*@=mods@*/
xx = chdir(ts->currDir);
}
break;

View File

@ -195,7 +195,7 @@ void freeFi(TFI_t fi)
int psmStage(PSM_t psm, pkgStage stage)
/*@globals rpmGlobalMacroContext,
fileSystem, internalState @*/
/*@modifies psm, fileSystem, internalState @*/;
/*@modifies psm, rpmGlobalMacroContext, fileSystem, internalState @*/;
#ifdef __cplusplus
}

View File

@ -405,7 +405,7 @@ exit:
static void
printNewSpecfile(Spec spec)
/*@globals fileSystem @*/
/*@modifies fileSystem @*/
/*@modifies spec->sl->sl_lines[], fileSystem @*/
{
Header h;
speclines sl = spec->sl;
@ -675,8 +675,10 @@ restart:
int anyarch = 1;
int force = 1;
/*@-mods@*/
rc = parseSpecVec(&spec, arg, "/", buildRoot, recursing, passPhrase,
cookie, anyarch, force);
/*@=mods@*/
if (rc || spec == NULL) {
rpmError(RPMERR_QUERY,
_("query of specfile %s failed, can't parse\n"), arg);

View File

@ -20,8 +20,10 @@
static int manageFile(FD_t *fdp, const char **fnp, int flags,
/*@unused@*/ int rc)
/*@globals fileSystem, internalState @*/
/*@modifies *fdp, *fnp, fileSystem, internalState @*/
/*@globals rpmGlobalMacroContext,
fileSystem, internalState @*/
/*@modifies *fdp, *fnp, rpmGlobalMacroContext,
fileSystem, internalState @*/
{
const char *fn;
FD_t fd;
@ -76,8 +78,10 @@ static int manageFile(FD_t *fdp, const char **fnp, int flags,
static int copyFile(FD_t *sfdp, const char **sfnp,
FD_t *tfdp, const char **tfnp, rpmDigest dig)
/*@globals fileSystem, internalState @*/
/*@modifies *sfdp, *sfnp, *tfdp, *tfnp, *dig, fileSystem, internalState @*/
/*@globals rpmGlobalMacroContext,
fileSystem, internalState @*/
/*@modifies *sfdp, *sfnp, *tfdp, *tfnp, *dig, rpmGlobalMacroContext,
fileSystem, internalState @*/
{
unsigned char buffer[BUFSIZ];
ssize_t count;
@ -194,10 +198,8 @@ int rpmReSign(rpmResignFlags flags, char * passPhrase, const char ** argv)
(void) rpmAddSignature(sig, sigtarget, RPMSIGTAG_MD5, passPhrase);
}
/*@-globs@*/ /* FIX: rpmGlobalMacroContext not in <rpmlib.h> */
if ((sigtype = rpmLookupSignatureType(RPMLOOKUPSIG_QUERY)) > 0)
(void) rpmAddSignature(sig, sigtarget, sigtype, passPhrase);
/*@=globs@*/
/* Write the lead/signature of the output rpm */
strcpy(tmprpm, rpm);

View File

@ -12,7 +12,9 @@
/** \ingroup rpmcli
* Should version 3 packages be produced?
*/
/*@-redecl@*/
extern int _noDirTokens;
/*@=redecl@*/
#ifdef __cplusplus
extern "C" {
@ -169,7 +171,8 @@ int rpmQueryVerify(QVA_t qva, rpmQVSources source, const char * arg,
rpmdb db, QVF_t showPackage)
/*@globals rpmGlobalMacroContext,
fileSystem, internalState @*/
/*@modifies db, fileSystem, internalState @*/;
/*@modifies db, rpmGlobalMacroContext,
fileSystem, internalState @*/;
/** \ingroup rpmcli
* Display results of package query.
@ -193,7 +196,8 @@ int showQueryPackage(QVA_t qva, rpmdb db, Header h)
int rpmQuery(QVA_t qva, rpmQVSources source, const char * arg)
/*@globals rpmGlobalMacroContext,
fileSystem, internalState @*/
/*@modifies fileSystem, internalState @*/;
/*@modifies rpmGlobalMacroContext,
fileSystem, internalState @*/;
/** \ingroup rpmcli
* Display results of package verify.
@ -203,8 +207,10 @@ int rpmQuery(QVA_t qva, rpmQVSources source, const char * arg)
* @return result of last non-zero verify return
*/
int showVerifyPackage(QVA_t qva, /*@only@*/ rpmdb db, Header h)
/*@globals fileSystem, internalState @*/
/*@modifies db, h, fileSystem, internalState @*/;
/*@globals rpmGlobalMacroContext,
fileSystem, internalState @*/
/*@modifies db, h, rpmGlobalMacroContext,
fileSystem, internalState @*/;
/**
* Check original header digest.
@ -225,7 +231,8 @@ int rpmVerifyDigest(Header h)
int rpmVerify(QVA_t qva, rpmQVSources source, const char *arg)
/*@globals rpmGlobalMacroContext,
fileSystem, internalState @*/
/*@modifies fileSystem, internalState @*/;
/*@modifies rpmGlobalMacroContext,
fileSystem, internalState @*/;
/** \ingroup rpmcli
* Describe query/verify command line request.
@ -273,6 +280,31 @@ extern struct poptOption rpmVerifyPoptTable[];
/*@{*/
/* --- install/upgrade/erase modes */
/*@unchecked@*/
extern int packagesTotal;
/** \ingroup rpmcli
* The rpm CLI generic transaction callback.
* @deprecated Transaction callback arguments need to change, so don't rely on
* this routine in the rpmcli API.
*
* @param arg per-callback private data (e.g. an rpm header)
* @param what callback identifier
* @param amount per-callback progress info
* @param total per-callback progress info
* @param pkgkey opaque header key (e.g. file name or PyObject)
* @param data private data (e.g. rpmInstallInterfaceFlags)
* @return per-callback data (e.g. an opened FD_t)
*/
/*@null@*/ void * rpmShowProgress(/*@null@*/ const void * arg,
const rpmCallbackType what,
const unsigned long amount,
const unsigned long total,
/*@null@*/ const void * pkgKey,
/*@null@*/ void * data)
/*@globals fileSystem, internalState @*/
/*@modifies fileSystem, internalState @*/;
/** \ingroup rpmcli
* Install/upgrade/freshen binary rpm package.
* @param rootdir path to top of install tree
@ -289,9 +321,10 @@ int rpmInstall(/*@null@*/ const char * rootdir,
rpmInstallInterfaceFlags interfaceFlags,
rpmprobFilterFlags probFilter,
/*@null@*/ rpmRelocation * relocations)
/*@globals rpmGlobalMacroContext,
/*@globals packagesTotal, rpmGlobalMacroContext,
fileSystem, internalState@*/
/*@modifies *relocations, fileSystem, internalState @*/;
/*@modifies *relocations, packagesTotal, rpmGlobalMacroContext,
fileSystem, internalState @*/;
/** \ingroup rpmcli
* Install source rpm package.
@ -304,8 +337,10 @@ int rpmInstall(/*@null@*/ const char * rootdir,
int rpmInstallSource(const char * rootdir, const char * arg,
/*@null@*/ /*@out@*/ const char ** specFile,
/*@null@*/ /*@out@*/ char ** cookie)
/*@globals fileSystem, internalState@*/
/*@modifies *specFile, *cookie, fileSystem, internalState @*/;
/*@globals rpmGlobalMacroContext,
fileSystem, internalState@*/
/*@modifies *specFile, *cookie, rpmGlobalMacroContext,
fileSystem, internalState @*/;
/** \ingroup rpmcli
* Erase binary rpm package.
@ -320,7 +355,8 @@ int rpmErase(/*@null@*/ const char * rootdir, /*@null@*/ const char ** argv,
rpmEraseInterfaceFlags interfaceFlags)
/*@globals rpmGlobalMacroContext,
fileSystem, internalState @*/
/*@modifies fileSystem, internalState @*/;
/*@modifies rpmGlobalMacroContext,
fileSystem, internalState @*/;
/** \ingroup rpmcli
* Describe database command line requests.
@ -417,31 +453,6 @@ typedef /*@abstract@*/ struct IDTindex_s {
/*@modifies fileSystem @*/;
/**
* The rpm CLI generic transaction callback.
* @deprecated Transaction callback arguments need to change, so don't rely on
* this routine in the rpmcli API.
*
* @param arg per-callback private data (e.g. an rpm header)
* @param what callback identifier
* @param amount per-callback progress info
* @param total per-callback progress info
* @param pkgkey opaque header key (e.g. file name or PyObject)
* @param data private data (e.g. rpmInstallInterfaceFlags)
* @return per-callback data (e.g. an opened FD_t)
*/
/*@null@*/ void * rpmShowProgress(/*@null@*/ const void * arg,
const rpmCallbackType what,
const unsigned long amount,
const unsigned long total,
/*@null@*/ const void * pkgKey,
/*@null@*/ void * data)
/*@globals fileSystem@*/
/*@modifies fileSystem @*/;
/*@unchecked@*/
extern int packagesTotal;
/** \ingroup rpmcli
* Rollback transactions, erasing new, reinstalling old, package(s).
* @return 0 on success
@ -450,7 +461,8 @@ int rpmRollback(struct rpmInstallArguments_s * ia,
/*@null@*/ const char ** argv)
/*@globals rpmGlobalMacroContext,
fileSystem@*/
/*@modifies fileSystem @*/;
/*@modifies rpmGlobalMacroContext,
fileSystem @*/;
/** \ingroup rpmcli
*/
@ -512,8 +524,10 @@ typedef enum rpmCheckSigFlags_e {
* @return 0 on success
*/
int rpmCheckSig(rpmCheckSigFlags flags, /*@null@*/ const char ** argv)
/*@globals fileSystem, internalState @*/
/*@modifies fileSystem, internalState @*/;
/*@globals rpmGlobalMacroContext,
fileSystem, internalState @*/
/*@modifies rpmGlobalMacroContext,
fileSystem, internalState @*/;
/** \ingroup rpmcli
* Bit(s) to control rpmReSign() operation.
@ -536,7 +550,8 @@ int rpmReSign(rpmResignFlags flags, char * passPhrase,
/*@null@*/ const char ** argv)
/*@globals rpmGlobalMacroContext,
fileSystem, internalState @*/
/*@modifies fileSystem, internalState @*/;
/*@modifies rpmGlobalMacroContext,
fileSystem, internalState @*/;
/** \ingroup rpmcli
* Describe signature command line request.

View File

@ -31,8 +31,8 @@ static int progressCurrent = 0;
/**
*/
static void printHash(const unsigned long amount, const unsigned long total)
/*@globals fileSystem @*/
/*@modifies fileSystem @*/
/*@globals hashesPrinted, progressCurrent, fileSystem @*/
/*@modifies hashesPrinted, progressCurrent, fileSystem @*/
{
int hashesNeeded;
int hashesTotal = 50;
@ -75,8 +75,10 @@ void * rpmShowProgress(/*@null@*/ const void * arg,
const unsigned long total,
/*@null@*/ const void * pkgKey,
/*@null@*/ void * data)
/*@globals fileSystem @*/
/*@modifies fileSystem @*/
/*@globals hashesPrinted, progressCurrent, progressTotal,
fileSystem @*/
/*@modifies hashesPrinted, progressCurrent, progressTotal,
fileSystem @*/
{
/*@-castexpose@*/
Header h = (Header) arg;
@ -558,8 +560,10 @@ restart:
}
if (!(transFlags & RPMTRANS_FLAG_TEST)) {
#if !defined(__LCLINT__) /* LCL: segfault */
eiu->rpmrc = rpmInstallSourcePackage(rootdir, eiu->fd, NULL,
rpmShowProgress, (void *) ((long)notifyFlags), NULL);
#endif
if (eiu->rpmrc != RPMRC_OK) eiu->numFailed++;
}

View File

@ -3,13 +3,8 @@
/** \ingroup rpmcli rpmrc rpmdep rpmtrans rpmdb lead signature header payload dbi
* \file lib/rpmlib.h
*
*/
/* This is the *only* module users of rpmlib should need to include */
/* and it shouldn't need these :-( */
#include "rpmio.h"
#include "rpmmessages.h"
#include "rpmerr.h"
@ -27,6 +22,14 @@ typedef enum rpmRC_e {
RPMRC_SHORTREAD = 4,
} rpmRC;
/*@-redecl@*/
/*@checked@*/
extern struct MacroContext_s * rpmGlobalMacroContext;
/*@checked@*/
extern struct MacroContext_s * rpmCLIMacroContext;
/*@=redecl@*/
#ifdef __cplusplus
extern "C" {
#endif
@ -162,7 +165,7 @@ int rpmPackageGetEntry(void *leadp, Header sigs, Header h,
* Automatically generated table of tag name/value pairs.
*/
/*@-redecl@*/
/*@unchecked@*/
/*@observer@*/ /*@unchecked@*/
extern const struct headerTagTableEntry_s rpmTagTable[];
/*@=redecl@*/
@ -513,16 +516,6 @@ void rpmSetVar(int var, const char * val)
/*@globals internalState@*/
/*@modifies internalState @*/;
/** \ingroup rpmrc
* List of macro files to read when configuring rpm.
* This is a colon separated list of files. URI's are permitted as well,
* identified by the token '://', so file paths must not begin with '//'.
*/
/*@-redecl@*/
/*@unchecked@*/
/*@observer@*/ extern const char * macrofiles;
/*@=redecl@*/
/** \ingroup rpmrc
* Build and install arch/os table identifiers.
* @todo Eliminate from API.
@ -543,17 +536,10 @@ enum rpm_machtable_e {
*/
int rpmReadConfigFiles(/*@null@*/ const char * file,
/*@null@*/ const char * target)
/*@globals fileSystem, internalState @*/
/*@modifies fileSystem, internalState @*/;
/** \ingroup rpmrc
* Read rpmrc (and macro) configuration file(s).
* @param rcfiles colon separated files to read (NULL uses default)
* @return 0 on succes
*/
int rpmReadRC(/*@null@*/ const char * rcfiles)
/*@globals fileSystem, internalState @*/
/*@modifies fileSystem, internalState @*/;
/*@globals rpmGlobalMacroContext, rpmCLIMacroContext,
fileSystem, internalState @*/
/*@modifies rpmGlobalMacroContext, rpmCLIMacroContext,
fileSystem, internalState @*/;
/** \ingroup rpmrc
* Return current arch name and/or number.
@ -597,8 +583,10 @@ int rpmMachineScore(int type, const char * name)
* @return 0 always
*/
int rpmShowRC(FILE * fp)
/*@globals fileSystem, internalState @*/
/*@modifies *fp, fileSystem, internalState @*/;
/*@globals rpmGlobalMacroContext,
fileSystem, internalState @*/
/*@modifies *fp, rpmGlobalMacroContext,
fileSystem, internalState @*/;
/** \ingroup rpmrc
* @deprecated Use addMacro to set _target_* macros.
@ -1153,8 +1141,10 @@ rpmRC rpmInstallSourcePackage(/*@null@*/ const char * rootDir, FD_t fd,
/*@null@*/ rpmCallbackFunction notify,
/*@null@*/ rpmCallbackData notifyData,
/*@null@*/ /*@out@*/ char ** cookie)
/*@globals fileSystem, internalState @*/
/*@modifies fd, *specFilePtr, *cookie, fileSystem, internalState @*/;
/*@globals rpmGlobalMacroContext,
fileSystem, internalState @*/
/*@modifies fd, *specFilePtr, *cookie, rpmGlobalMacroContext,
fileSystem, internalState @*/;
/**
* Compare headers to determine which header is "newer".
@ -1432,7 +1422,7 @@ typedef enum rpmtransFlags_e {
int rpmGetRpmlibProvides(/*@null@*/ /*@out@*/ const char *** provNames,
/*@null@*/ /*@out@*/ int ** provFlags,
/*@null@*/ /*@out@*/ const char *** provVersions)
/*@ modifies *provNames, *provFlags, *provVersions @*/;
/*@modifies *provNames, *provFlags, *provVersions @*/;
/** \ingroup rpmtrans
* Segmented string compare for version and/or release.
@ -1510,8 +1500,10 @@ int rpmRunTransactions(rpmTransactionSet ts,
/*@out@*/ rpmProblemSet * newProbs,
rpmtransFlags transFlags,
rpmprobFilterFlags ignoreSet)
/*@globals fileSystem, internalState@*/
/*@modifies ts, *newProbs, fileSystem, internalState @*/;
/*@globals rpmGlobalMacroContext,
fileSystem, internalState@*/
/*@modifies ts, *newProbs, rpmGlobalMacroContext,
fileSystem, internalState @*/;
/*@}*/
@ -1590,8 +1582,10 @@ int rpmGetFilesystemList( /*@null@*/ /*@out@*/ const char *** listptr,
int rpmGetFilesystemUsage(const char ** fileList, int_32 * fssizes,
int numFiles, /*@null@*/ /*@out@*/ uint_32 ** usagesPtr,
int flags)
/*@globals fileSystem, internalState @*/
/*@modifies *usagesPtr, fileSystem, internalState @*/;
/*@globals rpmGlobalMacroContext,
fileSystem, internalState @*/
/*@modifies *usagesPtr, rpmGlobalMacroContext,
fileSystem, internalState @*/;
/* ==================================================================== */
/** \name RPMQV */
@ -1655,7 +1649,7 @@ typedef enum rpmVerifyAttrs_e {
*/
int rpmVerifyFile(const char * root, Header h, int filenum,
/*@out@*/ rpmVerifyAttrs * result, rpmVerifyAttrs omitMask)
/*@globals fileSystem@*/
/*@globals fileSystem @*/
/*@modifies h, *result, fileSystem @*/;
/**
@ -1667,8 +1661,10 @@ int rpmVerifyFile(const char * root, Header h, int filenum,
* @return 0 on success
*/
int rpmVerifyScript(const char * rootDir, Header h, /*@null@*/ FD_t scriptFd)
/*@globals fileSystem, internalState@*/
/*@modifies h, scriptFd, fileSystem, internalState @*/;
/*@globals rpmGlobalMacroContext,
fileSystem, internalState @*/
/*@modifies h, scriptFd, rpmGlobalMacroContext,
fileSystem, internalState @*/;
/*@}*/
/* ==================================================================== */
@ -1767,8 +1763,10 @@ typedef enum rpmVerifySignatureReturn_e {
rpmVerifySignatureReturn rpmVerifySignature(const char *file,
int_32 sigTag, const void * sig, int count,
const rpmDigest dig, /*@out@*/ char * result)
/*@globals fileSystem, internalState @*/
/*@modifies *result, fileSystem, internalState @*/;
/*@globals rpmGlobalMacroContext,
fileSystem, internalState @*/
/*@modifies *result,
fileSystem, internalState @*/;
/** \ingroup signature
* Destroy signature header from package.

View File

@ -1,3 +1,4 @@
/*@-mods@*/
#include "system.h"
#include <stdarg.h>
@ -438,33 +439,6 @@ const char * lookupInDefaultTable(const char * name,
return name;
}
int rpmReadConfigFiles(const char * file, const char * target)
{
/*@-globs@*/ /* FIX: rpmGlobalMacroContext not in <rpmlib.h> */
/* Preset target macros */
/*@-nullstate@*/ /* FIX: target can be NULL */
rpmRebuildTargetVars(&target, NULL);
/* Read the files */
if (rpmReadRC(file)) return -1;
/* Reset target macros */
rpmRebuildTargetVars(&target, NULL);
/*@=nullstate@*/
/* Finally set target platform */
{ const char *cpu = rpmExpand("%{_target_cpu}", NULL);
const char *os = rpmExpand("%{_target_os}", NULL);
rpmSetMachine(cpu, os);
cpu = _free(cpu);
os = _free(os);
}
/*@=globs@*/
return 0;
}
static void setVarDefault(int var, const char * macroname, const char * val,
/*@null@*/ const char * body)
/*@globals rpmGlobalMacroContext,
@ -570,102 +544,6 @@ static void setDefaults(void)
}
int rpmReadRC(const char * rcfiles)
/*@globals rpmGlobalMacroContext,
internalState @*/
/*@modifies internalState @*/
{
char *myrcfiles, *r, *re;
int rc;
if (!defaultsInitialized) {
/*@-globs@*/ /* FIX: rpmGlobalMacroContext not in <rpmlib.h> */
setDefaults();
/*@=globs@*/
defaultsInitialized = 1;
}
if (rcfiles == NULL)
rcfiles = defrcfiles;
/* Read each file in rcfiles. */
rc = 0;
for (r = myrcfiles = xstrdup(rcfiles); r && *r != '\0'; r = re) {
char fn[4096];
FD_t fd;
/* Get pointer to rest of files */
for (re = r; (re = strchr(re, ':')) != NULL; re++) {
if (!(re[1] == '/' && re[2] == '/'))
/*@innerbreak@*/ break;
}
if (re && *re == ':')
*re++ = '\0';
else
re = r + strlen(r);
/* Expand ~/ to $HOME/ */
fn[0] = '\0';
if (r[0] == '~' && r[1] == '/') {
const char * home = getenv("HOME");
if (home == NULL) {
/* XXX Only /usr/lib/rpm/rpmrc must exist in default rcfiles list */
if (rcfiles == defrcfiles && myrcfiles != r)
continue;
rpmError(RPMERR_RPMRC, _("Cannot expand %s\n"), r);
rc = 1;
break;
}
if (strlen(home) > (sizeof(fn) - strlen(r))) {
rpmError(RPMERR_RPMRC, _("Cannot read %s, HOME is too large.\n"),
r);
rc = 1;
break;
}
strcpy(fn, home);
r++;
}
strncat(fn, r, sizeof(fn) - (strlen(fn) + 1));
fn[sizeof(fn)-1] = '\0';
/* Read another rcfile */
fd = Fopen(fn, "r.fpio");
if (fd == NULL || Ferror(fd)) {
/* XXX Only /usr/lib/rpm/rpmrc must exist in default rcfiles list */
if (rcfiles == defrcfiles && myrcfiles != r)
continue;
rpmError(RPMERR_RPMRC, _("Unable to open %s for reading: %s.\n"),
fn, Fstrerror(fd));
rc = 1;
break;
} else {
/*@-globs@*/ /* FIX: rpmGlobalMacroContext not in <rpmlib.h> */
rc = doReadRC(fd, fn);
/*@=globs@*/
}
if (rc) break;
}
myrcfiles = _free(myrcfiles);
if (rc)
return rc;
rpmSetMachine(NULL, NULL); /* XXX WTFO? Why bother? */
{ const char *mfpath;
/*@-branchstate@*/
if ((mfpath = rpmGetVar(RPMVAR_MACROFILES)) != NULL) {
mfpath = xstrdup(mfpath);
/*@-globs@*/ /* FIX: rpmGlobalMacroContext not in <rpmlib.h> */
rpmInitMacros(NULL, mfpath);
/*@=globs@*/
mfpath = _free(mfpath);
}
/*@=branchstate@*/
}
return rc;
}
/*@-usedef@*/ /*@ FIX: se usage inconsistent, W2DO? */
static int doReadRC( /*@killref@*/ FD_t fd, const char * urlfn)
/*@globals rpmGlobalMacroContext,
@ -1661,6 +1539,127 @@ void rpmFreeRpmrc(void)
/*@=nullstate@*/
}
/** \ingroup rpmrc
* Read rpmrc (and macro) configuration file(s).
* @param rcfiles colon separated files to read (NULL uses default)
* @return 0 on succes
*/
static int rpmReadRC(/*@null@*/ const char * rcfiles)
/*@globals rpmGlobalMacroContext, rpmCLIMacroContext,
fileSystem, internalState @*/
/*@modifies rpmGlobalMacroContext,
fileSystem, internalState @*/
{
char *myrcfiles, *r, *re;
int rc;
if (!defaultsInitialized) {
setDefaults();
defaultsInitialized = 1;
}
if (rcfiles == NULL)
rcfiles = defrcfiles;
/* Read each file in rcfiles. */
rc = 0;
for (r = myrcfiles = xstrdup(rcfiles); r && *r != '\0'; r = re) {
char fn[4096];
FD_t fd;
/* Get pointer to rest of files */
for (re = r; (re = strchr(re, ':')) != NULL; re++) {
if (!(re[1] == '/' && re[2] == '/'))
/*@innerbreak@*/ break;
}
if (re && *re == ':')
*re++ = '\0';
else
re = r + strlen(r);
/* Expand ~/ to $HOME/ */
fn[0] = '\0';
if (r[0] == '~' && r[1] == '/') {
const char * home = getenv("HOME");
if (home == NULL) {
/* XXX Only /usr/lib/rpm/rpmrc must exist in default rcfiles list */
if (rcfiles == defrcfiles && myrcfiles != r)
continue;
rpmError(RPMERR_RPMRC, _("Cannot expand %s\n"), r);
rc = 1;
break;
}
if (strlen(home) > (sizeof(fn) - strlen(r))) {
rpmError(RPMERR_RPMRC, _("Cannot read %s, HOME is too large.\n"),
r);
rc = 1;
break;
}
strcpy(fn, home);
r++;
}
strncat(fn, r, sizeof(fn) - (strlen(fn) + 1));
fn[sizeof(fn)-1] = '\0';
/* Read another rcfile */
fd = Fopen(fn, "r.fpio");
if (fd == NULL || Ferror(fd)) {
/* XXX Only /usr/lib/rpm/rpmrc must exist in default rcfiles list */
if (rcfiles == defrcfiles && myrcfiles != r)
continue;
rpmError(RPMERR_RPMRC, _("Unable to open %s for reading: %s.\n"),
fn, Fstrerror(fd));
rc = 1;
break;
} else {
rc = doReadRC(fd, fn);
}
if (rc) break;
}
myrcfiles = _free(myrcfiles);
if (rc)
return rc;
rpmSetMachine(NULL, NULL); /* XXX WTFO? Why bother? */
{ const char *mfpath;
/*@-branchstate@*/
if ((mfpath = rpmGetVar(RPMVAR_MACROFILES)) != NULL) {
mfpath = xstrdup(mfpath);
rpmInitMacros(NULL, mfpath);
mfpath = _free(mfpath);
}
/*@=branchstate@*/
}
return rc;
}
int rpmReadConfigFiles(const char * file, const char * target)
{
/* Preset target macros */
/*@-nullstate@*/ /* FIX: target can be NULL */
rpmRebuildTargetVars(&target, NULL);
/* Read the files */
if (rpmReadRC(file)) return -1;
/* Reset target macros */
rpmRebuildTargetVars(&target, NULL);
/*@=nullstate@*/
/* Finally set target platform */
{ const char *cpu = rpmExpand("%{_target_cpu}", NULL);
const char *os = rpmExpand("%{_target_os}", NULL);
rpmSetMachine(cpu, os);
cpu = _free(cpu);
os = _free(os);
}
return 0;
}
int rpmShowRC(FILE * fp)
{
struct rpmOption *opt;
@ -1715,9 +1714,8 @@ int rpmShowRC(FILE * fp)
rpmShowRpmlibProvides(fp);
fprintf(fp, "\n");
/*@-globs@*/ /* FIX: rpmGlobalMacroContext not in <rpmlib.h> */
rpmDumpMacroTable(NULL, fp);
/*@=globs@*/
return 0;
}
/*@=mods@*/

View File

@ -1,3 +1,4 @@
/*@-mods@*/
/** \ingroup signature
* \file lib/signature.c
*/
@ -871,7 +872,6 @@ static int checkPassPhrase(const char * passPhrase, const int sigTag)
return 0;
}
/*@-globs@*/ /* FIX: rpmGlobalMacroContext not in <rpmlib.h> */
char * rpmGetPassPhrase(const char * prompt, const int sigTag)
{
char *pass;
@ -917,9 +917,7 @@ char * rpmGetPassPhrase(const char * prompt, const int sigTag)
return pass;
}
/*@=globs@*/
/*@-globs@*/ /* FIX: rpmGlobalMacroContext not in <rpmlib.h> */
rpmVerifySignatureReturn
rpmVerifySignature(const char * file, int_32 sigTag, const void * sig,
int count, const rpmDigest dig, char * result)
@ -947,4 +945,4 @@ rpmVerifySignature(const char * file, int_32 sigTag, const void * sig,
/*@notreached@*/
return RPMSIG_OK;
}
/*@=globs@*/
/*@=mods@*/

View File

@ -96,18 +96,20 @@ int rpmLookupSignatureType(int action)
* Read a pass phrase from the user.
*/
/*@null@*/ char * rpmGetPassPhrase(const char *prompt, const int sigTag)
/*@globals fileSystem@*/
/*@modifies fileSystem @*/;
/*@globals rpmGlobalMacroContext,
fileSystem@*/
/*@modifies rpmGlobalMacroContext,
fileSystem @*/;
/** \ingroup signature
* Return path to pgp executable of given type, or NULL when not found.
*/
/*@-redecl@*/
/*@-exportlocal -redecl@*/
/*@null@*/ const char * rpmDetectPGPVersion(
/*@null@*/ /*@out@*/ pgpVersion * pgpVer)
/*@globals rpmGlobalMacroContext @*/
/*@modifies *pgpVer @*/;
/*@=redecl@*/
/*@=exportlocal =redecl@*/
#ifdef __cplusplus
}

View File

@ -1312,7 +1312,7 @@ static int ensureOlder(struct availablePackage * alp, Header old,
*/
static void skipFiles(const rpmTransactionSet ts, TFI_t fi)
/*@globals rpmGlobalMacroContext @*/
/*@modifies fi @*/
/*@modifies fi, rpmGlobalMacroContext @*/
{
int noDocs = (ts->transFlags & RPMTRANS_FLAG_NODOCS);
char ** netsharedPaths = NULL;
@ -1795,9 +1795,7 @@ int rpmRunTransactions( rpmTransactionSet ts,
}
/* Skip netshared paths, not our i18n files, and excluded docs */
/*@-globs@*/ /* FIX: rpmGlobalMacroContext not in <rpmlib.h> */
skipFiles(ts, fi);
/*@=globs@*/
/*@switchbreak@*/ break;
case TR_REMOVED:
fi->ap = NULL;
@ -1833,7 +1831,9 @@ int rpmRunTransactions( rpmTransactionSet ts,
ts->chrootDone = 1;
if (ts->rpmdb) ts->rpmdb->db_chrootDone = 1;
/*@-onlytrans@*/
/*@-mods@*/
chroot_prefix = ts->rootDir;
/*@=mods@*/
/*@=onlytrans@*/
}
@ -2000,7 +2000,9 @@ int rpmRunTransactions( rpmTransactionSet ts,
/*@=superuser =noeffect @*/
ts->chrootDone = 0;
if (ts->rpmdb) ts->rpmdb->db_chrootDone = 0;
/*@-mods@*/
chroot_prefix = NULL;
/*@=mods@*/
xx = chdir(ts->currDir);
}
@ -2051,10 +2053,8 @@ int rpmRunTransactions( rpmTransactionSet ts,
case TR_ADDED:
/*@switchbreak@*/ break;
case TR_REMOVED:
/*@-globs@*/ /* FIX: rpmGlobalMacroContext not in <rpmlib.h> */
if (ts->transFlags & RPMTRANS_FLAG_REPACKAGE)
xx = psmStage(psm, PSM_PKGSAVE);
/*@=globs@*/
/*@switchbreak@*/ break;
}
}
@ -2122,12 +2122,10 @@ assert(alp == fi->ap);
ts->transFlags |= RPMTRANS_FLAG_MULTILIB;
assert(alp == fi->ap);
/*@-globs@*/ /* FIX: rpmGlobalMacroContext not in <rpmlib.h> */
if (psmStage(psm, PSM_PKGINSTALL)) {
ourrc++;
lastFailed = i;
}
/*@=globs@*/
fi->h = headerFree(fi->h);
if (hsave) {
fi->h = headerLink(hsave);
@ -2154,10 +2152,8 @@ assert(alp == fi->ap);
if (ts->order[oc].u.removed.dependsOnIndex == lastFailed)
/*@switchbreak@*/ break;
/*@-globs@*/ /* FIX: rpmGlobalMacroContext not in <rpmlib.h> */
if (psmStage(psm, PSM_PKGERASE))
ourrc++;
/*@=globs@*/
/*@switchbreak@*/ break;
}

View File

@ -296,9 +296,7 @@ int rpmVerifyScript(const char * rootDir, Header h, /*@null@*/ FD_t scriptFd)
psm->stepName = "verify";
psm->scriptTag = RPMTAG_VERIFYSCRIPT;
psm->progTag = RPMTAG_VERIFYSCRIPTPROG;
/*@-globs@*/ /* FIX: rpmGlobalMacroContext not in <rpmlib.h> */
rc = psmStage(psm, PSM_SCRIPT);
/*@=globs@*/
freeFi(fi);
fi = _free(fi);
ts = rpmtransFree(ts);

1092
po/rpm.pot

File diff suppressed because it is too large Load Diff

View File

@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2001-10-16 10:48-0400\n"
"POT-Creation-Date: 2001-10-17 12:38-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -18,99 +18,99 @@ msgstr ""
msgid "unknown errno"
msgstr ""
#: popt.c:909
#: popt.c:911
#, c-format
msgid "option type (%d) not implemented in popt\n"
msgstr ""
#: popt.c:1120
#: popt.c:1122
msgid "missing argument"
msgstr ""
#: popt.c:1122
#: popt.c:1124
msgid "unknown option"
msgstr ""
#: popt.c:1124
#: popt.c:1126
msgid "mutually exclusive logical operations requested"
msgstr ""
#: popt.c:1126
#: popt.c:1128
msgid "opt->arg should not be NULL"
msgstr ""
#: popt.c:1128
#: popt.c:1130
msgid "aliases nested too deeply"
msgstr ""
#: popt.c:1130
#: popt.c:1132
msgid "error in parameter quoting"
msgstr ""
#: popt.c:1132
#: popt.c:1134
msgid "invalid numeric value"
msgstr ""
#: popt.c:1134
#: popt.c:1136
msgid "number too large or too small"
msgstr ""
#: popt.c:1136
#: popt.c:1138
msgid "memory allocation failed"
msgstr ""
#: popt.c:1140
#: popt.c:1142
msgid "unknown error"
msgstr ""
#: popthelp.c:52
#: popthelp.c:53
msgid "Show this help message"
msgstr ""
#: popthelp.c:53
#: popthelp.c:54
msgid "Display brief usage message"
msgstr ""
#: popthelp.c:56
#: popthelp.c:57
msgid "Display option defaults in message"
msgstr ""
#: popthelp.c:98
#: popthelp.c:99
msgid "NONE"
msgstr ""
#: popthelp.c:99
#: popthelp.c:100
msgid "VAL"
msgstr ""
#: popthelp.c:100
#: popthelp.c:101
msgid "INT"
msgstr ""
#: popthelp.c:101
#: popthelp.c:102
msgid "LONG"
msgstr ""
#: popthelp.c:102
#: popthelp.c:103
msgid "STRING"
msgstr ""
#: popthelp.c:103
#: popthelp.c:104
msgid "FLOAT"
msgstr ""
#: popthelp.c:104
#: popthelp.c:105
msgid "DOUBLE"
msgstr ""
#: popthelp.c:105
#: popthelp.c:106
msgid "ARG"
msgstr ""
#: popthelp.c:456
#: popthelp.c:457
msgid "Usage:"
msgstr ""
#: popthelp.c:478
#: popthelp.c:479
msgid "[OPTION...]"
msgstr ""

View File

@ -883,12 +883,14 @@ int poptGetNextOpt(poptContext con)
char *end;
if (con->os->nextArg) {
/*@-mods@*/
int saveerrno = errno;
errno = 0;
aDouble = strtod(con->os->nextArg, &end);
if (errno == ERANGE)
return POPT_ERROR_OVERFLOW;
errno = saveerrno;
/*@=mods@*/
if (*end != '\0')
return POPT_ERROR_BADNUMBER;
}

View File

@ -103,7 +103,9 @@ int poptReadConfigFile(poptContext con, const char * fn)
if (fileLength == -1 || lseek(fd, 0, 0) == -1) {
rc = errno;
(void) close(fd);
/*@-mods@*/
errno = rc;
/*@=mods@*/
return POPT_ERROR_ERRNO;
}
@ -111,7 +113,9 @@ int poptReadConfigFile(poptContext con, const char * fn)
if (read(fd, (char *)file, fileLength) != fileLength) {
rc = errno;
(void) close(fd);
/*@-mods@*/
errno = rc;
/*@=mods@*/
return POPT_ERROR_ERRNO;
}
if (close(fd) == -1)

View File

@ -476,7 +476,7 @@ static int db1stat(/*@unused@*/ dbiIndex dbi, /*@unused@*/ unsigned int flags)
static int db1close(/*@only@*/ dbiIndex dbi, /*@unused@*/ unsigned int flags)
/*@globals rpmGlobalMacroContext,
fileSystem @*/
/*@modifies dbi, fileSystem @*/
/*@modifies dbi, rpmGlobalMacroContext, fileSystem @*/
{
rpmdb rpmdb = dbi->dbi_rpmdb;
const char * base = db1basename(dbi->dbi_rpmtag);
@ -523,7 +523,7 @@ static int db1open(/*@keep@*/ rpmdb rpmdb, int rpmtag,
/*@out@*/ dbiIndex * dbip)
/*@globals rpmGlobalMacroContext,
fileSystem @*/
/*@modifies *dbip, fileSystem @*/
/*@modifies *dbip, rpmGlobalMacroContext, fileSystem @*/
{
/*@-nestedextern@*/
extern struct _dbiVec db1vec;

View File

@ -268,7 +268,9 @@ static int db_init(dbiIndex dbi, const char * dbhome,
root = (dbi->dbi_root ? dbi->dbi_root : rpmdb->db_root);
if ((root[0] == '/' && root[1] == '\0') || rpmdb->db_chrootDone)
root = NULL;
/*@-mods@*/
tmpdir = rpmGenPath(root, dbi->dbi_tmpdir, NULL);
/*@=mods@*/
xx = dbenv->set_tmp_dir(dbenv, tmpdir);
xx = cvtdberr(dbi, "dbenv->set_tmp_dir", rc, _debug);
tmpdir = _free(tmpdir);
@ -678,7 +680,9 @@ static int db3close(/*@only@*/ dbiIndex dbi, /*@unused@*/ unsigned int flags)
* Either the root or directory components may be a URL. Concatenate,
* convert the URL to a path, and add the name of the file.
*/
/*@-mods@*/
urlfn = rpmGenPath(root, home, NULL);
/*@=mods@*/
(void) urlPath(urlfn, &dbhome);
if (dbi->dbi_temporary) {
dbfile = NULL;
@ -739,7 +743,9 @@ static int db3close(/*@only@*/ dbiIndex dbi, /*@unused@*/ unsigned int flags)
(dbi->dbi_verbose & DB_VERB_WAITSFOR));
if (dbi->dbi_tmpdir) {
/*@-mods@*/
const char * tmpdir = rpmGenPath(root, dbi->dbi_tmpdir, NULL);
/*@=mods@*/
rc = dbenv->set_tmp_dir(dbenv, tmpdir);
rc = cvtdberr(dbi, "dbenv->set_tmp_dir", rc, _debug);
tmpdir = _free(tmpdir);
@ -757,7 +763,9 @@ static int db3close(/*@only@*/ dbiIndex dbi, /*@unused@*/ unsigned int flags)
rc = cvtdberr(dbi, "db_create", rc, _debug);
if (db != NULL) {
/*@-mods@*/
const char * dbf = rpmGetPath(dbhome, "/", dbfile, NULL);
/*@=mods@*/
rc = db->verify(db, dbf, NULL, NULL, flags);
rc = cvtdberr(dbi, "db->verify", rc, _debug);
@ -819,10 +827,12 @@ static int db3open(/*@keep@*/ rpmdb rpmdb, int rpmtag, dbiIndex * dbip)
/*
* Parse db configuration parameters.
*/
/*@-mods@*/
if ((dbi = db3New(rpmdb, rpmtag)) == NULL)
/*@-nullstate@*/
return 1;
/*@=nullstate@*/
/*@=mods@*/
dbi->dbi_api = DB_VERSION_MAJOR;
/*
@ -837,7 +847,9 @@ static int db3open(/*@keep@*/ rpmdb rpmdb, int rpmtag, dbiIndex * dbip)
* Either the root or directory components may be a URL. Concatenate,
* convert the URL to a path, and add the name of the file.
*/
/*@-mods@*/
urlfn = rpmGenPath(root, home, NULL);
/*@=mods@*/
(void) urlPath(urlfn, &dbhome);
if (dbi->dbi_temporary) {
dbfile = NULL;
@ -911,7 +923,9 @@ static int db3open(/*@keep@*/ rpmdb rpmdb, int rpmtag, dbiIndex * dbip)
}
} else { /* dbhome is writable, check for persistent dbenv. */
/*@-mods@*/
const char * dbf = rpmGetPath(dbhome, "/__db.001", NULL);
/*@=mods@*/
if (access(dbf, F_OK) == -1) {
/* ... non-existent (or unwritable) DBENV, will create ... */
@ -937,7 +951,9 @@ static int db3open(/*@keep@*/ rpmdb rpmdb, int rpmtag, dbiIndex * dbip)
if ((oflags & DB_CREATE) && (oflags & DB_RDONLY)) {
/* dbhome is writable, and DB->open flags may conflict. */
const char * dbfn = (dbfile ? dbfile : tagName(dbi->dbi_rpmtag));
/*@-mods@*/
const char * dbf = rpmGetPath(dbhome, "/", dbfn, NULL);
/*@=mods@*/
if (access(dbf, F_OK) == -1) {
/* File does not exist, DB->open might create ... */

View File

@ -423,10 +423,12 @@ dbiIndex db3New(rpmdb rpmdb, int rpmtag)
/*@switchbreak@*/ break;
case POPT_ARG_STRING:
{ const char ** t = opt->arg;
/*@-mods@*/
if (t) {
*t = _free(*t);
*t = xstrdup( (p ? p : "") );
}
/*@=mods@*/
} /*@switchbreak@*/ break;
case POPT_ARG_INT:

View File

@ -67,10 +67,10 @@ FD_t fadOpen(const char * path, int flags, mode_t perms)
/* XXX Fstrerror */
return NULL;
/*@-modobserver -observertrans@*/
/*@-modobserver -observertrans -mods @*/
memcpy(fadio, fdio, sizeof(*fadio));
fadio->_open = fadOpen;
/*@=modobserver =observertrans@*/
/*@=modobserver =observertrans =mods @*/
fdSetIo(fd, fadio);
fadSetFirstFree(fd, 0);

View File

@ -1,4 +1,4 @@
/*@-sizeoftype@*/
/*@-sizeoftype @*/
/** \ingroup rpmdb dbi
* \file rpmdb/rpmdb.c
*/
@ -86,7 +86,7 @@ static int dbiTagToDbix(int rpmtag)
*/
static void dbiTagsInit(void)
/*@globals rpmGlobalMacroContext, dbiTags, dbiTagsMax @*/
/*@modifies dbiTags, dbiTagsMax @*/
/*@modifies rpmGlobalMacroContext, dbiTags, dbiTagsMax @*/
{
/*@observer@*/ static const char * const _dbiTagStr_default =
"Packages:Name:Basenames:Group:Requirename:Providename:Conflictname:Triggername:Dirnames:Requireversion:Provideversion:Installtid:Removetid";
@ -359,9 +359,9 @@ dbiIndex dbiOpen(rpmdb db, int rpmtag, /*@unused@*/ unsigned int flags)
if ((dbi = db->_dbi[dbix]) != NULL)
return dbi;
/*@-globs@*/ /* FIX: rpmGlobalMacroContext not in <rpmlib.h> */
/*@-globs -mods @*/ /* FIX: rpmGlobalMacroContext not in <rpmlib.h> */
_dbapi_rebuild = rpmExpandNumeric("%{_dbapi_rebuild}");
/*@=globs@*/
/*@=globs =mods @*/
if (_dbapi_rebuild < 1 || _dbapi_rebuild > 3)
_dbapi_rebuild = 3;
_dbapi_wanted = (_rebuildinprogress ? -1 : db->db_api);
@ -372,7 +372,9 @@ dbiIndex dbiOpen(rpmdb db, int rpmtag, /*@unused@*/ unsigned int flags)
if (_dbapi < 0 || _dbapi >= 4 || mydbvecs[_dbapi] == NULL) {
return NULL;
}
/*@-mods@*/
errno = 0;
/*@=mods@*/
dbi = NULL;
rc = (*mydbvecs[_dbapi]->open) (db, rpmtag, &dbi);
if (rc) {
@ -390,7 +392,9 @@ dbiIndex dbiOpen(rpmdb db, int rpmtag, /*@unused@*/ unsigned int flags)
while (_dbapi-- > 1) {
if (mydbvecs[_dbapi] == NULL)
continue;
/*@-mods@*/
errno = 0;
/*@=mods@*/
dbi = NULL;
rc = (*mydbvecs[_dbapi]->open) (db, rpmtag, &dbi);
if (rc == 0 && dbi)
@ -853,13 +857,14 @@ int rpmdbSync(rpmdb db)
return rc;
}
/*@-mods@*/
static /*@only@*/ /*@null@*/
rpmdb newRpmdb(/*@kept@*/ /*@null@*/ const char * root,
/*@kept@*/ /*@null@*/ const char * home,
int mode, int perms, int flags)
/*@globals _db_filter_dups, rpmGlobalMacroContext,
fileSystem @*/
/*@modifies _db_filter_dups, fileSystem @*/
/*@modifies _db_filter_dups, rpmGlobalMacroContext, fileSystem @*/
{
rpmdb db = xcalloc(sizeof(*db), 1);
const char * epfx = _DB_ERRPFX;
@ -898,6 +903,7 @@ rpmdb newRpmdb(/*@kept@*/ /*@null@*/ const char * root,
db->_dbi = xcalloc(db->db_ndbi, sizeof(*db->_dbi));
/*@-globstate@*/ return db; /*@=globstate@*/
}
/*@=mods@*/
static int openDatabase(/*@null@*/ const char * prefix,
/*@null@*/ const char * dbpath,
@ -920,8 +926,10 @@ static int openDatabase(/*@null@*/ const char * prefix,
static int _enable_cdb = -1;
/* XXX hack in suoport for CDB, otherwise nuke the state. */
/*@-mods@*/
if (_enable_cdb < 0)
_enable_cdb = rpmExpandNumeric("%{?__dbi_cdb:1}");
/*@=mods@*/
if (!_enable_cdb) {
char * filename;
@ -939,7 +947,9 @@ static int openDatabase(/*@null@*/ const char * prefix,
}
}
#endif
/*@-mods@*/
dbiTagsInit();
/*@=mods@*/
_initialized++;
}
@ -954,7 +964,9 @@ static int openDatabase(/*@null@*/ const char * prefix,
if (mode & O_WRONLY)
return 1;
/*@-mods@*/
db = newRpmdb(prefix, dbpath, mode, perms, flags);
/*@=mods@*/
if (db == NULL)
return 1;
db->db_api = _dbapi;
@ -1044,14 +1056,18 @@ exit:
/*@-globs@*/ /* FIX: rpmGlobalMacroContext not in <rpmlib.h> */
int rpmdbOpen (const char * prefix, rpmdb *dbp, int mode, int perms)
{
/*@-mods@*/
int _dbapi = rpmExpandNumeric("%{_dbapi}");
/*@=mods@*/
return openDatabase(prefix, NULL, _dbapi, dbp, mode, perms, 0);
}
int rpmdbInit (const char * prefix, int perms)
{
rpmdb db = NULL;
/*@-mods@*/
int _dbapi = rpmExpandNumeric("%{_dbapi}");
/*@=mods@*/
int rc;
rc = openDatabase(prefix, NULL, _dbapi, &db, (O_CREAT | O_RDWR),
@ -1070,7 +1086,9 @@ int rpmdbInit (const char * prefix, int perms)
int rpmdbVerify(const char * prefix)
{
rpmdb db = NULL;
/*@-mods@*/
int _dbapi = rpmExpandNumeric("%{_dbapi}");
/*@=mods@*/
int rc = 0;
rc = openDatabase(prefix, NULL, _dbapi, &db, O_RDONLY, 0644, 0);
@ -1760,7 +1778,9 @@ int rpmdbSetIteratorRE(rpmdbMatchIterator mi, rpmTag tag,
int rc = 0;
if (defmode == (rpmMireMode)-1) {
/*@-mods@*/
const char *t = rpmExpand("%{?_query_selector_match}", NULL);
/*@=mods@*/
if (*t == '\0' || !strcmp(t, "default"))
defmode = RPMMIRE_DEFAULT;
else if (!strcmp(t, "strcmp"))
@ -2332,6 +2352,7 @@ static INLINE int removeIndexEntry(dbiIndex dbi, DBC * dbcursor,
return rc;
}
/*@-mods@*/
/* XXX install.c uninstall.c */
int rpmdbRemove(rpmdb db, /*@unused@*/ int rid, unsigned int hdrNum)
{
@ -3329,4 +3350,5 @@ exit:
return rc;
}
/*@=globs@*/
/*@=sizeoftype@*/
/*@=mods@*/
/*@=sizeoftype @*/

View File

@ -82,11 +82,6 @@ typedef /*@abstract@*/ struct MacroBuf_s {
#define SAVECHAR(_mb, _c) { *(_mb)->t = (_c), (_mb)->t++, (_mb)->nb--; }
static int expandMacro(MacroBuf mb)
/*@globals rpmGlobalMacroContext,
fileSystem @*/
/*@modifies mb, fileSystem @*/;
/*@-exportlocal -exportheadervar@*/
#define MAX_MACRO_DEPTH 16
@ -108,6 +103,15 @@ int print_expand_trace = 0;
#define MACRO_CHUNK_SIZE 16
/* forward ref */
static int expandMacro(MacroBuf mb)
/*@globals rpmGlobalMacroContext,
print_macro_trace, print_expand_trace,
fileSystem @*/
/*@modifies mb, rpmGlobalMacroContext,
print_macro_trace, print_expand_trace,
fileSystem @*/;
/**
* Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.
* @param p memory to free
@ -459,7 +463,7 @@ static int
expandT(MacroBuf mb, const char * f, size_t flen)
/*@globals rpmGlobalMacroContext,
fileSystem@*/
/*@modifies mb, fileSystem @*/
/*@modifies mb, rpmGlobalMacroContext, fileSystem @*/
{
char *sbuf;
const char *s = mb->s;
@ -488,7 +492,7 @@ static int
expandS(MacroBuf mb, char * tbuf, size_t tbuflen)
/*@globals rpmGlobalMacroContext,
fileSystem@*/
/*@modifies mb, *tbuf, fileSystem @*/
/*@modifies mb, *tbuf, rpmGlobalMacroContext, fileSystem @*/
{
const char *t = mb->t;
size_t nb = mb->nb;
@ -514,7 +518,7 @@ static int
expandU(MacroBuf mb, char * u, size_t ulen)
/*@globals rpmGlobalMacroContext,
fileSystem@*/
/*@modifies mb, *u, fileSystem @*/
/*@modifies mb, *u, rpmGlobalMacroContext, fileSystem @*/
{
const char *s = mb->s;
char *t = mb->t;
@ -554,7 +558,8 @@ static int
doShellEscape(MacroBuf mb, const char * cmd, size_t clen)
/*@globals rpmGlobalMacroContext,
fileSystem @*/
/*@modifies mb, fileSystem @*/
/*@modifies mb, rpmGlobalMacroContext,
fileSystem @*/
{
char pcmd[BUFSIZ];
FILE *shf;
@ -592,7 +597,7 @@ doShellEscape(MacroBuf mb, const char * cmd, size_t clen)
/*@dependent@*/ static const char *
doDefine(MacroBuf mb, const char * se, int level, int expandbody)
/*@globals rpmGlobalMacroContext @*/
/*@modifies mb @*/
/*@modifies mb, rpmGlobalMacroContext @*/
{
const char *s = se;
char buf[BUFSIZ], *n = buf, *ne = n;
@ -682,7 +687,7 @@ doDefine(MacroBuf mb, const char * se, int level, int expandbody)
/*@dependent@*/ static const char *
doUndefine(MacroContext mc, const char * se)
/*@globals rpmGlobalMacroContext @*/
/*@modifies mc @*/
/*@modifies mc, rpmGlobalMacroContext @*/
{
const char *s = se;
char buf[BUFSIZ], *n = buf, *ne = n;
@ -836,7 +841,7 @@ freeArgs(MacroBuf mb)
/*@dependent@*/ static const char *
grabArgs(MacroBuf mb, const MacroEntry me, const char * se, char lastc)
/*@globals rpmGlobalMacroContext @*/
/*@modifies mb @*/
/*@modifies mb, rpmGlobalMacroContext @*/
{
char buf[BUFSIZ], *b, *be;
char aname[16];
@ -918,7 +923,9 @@ grabArgs(MacroBuf mb, const MacroEntry me, const char * se, char lastc)
/* 1003.2 says this must be 1 before any call. */
#ifdef __GLIBC__
/*@-mods@*/
optind = 1;
/*@=mods@*/
#endif
opts = me->opts;
@ -980,7 +987,8 @@ static void
doOutput(MacroBuf mb, int waserror, const char * msg, size_t msglen)
/*@globals rpmGlobalMacroContext,
fileSystem @*/
/*@modifies mb, fileSystem @*/
/*@modifies mb, rpmGlobalMacroContext,
fileSystem @*/
{
char buf[BUFSIZ];
@ -1007,7 +1015,8 @@ doFoo(MacroBuf mb, int negate, const char * f, size_t fn,
const char * g, size_t glen)
/*@globals rpmGlobalMacroContext,
fileSystem, internalState @*/
/*@modifies mb, fileSystem, internalState @*/
/*@modifies mb, rpmGlobalMacroContext,
fileSystem, internalState @*/
{
char buf[BUFSIZ], *b = NULL, *be;
int c;
@ -1102,8 +1111,11 @@ doFoo(MacroBuf mb, int negate, const char * f, size_t fn,
static int
expandMacro(MacroBuf mb)
/*@globals rpmGlobalMacroContext,
print_macro_trace, print_expand_trace,
fileSystem @*/
/*@modifies mb, rpmGlobalMacroContext,
print_macro_trace, print_expand_trace,
fileSystem @*/
/*@modifies mb, rpmGlobalMacroContext, fileSystem @*/
{
MacroEntry *mep;
MacroEntry me;
@ -1577,7 +1589,9 @@ rpmInitMacros(MacroContext mc, const char *macrofiles)
}
/* XXX Assume new fangled macro expansion */
/*@-mods@*/
max_macro_depth = 16;
/*@=mods@*/
while(rdcl(buf, sizeof(buf), fd, 1) != NULL) {
char c, *n;
@ -1595,7 +1609,9 @@ rpmInitMacros(MacroContext mc, const char *macrofiles)
m = _free(m);
/* Reload cmdline macros */
/*@-mods@*/
rpmLoadMacros(rpmCLIMacroContext, RMIL_CMDLINE);
/*@=mods@*/
}
/*@-globstate@*/

View File

@ -715,7 +715,8 @@ static int mygethostbyname(const char * host,
/*@-compdef@*/ /* FIX: address->s_addr undefined. */
static int getHostAddress(const char * host, /*@out@*/ struct in_addr * address)
/*@modifies *address @*/
/*@globals errno @*/
/*@modifies *address, errno @*/
{
if (xisdigit(host[0])) {
/*@-unrecog -moduncon @*/
@ -804,7 +805,7 @@ static int checkResponse(void * uu, FD_t ctrl,
URLSANE(u);
if (u->bufAlloced == 0 || u->buf == NULL) {
u->bufAlloced = url_iobuf_size;
u->bufAlloced = _url_iobuf_size;
u->buf = xcalloc(u->bufAlloced, sizeof(u->buf[0]));
}
buf = u->buf;

View File

@ -506,13 +506,14 @@ int fdClose( /*@only@*/ void * cookie)
/**
*/
int fdWritable(FD_t fd, int secs)
/*@globals fileSystem @*/
/*@modifies fd, fileSystem @*/;
/*@globals errno, fileSystem @*/
/*@modifies fd, errno, fileSystem @*/;
/**
*/
int fdReadable(FD_t fd, int secs)
/*@modifies fd @*/;
/*@globals errno @*/
/*@modifies fd, errno @*/;
/*@=exportlocal@*/
/**

View File

@ -159,8 +159,8 @@ extern "C" {
/** \ingroup rpmio
*/
int fdFgets(FD_t fd, char * buf, size_t len)
/*@globals fileSystem @*/
/*@modifies *buf, fd, fileSystem @*/;
/*@globals errno, fileSystem @*/
/*@modifies *buf, fd, errno, fileSystem @*/;
/** \ingroup rpmio
*/

View File

@ -76,6 +76,8 @@ void rpmlogPrint(FILE *f)
/*@=modfilesys@*/
void rpmlogClose (void)
/*@globals recs, nrecs @*/
/*@modifies recs, nrecs @*/
{
int i;
@ -95,10 +97,13 @@ void rpmlogOpen (/*@unused@*/ const char *ident, /*@unused@*/ int option,
/*@unchecked@*/
static int rpmlogMask = RPMLOG_UPTO( RPMLOG_NOTICE );
/*@unchecked@*/
static /*@unused@*/ int rpmlogFacility = RPMLOG_USER;
int rpmlogSetMask (int mask)
/*@globals rpmlogMask @*/
/*@modifies rpmlogMask @*/
{
int omask = rpmlogMask;
if (mask)
@ -110,6 +115,8 @@ int rpmlogSetMask (int mask)
static /*@null@*/ rpmlogCallback _rpmlogCallback = NULL;
rpmlogCallback rpmlogSetCallback(rpmlogCallback cb)
/*@globals _rpmlogCallback @*/
/*@modifies _rpmlogCallback @*/
{
rpmlogCallback ocb = _rpmlogCallback;
_rpmlogCallback = cb;
@ -142,8 +149,8 @@ static inline int vsnprintf(char * buf, /*@unused@*/ int nb,
/*@-compmempass@*/ /* FIX: rpmlogMsgPrefix[] dependent, not unqualified */
/*@-nullstate@*/ /* FIX: rpmlogMsgPrefix[] may be NULL */
static void vrpmlog (unsigned code, const char *fmt, va_list ap)
/*@globals internalState @*/
/*@modifies internalState @*/
/*@globals nrecs, recs, internalState @*/
/*@modifies nrecs, recs, internalState @*/
{
int pri = RPMLOG_PRI(code);
int mask = RPMLOG_MASK(pri);

View File

@ -18,17 +18,27 @@ typedef /*@abstract@*/ struct MacroEntry_s {
/*! The structure used to store the set of macros in a context. */
typedef /*@abstract@*/ struct MacroContext_s {
/*@owned@*//*@null@*/ MacroEntry *macroTable; /*!< Macro entry table for context. */
int macrosAllocated;/*!< No. of allocated macros. */
int firstFree; /*!< No. of macros. */
int macrosAllocated;/*!< No. of allocated macros. */
int firstFree; /*!< No. of macros. */
} * MacroContext;
/**
*/
/*@-redecl@*/
/*@checked@*/
extern MacroContext rpmGlobalMacroContext;
/**
*/
/*@checked@*/
extern MacroContext rpmCLIMacroContext;
/*@=redecl@*/
/** \ingroup rpmrc
* List of macro files to read when configuring rpm.
* This is a colon separated list of files. URI's are permitted as well,
* identified by the token '://', so file paths must not begin with '//'.
*/
/*@-redecl@*/
/*@observer@*/ /*@checked@*/
extern const char * macrofiles;
/*@=redecl@*/
/**
* Markers for sources of macros added throughout rpm.
@ -161,7 +171,7 @@ int isCompressed (const char * file,
* @param arg macro(s) to expand (NULL terminates list)
* @return macro expansion (malloc'ed)
*/
char * rpmExpand (/*@null@*/ const char * arg, ...)
char * rpmExpand (/*@null@*/ const char * arg, ...)
/*@globals rpmGlobalMacroContext @*/
/*@modifies rpmGlobalMacroContext @*/;
@ -178,7 +188,7 @@ char * rpmExpand (/*@null@*/ const char * arg, ...)
* @param path macro(s) to expand (NULL terminates list)
* @return canonicalized path (malloc'ed)
*/
/*@-redecl@*/
/*@-redecl@*/ /* LCL: shrug */
const char * rpmGetPath (/*@null@*/ const char * path, ...)
/*@globals rpmGlobalMacroContext @*/
/*@modifies rpmGlobalMacroContext @*/;
@ -194,7 +204,7 @@ const char * rpmGetPath (/*@null@*/ const char * path, ...)
* @param urlfile file URL (often a file, or NULL)
* @return expanded, merged, canonicalized path (malloc'ed)
*/
/*@-redecl@*/
/*@-redecl@*/ /* LCL: shrug */
const char * rpmGenPath (/*@null@*/ const char * urlroot,
/*@null@*/ const char * urlmdir,
/*@null@*/ const char * urlfile)

View File

@ -318,7 +318,9 @@ int pgpPrtPktSigV3(pgpPkt pkt, const byte *h, unsigned int hlen)
return 1;
}
/*@-mods@*/
if (_dig) memcpy(&_dig->sig.v3, v, sizeof(_dig->sig.v3));
/*@=mods@*/
pgpPrtVal("V3 ", pgpPktTbl, pkt);
@ -341,6 +343,7 @@ int pgpPrtPktSigV3(pgpPkt pkt, const byte *h, unsigned int hlen)
for (i = 0; p < &h[hlen]; i++, p += pgpMpiLen(p)) {
if (v->pubkey_algo == PGPPUBKEYALGO_RSA) {
if (pgpSigRSA[i] == NULL) break;
/*@-mods@*/
if (_dig &&
(v->sigtype == PGPSIGTYPE_BINARY || v->sigtype == PGPSIGTYPE_TEXT))
{
@ -354,9 +357,11 @@ printf("\t m**d = "), mp32println(_dig->c.size, _dig->c.data);
/*@switchbreak@*/ break;
}
}
/*@=mods@*/
pgpPrtStr("", pgpSigRSA[i]);
} else if (v->pubkey_algo == PGPPUBKEYALGO_DSA) {
if (pgpSigDSA[i] == NULL) break;
/*@-mods@*/
if (_dig &&
(v->sigtype == PGPSIGTYPE_BINARY || v->sigtype == PGPSIGTYPE_TEXT))
{
@ -371,6 +376,7 @@ printf("\t m**d = "), mp32println(_dig->c.size, _dig->c.data);
/*@switchbreak@*/ break;
}
}
/*@=mods@*/
pgpPrtStr("", pgpSigDSA[i]);
} else {
if (_print)
@ -476,7 +482,9 @@ int pgpPrtPktSigV4(pgpPkt pkt, const byte *h, unsigned int hlen)
return 1;
}
/*@-mods@*/
if (_dig) memcpy(&_dig->sig.v4, v, sizeof(_dig->sig.v4));
/*@=mods@*/
pgpPrtVal("V4 ", pgpPktTbl, pkt);
pgpPrtVal(" ", pgpPubkeyTbl, v->pubkey_algo);
@ -491,11 +499,13 @@ int pgpPrtPktSigV4(pgpPkt pkt, const byte *h, unsigned int hlen)
if (_debug && _print)
fprintf(stderr, " hash[%u] -- %s\n", plen, pgpHexStr(p, plen));
/*@-mods@*/
if (_dig) {
_dig->hash_datalen = plen;
_dig->hash_data = xmalloc(_dig->hash_datalen);
memcpy(_dig->hash_data, p, plen);
}
/*@=mods@*/
(void) pgpPrtSubType(p, plen);
p += plen;
@ -515,6 +525,7 @@ fprintf(stderr, " unhash[%u] -- %s\n", plen, pgpHexStr(p, plen));
for (i = 0; p < &h[hlen]; i++, p += pgpMpiLen(p)) {
if (v->pubkey_algo == PGPPUBKEYALGO_RSA) {
if (pgpSigRSA[i] == NULL) break;
/*@-mods@*/
if (_dig &&
(v->sigtype == PGPSIGTYPE_BINARY || v->sigtype == PGPSIGTYPE_TEXT))
{
@ -528,9 +539,11 @@ printf("\t m**d = "), mp32println(_dig->c.size, _dig->c.data);
/*@switchbreak@*/ break;
}
}
/*@=mods@*/
pgpPrtStr("", pgpSigRSA[i]);
} else if (v->pubkey_algo == PGPPUBKEYALGO_DSA) {
if (pgpSigDSA[i] == NULL) break;
/*@-mods@*/
if (_dig &&
(v->sigtype == PGPSIGTYPE_BINARY || v->sigtype == PGPSIGTYPE_TEXT))
{
@ -545,6 +558,7 @@ printf("\t m**d = "), mp32println(_dig->c.size, _dig->c.data);
/*@switchbreak@*/ break;
}
}
/*@=mods@*/
pgpPrtStr("", pgpSigDSA[i]);
} else {
if (_print)
@ -646,6 +660,7 @@ int pgpPrtKeyV3(pgpPkt pkt, const byte *h, unsigned int hlen)
for (i = 0; p < &h[hlen]; i++, p += pgpMpiLen(p)) {
if (v->pubkey_algo == PGPPUBKEYALGO_RSA) {
if (pgpPublicRSA[i] == NULL) break;
/*@-mods@*/
if (_dig) {
switch (i) {
case 0: /* n */
@ -662,9 +677,11 @@ printf("\t e = "), mp32println(_dig->rsa_pk.e.size, _dig->rsa_pk.e.data);
/*@switchbreak@*/ break;
}
}
/*@=mods@*/
pgpPrtStr("", pgpPublicRSA[i]);
} else if (v->pubkey_algo == PGPPUBKEYALGO_DSA) {
if (pgpPublicDSA[i] == NULL) break;
/*@-mods@*/
if (_dig) {
switch (i) {
case 0: /* p */
@ -691,6 +708,7 @@ printf("\t y = "), mp32println(_dig->y.size, _dig->y.data);
/*@switchbreak@*/ break;
}
}
/*@=mods@*/
pgpPrtStr("", pgpPublicDSA[i]);
} else if (v->pubkey_algo == PGPPUBKEYALGO_ELGAMAL_ENCRYPT) {
if (pgpPublicELGAMAL[i] == NULL) break;
@ -699,6 +717,7 @@ printf("\t y = "), mp32println(_dig->y.size, _dig->y.data);
if (_print)
fprintf(stderr, "%7d", i);
}
/*@=mods@*/
pgpPrtStr("", pgpMpiStr(p));
pgpPrtNL();
}
@ -728,6 +747,7 @@ int pgpPrtKeyV4(pgpPkt pkt, const byte *h, unsigned int hlen)
for (i = 0; p < &h[hlen]; i++, p += pgpMpiLen(p)) {
if (v->pubkey_algo == PGPPUBKEYALGO_RSA) {
if (pgpPublicRSA[i] == NULL) break;
/*@-mods@*/
if (_dig) {
switch (i) {
case 0: /* n */
@ -744,9 +764,11 @@ printf("\t e = "), mp32println(_dig->rsa_pk.e.size, _dig->rsa_pk.e.data);
/*@switchbreak@*/ break;
}
}
/*@=mods@*/
pgpPrtStr("", pgpPublicRSA[i]);
} else if (v->pubkey_algo == PGPPUBKEYALGO_DSA) {
if (pgpPublicDSA[i] == NULL) break;
/*@-mods@*/
if (_dig) {
switch (i) {
case 0: /* p */
@ -773,6 +795,7 @@ printf("\t y = "), mp32println(_dig->y.size, _dig->y.data);
/*@switchbreak@*/ break;
}
}
/*@=mods@*/
pgpPrtStr("", pgpPublicDSA[i]);
} else if (v->pubkey_algo == PGPPUBKEYALGO_ELGAMAL_ENCRYPT) {
if (pgpPublicELGAMAL[i] == NULL) break;
@ -978,8 +1001,10 @@ int pgpPrtPkts(const byte *pkts, unsigned int plen, struct pgpSig_s * dig, int p
const byte *p;
int len;
/*@-mods@*/
_print = printing;
_dig = dig;
/*@=mods@*/
for (p = pkts; p < (pkts + plen); p += len) {
len = pgpPrtPkt(p);

View File

@ -524,7 +524,9 @@ static int vfs_parse_filedate(int idx, /*@out@*/ time_t *t)
/* Here just this special case with MM-DD-YY */
if (is_dos_date(p)){
/*@-mods@*/
p[2] = p[5] = '-';
/*@=mods@*/
memset(d, 0, sizeof(d));
if (sscanf(p, "%2d-%2d-%2d", &d[0], &d[1], &d[2]) == 3){
@ -808,6 +810,7 @@ static /*@only@*/ char * ftpBuf = NULL;
#define alloca_strdup(_s) strcpy(alloca(strlen(_s)+1), (_s))
/*@-mods@*/
static int ftpNLST(const char * url, ftpSysCall_t ftpSysCall,
/*@out@*/ /*@null@*/ struct stat * st,
/*@out@*/ /*@null@*/ char * rlbuf, size_t rlbufsiz)
@ -876,7 +879,7 @@ static int ftpNLST(const char * url, ftpSysCall_t ftpSysCall,
}
if (ftpBufAlloced == 0 || ftpBuf == NULL) {
ftpBufAlloced = url_iobuf_size;
ftpBufAlloced = _url_iobuf_size;
ftpBuf = xcalloc(ftpBufAlloced, sizeof(ftpBuf[0]));
}
*ftpBuf = '\0';
@ -886,7 +889,7 @@ static int ftpNLST(const char * url, ftpSysCall_t ftpSysCall,
do {
/* XXX FIXME: realloc ftpBuf is < ~128 chars remain */
/* XXX FIXME: realloc ftpBuf if < ~128 chars remain */
if ((ftpBufAlloced - bufLength) < (1024+80)) {
ftpBufAlloced <<= 2;
ftpBuf = xrealloc(ftpBuf, ftpBufAlloced);
@ -996,6 +999,7 @@ exit:
(void) ufdClose(fd);
return rc;
}
/*@=mods@*/
static int ftpStat(const char * path, /*@out@*/ struct stat *st)
/*@globals fileSystem @*/

View File

@ -10,7 +10,7 @@
/**
* Supported URL types.
*/
typedef enum {
typedef enum urltype_e {
URL_IS_UNKNOWN = 0, /*!< unknown (aka a file) */
URL_IS_DASH = 1, /*!< stdin/stdout */
URL_IS_PATH = 2, /*!< file://... */
@ -24,37 +24,49 @@ typedef enum {
/**
* URL control structure.
*/
typedef /*@abstract@*/ /*@refcounted@*/ struct urlinfo {
typedef /*@abstract@*/ /*@refcounted@*/ struct urlinfo_s {
/*@refs@*/ int nrefs; /*!< no. of references */
/*@owned@*//*@null@*/ const char * url; /*!< copy of original url */
/*@owned@*//*@null@*/ const char * service;
/*@owned@*//*@null@*/ const char * user;
/*@owned@*//*@null@*/ const char * password;
/*@owned@*//*@null@*/ const char * host;
/*@owned@*//*@null@*/ const char * portstr;
/*@owned@*//*@null@*/ const char * proxyu; /*!< FTP: proxy user */
/*@owned@*//*@null@*/ const char * proxyh; /*!< FTP/HTTP: proxy host */
/*@owned@*/ /*@null@*/ const char * url; /*!< copy of original url */
/*@owned@*/ /*@null@*/ const char * service;
/*@owned@*/ /*@null@*/ const char * user;
/*@owned@*/ /*@null@*/ const char * password;
/*@owned@*/ /*@null@*/ const char * host;
/*@owned@*/ /*@null@*/ const char * portstr;
/*@owned@*/ /*@null@*/ const char * proxyu; /*!< FTP: proxy user */
/*@owned@*/ /*@null@*/ const char * proxyh; /*!< FTP/HTTP: proxy host */
int proxyp; /*!< FTP/HTTP: proxy port */
int port;
int urltype;
FD_t ctrl; /*!< control channel */
FD_t data; /*!< per-xfer data channel */
int bufAlloced; /*!< sizeof I/O buffer */
/*@owned@*/ char *buf; /*!< I/O buffer */
/*@owned@*/ char * buf; /*!< I/O buffer */
int openError; /*!< Type of open failure */
int httpVersion;
int httpHasRange;
int magic;
} *urlinfo;
} * urlinfo;
#ifdef __cplusplus
extern "C" {
#endif
/**
*/
/*@checked@*/
extern int _url_count; /*!< No. of cached URL's. */
/*@checked@*/
/*@only@*/ /*@null@*/
extern urlinfo * _url_cache; /*!< URL cache. */
/*@unchecked@*/
extern int url_iobuf_size;
extern int _url_iobuf_size; /*!< Initial size of URL I/O buffer. */
#define RPMURL_IOBUF_SIZE 4096
/*@unchecked@*/
extern int _url_debug; /*!< URL debugging? */
#define RPMURL_DEBUG_IO 0x40000000
#define RPMURL_DEBUG_REFS 0x20000000
/**
* Create a URL control structure instance.
@ -101,8 +113,8 @@ urlinfo XurlFree( /*@killref@*/ urlinfo u, const char * msg,
* Free cached URL control structures.
*/
void urlFreeCache(void)
/*@globals fileSystem@*/
/*@modifies fileSystem @*/;
/*@globals _url_cache, _url_count, fileSystem @*/
/*@modifies _url_cache, _url_count, fileSystem @*/;
/**
* Return type of URL.
@ -119,7 +131,7 @@ urltype urlIsURL(const char * url)
* @return type of url
*/
urltype urlPath(const char * url, /*@out@*/ const char ** pathp)
/*@modifies *pathp@*/;
/*@modifies *pathp @*/;
/**
* Parse URL string into a control structure.
@ -137,7 +149,7 @@ int urlSplit(const char * url, /*@out@*/ urlinfo * uret)
* @return 0 on success, otherwise FTPERR_* code
*/
int urlGetFile(const char * url, /*@null@*/ const char * dest)
/*@globals fileSystem@*/
/*@globals fileSystem @*/
/*@modifies fileSystem @*/;
#ifdef __cplusplus

View File

@ -23,14 +23,16 @@
#define IPPORT_HTTP 80
#endif
#define URL_IOBUF_SIZE 4096
int url_iobuf_size = URL_IOBUF_SIZE;
#define RPMURL_DEBUG_IO 0x40000000
#define RPMURL_DEBUG_REFS 0x20000000
/**
*/
/*@unchecked@*/
int _url_iobuf_size = RPMURL_IOBUF_SIZE;
/**
*/
/*@unchecked@*/
int _url_debug = 0;
#define URLDBG(_f, _m, _x) if ((_url_debug | (_f)) & (_m)) fprintf _x
#define URLDBGIO(_f, _x) URLDBG((_f), RPMURL_DEBUG_IO, _x)
@ -38,13 +40,14 @@ int _url_debug = 0;
/**
*/
/*@only@*/ /*@null@*/ /*@unchecked@*/
static urlinfo *uCache = NULL;
/*@unchecked@*/
/*@only@*/ /*@null@*/
urlinfo *_url_cache = NULL;
/**
*/
/*@unchecked@*/
static int uCount = 0;
int _url_count = 0;
/**
* Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.
@ -152,21 +155,21 @@ URLDBGREFS(0, (stderr, "--> url %p -- %d %s at %s:%u\n", u, u->nrefs, msg, file,
void urlFreeCache(void)
{
if (uCache) {
if (_url_cache) {
int i;
for (i = 0; i < uCount; i++) {
if (uCache[i] == NULL) continue;
uCache[i] = urlFree(uCache[i], "uCache");
if (uCache[i])
for (i = 0; i < _url_count; i++) {
if (_url_cache[i] == NULL) continue;
_url_cache[i] = urlFree(_url_cache[i], "_url_cache");
if (_url_cache[i])
fprintf(stderr,
_("warning: uCache[%d] %p nrefs(%d) != 1 (%s %s)\n"),
i, uCache[i], uCache[i]->nrefs,
(uCache[i]->host ? uCache[i]->host : ""),
(uCache[i]->service ? uCache[i]->service : ""));
_("warning: _url_cache[%d] %p nrefs(%d) != 1 (%s %s)\n"),
i, _url_cache[i], _url_cache[i]->nrefs,
(_url_cache[i]->host ? _url_cache[i]->host : ""),
(_url_cache[i]->service ? _url_cache[i]->service : ""));
}
}
uCache = _free(uCache);
uCount = 0;
_url_cache = _free(_url_cache);
_url_count = 0;
}
static int urlStrcmp(/*@null@*/ const char * str1, /*@null@*/ const char * str2)
@ -181,6 +184,7 @@ static int urlStrcmp(/*@null@*/ const char * str1, /*@null@*/ const char * str2)
return 0;
}
/*@-mods@*/
static void urlFind(/*@null@*/ /*@in@*/ /*@out@*/ urlinfo * uret, int mustAsk)
/*@globals rpmGlobalMacroContext,
fileSystem@*/
@ -198,9 +202,9 @@ static void urlFind(/*@null@*/ /*@in@*/ /*@out@*/ urlinfo * uret, int mustAsk)
URLSANE(u);
ucx = -1;
for (i = 0; i < uCount; i++) {
for (i = 0; i < _url_count; i++) {
urlinfo ou = NULL;
if (uCache == NULL || (ou = uCache[i]) == NULL) {
if (_url_cache == NULL || (ou = _url_cache[i]) == NULL) {
if (ucx < 0)
ucx = i;
continue;
@ -221,13 +225,13 @@ static void urlFind(/*@null@*/ /*@in@*/ /*@out@*/ urlinfo * uret, int mustAsk)
break; /* Found item in cache */
}
if (i == uCount) {
if (i == _url_count) {
if (ucx < 0) {
ucx = uCount++;
uCache = xrealloc(uCache, sizeof(*uCache) * uCount);
ucx = _url_count++;
_url_cache = xrealloc(_url_cache, sizeof(*_url_cache) * _url_count);
}
if (uCache) /* XXX always true */
uCache[ucx] = urlLink(u, "uCache (miss)");
if (_url_cache) /* XXX always true */
_url_cache[ucx] = urlLink(u, "_url_cache (miss)");
u = urlFree(u, "urlSplit (urlFind miss)");
} else {
ucx = i;
@ -236,11 +240,11 @@ static void urlFind(/*@null@*/ /*@in@*/ /*@out@*/ urlinfo * uret, int mustAsk)
/* This URL is now cached. */
if (uCache) /* XXX always true */
u = urlLink(uCache[ucx], "uCache");
if (_url_cache) /* XXX always true */
u = urlLink(_url_cache[ucx], "_url_cache");
*uret = u;
/*@-usereleased@*/
u = urlFree(u, "uCache (urlFind)");
u = urlFree(u, "_url_cache (urlFind)");
/*@=usereleased@*/
/* Zap proxy host and port in case they have been reset */
@ -319,6 +323,7 @@ static void urlFind(/*@null@*/ /*@in@*/ /*@out@*/ urlinfo * uret, int mustAsk)
return;
}
/*@=mods@*/
/**
*/
@ -476,9 +481,9 @@ int urlSplit(const char * url, urlinfo *uret)
myurl = _free(myurl);
if (uret) {
*uret = u;
/*@-globs@*/ /* FIX: rpmGlobalMacroContext not in <rpmlib.h> */
/*@-globs -mods @*/ /* FIX: rpmGlobalMacroContext not in <rpmlib.h> */
urlFind(uret, 0);
/*@=globs@*/
/*@=globs =mods @*/
}
return 0;
}

11
rpmqv.c
View File

@ -81,8 +81,6 @@ extern int _ftp_debug;
extern int noLibio;
/*@unchecked@*/
extern int _rpmio_debug;
/*@unchecked@*/
extern int _url_debug;
/*@-varuse@*/
/*@unchecked@*/
@ -295,6 +293,7 @@ static void printUsage(void)
}
/*@-mods@*/ /* FIX: shrug */
int main(int argc, const char ** argv)
/*@globals __assert_program_name,
rpmGlobalMacroContext, rpmCLIMacroContext,
@ -380,7 +379,6 @@ int main(int argc, const char ** argv)
noLibio = 1;
#endif
_rpmio_debug = 0;
_url_debug = 0;
/* XXX Eliminate query linkage loop */
specedit = 0;
@ -583,7 +581,7 @@ int main(int argc, const char ** argv)
case GETOPT_DEFINEMACRO:
if (optArg) {
(void) rpmDefineMacro(NULL, optArg, RMIL_CMDLINE);
(void) rpmDefineMacro(rpmCLIMacroContext, optArg,RMIL_CMDLINE);
/*@i@*/ (void) rpmDefineMacro(rpmCLIMacroContext, optArg,RMIL_CMDLINE);
}
noUsageMsg = 1;
/*@switchbreak@*/ break;
@ -1200,7 +1198,7 @@ exit:
#endif /* IAM_RPMBT || IAM_RPMK */
optCon = poptFreeContext(optCon);
rpmFreeMacros(NULL);
rpmFreeMacros(rpmCLIMacroContext);
/*@i@*/ rpmFreeMacros(rpmCLIMacroContext);
rpmFreeRpmrc();
if (pipeChild) {
@ -1211,7 +1209,7 @@ exit:
/* keeps memory leak checkers quiet */
freeNames();
freeFilesystems();
urlFreeCache();
/*@i@*/ urlFreeCache();
rpmlogClose();
dbiTags = _free(dbiTags);
@ -1237,3 +1235,4 @@ exit:
return ec;
/*@=globstate@*/
}
/*@=mods@*/