summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2002-07-28 14:52:33 +0000
committerjbj <devnull@localhost>2002-07-28 14:52:33 +0000
commit5a1ebaccd57b157b70bcd1277f66c5d97e94edf1 (patch)
tree31abb845ee897f1d15c344737376ec8c38e2c00e /lib
parent670ab1c845c0f5f9d252b4599186b4934d20c4b7 (diff)
downloadrpm-5a1ebaccd57b157b70bcd1277f66c5d97e94edf1.tar.gz
rpm-5a1ebaccd57b157b70bcd1277f66c5d97e94edf1.tar.bz2
rpm-5a1ebaccd57b157b70bcd1277f66c5d97e94edf1.zip
- python: don't segfault in ts.GetKeys() on erased packages.
resurrect build modes. add undocumented debugging options. CVS patchset: 5577 CVS date: 2002/07/28 14:52:33
Diffstat (limited to 'lib')
-rw-r--r--lib/package.c2
-rw-r--r--lib/poptALL.c54
-rw-r--r--lib/rpmcli.h91
-rw-r--r--lib/rpmps.c6
-rw-r--r--lib/rpmps.h5
-rw-r--r--lib/rpmts.c6
-rw-r--r--lib/rpmts.h6
-rw-r--r--lib/transaction.c20
8 files changed, 127 insertions, 63 deletions
diff --git a/lib/package.c b/lib/package.c
index 0ff90c98a..7de09769f 100644
--- a/lib/package.c
+++ b/lib/package.c
@@ -297,7 +297,9 @@ rpmRC headerCheck(rpmts ts, const void * uh, size_t uc, const char ** msg)
/*@-boundsread@*/
int_32 il = ntohl(ei[0]);
int_32 dl = ntohl(ei[1]);
+/*@-castexpose@*/
entryInfo pe = (entryInfo) &ei[2];
+/*@=castexpose@*/
/*@=boundsread@*/
int_32 ildl[2];
int_32 pvlen = sizeof(ildl) + (il * sizeof(*pe)) + dl;
diff --git a/lib/poptALL.c b/lib/poptALL.c
index 65c97dd45..b90576f78 100644
--- a/lib/poptALL.c
+++ b/lib/poptALL.c
@@ -20,6 +20,33 @@ static int _debug = 0;
/*@-exportheadervar@*/
/*@unchecked@*/
+extern int _fps_debug;
+
+/*@unchecked@*/
+extern int _fsm_debug;
+
+/*@unchecked@*/
+extern int _rpmal_debug;
+
+/*@unchecked@*/
+extern int _rpmdb_debug;
+
+/*@unchecked@*/
+extern int _rpmds_debug;
+
+/*@unchecked@*/
+extern int _rpmfi_debug;
+
+/*@unchecked@*/
+extern int _rpmps_debug;
+
+/*@unchecked@*/
+extern int _rpmte_debug;
+
+/*@unchecked@*/
+extern int _rpmts_debug;
+
+/*@unchecked@*/
extern int noLibio;
/*@=exportheadervar@*/
@@ -49,7 +76,7 @@ extern int _rpmio_debug;
*/
static void printVersion(FILE * fp)
/*@globals rpmEVR, fileSystem @*/
- /*@modifies fileSystem @*/
+ /*@modifies *fp, fileSystem @*/
{
fprintf(fp, _("RPM version %s\n"), rpmEVR);
}
@@ -80,9 +107,9 @@ static void rpmcliAllArgCallback( /*@unused@*/ poptContext con,
/*@unused@*/ enum poptCallbackReason reason,
const struct poptOption * opt, const char * arg,
/*@unused@*/ const void * data)
- /*@globals rpmCLIMacroContext, rpmGlobalMacroContext,
+ /*@globals rpmcliQueryFlags, rpmCLIMacroContext, rpmGlobalMacroContext,
fileSystem, internalState @*/
- /*@modifies rpmCLIMacroContext, rpmGlobalMacroContext,
+ /*@modifies rpmcliQueryFlags, rpmCLIMacroContext, rpmGlobalMacroContext,
fileSystem, internalState @*/
{
@@ -187,8 +214,7 @@ struct poptOption rpmcliAllPoptTable[] = {
N_("ROOT") },
{ "showrc", '\0', 0, NULL, POPT_SHOWRC,
- N_("display final rpmrc and macro configuration"),
- NULL },
+ N_("display final rpmrc and macro configuration"), NULL },
{ "quiet", '\0', 0, NULL, 'q',
N_("provide less detailed output"), NULL},
{ "verbose", 'v', 0, NULL, 'v',
@@ -201,14 +227,32 @@ struct poptOption rpmcliAllPoptTable[] = {
N_("disable use of libio(3) API"), NULL},
#endif
+ { "fpsdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_fps_debug, -1,
+ NULL, NULL},
+ { "fsmdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_fsm_debug, -1,
+ N_("debug payload file state machine"), NULL},
{ "ftpdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_ftp_debug, -1,
N_("debug protocol data stream"), NULL},
#ifdef DYING
{ "poptdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_popt_debug, -1,
N_("debug option/argument processing"), NULL},
#endif
+ { "rpmaldebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmal_debug, -1,
+ NULL, NULL},
+ { "rpmdbdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmdb_debug, -1,
+ NULL, NULL},
+ { "rpmdsdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmds_debug, -1,
+ NULL, NULL},
+ { "rpmfidebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmfi_debug, -1,
+ NULL, NULL},
{ "rpmiodebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmio_debug, -1,
N_("debug rpmio I/O"), NULL},
+ { "rpmpsdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmps_debug, -1,
+ NULL, NULL},
+ { "rpmtedebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmte_debug, -1,
+ NULL, NULL},
+ { "rpmtsdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmts_debug, -1,
+ NULL, NULL},
{ "urldebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_url_debug, -1,
N_("debug URL cache handling"), NULL},
diff --git a/lib/rpmcli.h b/lib/rpmcli.h
index f0eee647f..1ebf5e469 100644
--- a/lib/rpmcli.h
+++ b/lib/rpmcli.h
@@ -83,51 +83,6 @@ rpmcliFini(/*@only@*/ /*@null@*/ poptContext optCon)
#define RPMCLI_POPT_NOHDRCHK -1031
/* ==================================================================== */
-/** \name RPMBT */
-/*@{*/
-
-/** \ingroup rpmcli
- * Describe build command line request.
- */
-struct rpmBuildArguments_s {
- int buildAmount; /*!< Bit(s) to control operation. */
-/*@null@*/
- const char * buildRootOverride; /*!< from --buildroot */
-/*@null@*/
- char * targets; /*!< Target platform(s), comma separated. */
-/*@observer@*/
- const char * passPhrase; /*!< Pass phrase. */
-/*@only@*/ /*@null@*/
- const char * cookie; /*!< NULL for binary, ??? for source, rpm's */
- int force; /*!< from --force */
- int noBuild; /*!< from --nobuild */
- int noDeps; /*!< from --nodeps */
- int noLang; /*!< from --nolang */
- int shortCircuit; /*!< from --short-circuit */
- int sign; /*!< from --sign */
- int useCatalog; /*!< from --usecatalog */
- char buildMode; /*!< Build mode (one of "btBC") */
- char buildChar; /*!< Build stage (one of "abcilps ") */
-/*@observer@*/ /*@null@*/
- const char * rootdir;
-};
-
-/** \ingroup rpmcli
- */
-typedef struct rpmBuildArguments_s * BTA_t;
-
-/** \ingroup rpmcli
- */
-/*@unchecked@*/
-extern struct rpmBuildArguments_s rpmBTArgs;
-
-/** \ingroup rpmcli
- */
-/*@unchecked@*/
-extern struct poptOption rpmBuildPoptTable[];
-
-/*@}*/
-/* ==================================================================== */
/** \name RPMQV */
/*@{*/
@@ -456,6 +411,52 @@ int rpmcliVerify(rpmts ts, QVA_t qva, /*@null@*/ const char ** argv)
/*@}*/
/* ==================================================================== */
+/** \name RPMBT */
+/*@{*/
+
+/** \ingroup rpmcli
+ * Describe build command line request.
+ */
+struct rpmBuildArguments_s {
+ rpmQueryFlags qva_flags; /*!< Bit(s) to control verification. */
+ int buildAmount; /*!< Bit(s) to control operation. */
+/*@null@*/
+ const char * buildRootOverride; /*!< from --buildroot */
+/*@null@*/
+ char * targets; /*!< Target platform(s), comma separated. */
+/*@observer@*/
+ const char * passPhrase; /*!< Pass phrase. */
+/*@only@*/ /*@null@*/
+ const char * cookie; /*!< NULL for binary, ??? for source, rpm's */
+ int force; /*!< from --force */
+ int noBuild; /*!< from --nobuild */
+ int noDeps; /*!< from --nodeps */
+ int noLang; /*!< from --nolang */
+ int shortCircuit; /*!< from --short-circuit */
+ int sign; /*!< from --sign */
+ int useCatalog; /*!< from --usecatalog */
+ char buildMode; /*!< Build mode (one of "btBC") */
+ char buildChar; /*!< Build stage (one of "abcilps ") */
+/*@observer@*/ /*@null@*/
+ const char * rootdir;
+};
+
+/** \ingroup rpmcli
+ */
+typedef struct rpmBuildArguments_s * BTA_t;
+
+/** \ingroup rpmcli
+ */
+/*@unchecked@*/
+extern struct rpmBuildArguments_s rpmBTArgs;
+
+/** \ingroup rpmcli
+ */
+/*@unchecked@*/
+extern struct poptOption rpmBuildPoptTable[];
+
+/*@}*/
+/* ==================================================================== */
/** \name RPMEIU */
/*@{*/
/* --- install/upgrade/erase modes */
diff --git a/lib/rpmps.c b/lib/rpmps.c
index 2a3898b9c..4afb8711d 100644
--- a/lib/rpmps.c
+++ b/lib/rpmps.c
@@ -15,13 +15,13 @@
/*@access rpmProblem @*/
/*@unchecked@*/
-static int _ps_debug = 0;
+int _rpmps_debug = 0;
rpmps XrpmpsUnlink(rpmps ps, const char * msg,
const char * fn, unsigned ln)
{
/*@-modfilesystem@*/
-if (_ps_debug > 0 && msg != NULL)
+if (_rpmps_debug > 0 && msg != NULL)
fprintf(stderr, "--> ps %p -- %d %s at %s:%u\n", ps, ps->nrefs, msg, fn, ln);
/*@=modfilesystem@*/
ps->nrefs--;
@@ -35,7 +35,7 @@ rpmps XrpmpsLink(rpmps ps, const char * msg,
{
ps->nrefs++;
/*@-modfilesystem@*/
-if (_ps_debug > 0 && msg != NULL)
+if (_rpmps_debug > 0 && msg != NULL)
fprintf(stderr, "--> ps %p ++ %d %s at %s:%u\n", ps, ps->nrefs, msg, fn, ln);
/*@=modfilesystem@*/
/*@-refcounttrans@*/
diff --git a/lib/rpmps.h b/lib/rpmps.h
index 4f110a50a..dcbc2590e 100644
--- a/lib/rpmps.h
+++ b/lib/rpmps.h
@@ -6,6 +6,11 @@
* Structures and prototypes used for an "rpmps" problem set.
*/
+/*@-exportlocal@*/
+/*@unchecked@*/
+extern int _rpmps_debug;
+/*@=exportlocal@*/
+
/**
* Raw data for an element of a problem set.
*/
diff --git a/lib/rpmts.c b/lib/rpmts.c
index 86919ec7e..70d4c7b9f 100644
--- a/lib/rpmts.c
+++ b/lib/rpmts.c
@@ -63,7 +63,7 @@ extern int statvfs (const char * file, /*@out@*/ struct statvfs * buf)
/*@access pgpDigParams @*/
/*@unchecked@*/
-int _ts_debug = 0;
+int _rpmts_debug = 0;
char * hGetNEVR(Header h, const char ** np)
{
@@ -87,7 +87,7 @@ char * hGetNEVR(Header h, const char ** np)
rpmts XrpmtsUnlink(rpmts ts, const char * msg, const char * fn, unsigned ln)
{
/*@-modfilesystem@*/
-if (_ts_debug)
+if (_rpmts_debug)
fprintf(stderr, "--> ts %p -- %d %s at %s:%u\n", ts, ts->nrefs, msg, fn, ln);
/*@=modfilesystem@*/
ts->nrefs--;
@@ -98,7 +98,7 @@ rpmts XrpmtsLink(rpmts ts, const char * msg, const char * fn, unsigned ln)
{
ts->nrefs++;
/*@-modfilesystem@*/
-if (_ts_debug)
+if (_rpmts_debug)
fprintf(stderr, "--> ts %p ++ %d %s at %s:%u\n", ts, ts->nrefs, msg, fn, ln);
/*@=modfilesystem@*/
/*@-refcounttrans@*/ return ts; /*@=refcounttrans@*/
diff --git a/lib/rpmts.h b/lib/rpmts.h
index f562bc5a6..294fa42ec 100644
--- a/lib/rpmts.h
+++ b/lib/rpmts.h
@@ -8,9 +8,11 @@
#include "rpmps.h"
-/*@unchecked@*/
/*@-exportlocal@*/
-extern int _ts_debug;
+/*@unchecked@*/
+extern int _rpmts_debug;
+/*@unchecked@*/
+extern int _fps_debug;
/*@=exportlocal@*/
#define _RPMTS_VSF_NODIGESTS (1 << 0)
diff --git a/lib/transaction.c b/lib/transaction.c
index 9efe99b49..61ff5d64e 100644
--- a/lib/transaction.c
+++ b/lib/transaction.c
@@ -141,22 +141,26 @@ static fileAction decideFileFate(const rpmts ts,
if (domd5(fn, buffer, 0, NULL))
return FA_CREATE; /* assume file has been removed */
omd5 = rpmfiMD5(ofi);
- if (!memcmp(omd5, buffer, 16))
+ if (omd5 && !memcmp(omd5, buffer, 16))
return FA_CREATE; /* unmodified config file, replace. */
nmd5 = rpmfiMD5(nfi);
- if (!memcmp(omd5, nmd5, 16))
+/*@-nullpass@*/
+ if (omd5 && nmd5 && !memcmp(omd5, nmd5, 16))
return FA_SKIP; /* identical file, don't bother. */
+/*@=nullpass@*/
} else /* dbWhat == LINK */ {
const char * oFLink, * nFLink;
memset(buffer, 0, sizeof(buffer));
if (readlink(fn, buffer, sizeof(buffer) - 1) == -1)
return FA_CREATE; /* assume file has been removed */
oFLink = rpmfiFLink(ofi);
- if (!strcmp(oFLink, buffer))
+ if (oFLink && !strcmp(oFLink, buffer))
return FA_CREATE; /* unmodified config file, replace. */
nFLink = rpmfiFLink(nfi);
- if (!strcmp(oFLink, nFLink))
+/*@-nullpass@*/
+ if (oFLink && nFLink && !strcmp(oFLink, nFLink))
return FA_SKIP; /* identical file, don't bother. */
+/*@=nullpass@*/
}
/*
@@ -183,10 +187,16 @@ static int filecmp(rpmfi afi, rpmfi bfi)
if (awhat == LINK) {
const char * alink = rpmfiFLink(afi);
const char * blink = rpmfiFLink(bfi);
+ if (alink == blink) return 0;
+ if (alink == NULL) return 1;
+ if (blink == NULL) return -1;
return strcmp(alink, blink);
} else if (awhat == REG) {
const unsigned char * amd5 = rpmfiMD5(afi);
const unsigned char * bmd5 = rpmfiMD5(bfi);
+ if (amd5 == bmd5) return 0;
+ if (amd5 == NULL) return 1;
+ if (bmd5 == NULL) return -1;
return memcmp(amd5, bmd5, 16);
}
@@ -334,7 +344,7 @@ static int handleRmvdInstalledFiles(const rpmts ts, rpmfi fi,
#define ISROOT(_d) (((_d)[0] == '/' && (_d)[1] == '\0') ? "" : (_d))
/*@unchecked@*/
-static int _fps_debug = 0;
+int _fps_debug = 0;
static int fpsCompare (const void * one, const void * two)
/*@*/