From: jbj Date: Sun, 29 Apr 2001 16:08:55 +0000 (+0000) Subject: - transaction iterator(s) need to run in reverse order on pure erasures. X-Git-Tag: rpm-4.4-release~1585 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c83cfd5ed5b9637a090e57bef5aca5d5b96d00f4;p=platform%2Fupstream%2Frpm.git - transaction iterator(s) need to run in reverse order on pure erasures. - erasures not yet strict, warn & chug on unlink(2)/rmdir(2) failure. CVS patchset: 4723 CVS date: 2001/04/29 16:08:55 --- diff --git a/CHANGES b/CHANGES index 345d80f..570897d 100644 --- a/CHANGES +++ b/CHANGES @@ -33,6 +33,11 @@ - lib/depends.c: diddle debugging messages. - fix: readlink return value clobbered by header write. - fix: ineeded count wrong for overlapped, created files. + - globalize _free(3) wrapper in rpmlib.h, consistent usage throughout. + - internalize locale insensitive ctype(3) in rpmio.h. + - boring lclint annotations and fiddles. + - transaction iterator(s) need to run in reverse order on pure erasures. + - erasures not yet strict, warn & chug on unlink(2)/rmdir(2) failure. 4.0 -> 4.0.[12] - add doxygen and lclint annotations most everywhere. diff --git a/lib/fsm.c b/lib/fsm.c index 0a5cda7..58cdf9b 100644 --- a/lib/fsm.c +++ b/lib/fsm.c @@ -19,6 +19,9 @@ int _fsm_debug = 0; +/* XXX Failure to remove is not (yet) cause for failure. */ +int strict_erasures = 0; + rpmTransactionSet fsmGetTs(const FSM_t fsm) { const FSMI_t iter = fsm->iter; return (iter ? iter->ts : NULL); @@ -1477,12 +1480,14 @@ int fsmStage(FSM_t fsm, fileStage stage) break; /* XXX common error message. */ - rpmError(RPMERR_RMDIR, + rpmError( + (strict_erasures ? RPMERR_RMDIR : RPMWARN_RMDIR), _("%s rmdir of %s failed: Directory not empty\n"), fiTypeString(fi), fsm->path); break; default: - rpmError(RPMERR_RMDIR, + rpmError( + (strict_erasures ? RPMERR_RMDIR : RPMWARN_RMDIR), _("%s rmdir of %s failed: %s\n"), fiTypeString(fi), fsm->path, strerror(errno)); break; @@ -1492,10 +1497,13 @@ int fsmStage(FSM_t fsm, fileStage stage) if (!rc) break; if (!(errno == ENOENT && (fsm->fflags & RPMFILE_MISSINGOK))) rpmError(RPMERR_UNLINK, + (strict_erasures ? RPMERR_UNLINK : RPMWARN_UNLINK), _("%s unlink of %s failed: %s\n"), fiTypeString(fi), fsm->path, strerror(errno)); } } + /* XXX Failure to remove is not (yet) cause for failure. */ + if (!strict_erasures) rc = 0; break; } diff --git a/lib/transaction.c b/lib/transaction.c index b80c64d..b217158 100644 --- a/lib/transaction.c +++ b/lib/transaction.c @@ -1411,8 +1411,8 @@ static void * tsInitIterator(/*@kept@*/ const void * this) iter = xcalloc(1, sizeof(*iter)); iter->ts = ts; - iter->oc = ((ts->transFlags & RPMTRANS_FLAG_REVERSE) - ? (ts->orderCount - 1) : 0); + iter->reverse = ((ts->transFlags & RPMTRANS_FLAG_REVERSE) ? 1 : 0); + iter->oc = (iter->reverse ? (ts->orderCount - 1) : 0); iter->ocsave = iter->oc; return iter; } diff --git a/rpmio/rpmerr.h b/rpmio/rpmerr.h index 57b47e3..7e22a11 100644 --- a/rpmio/rpmerr.h +++ b/rpmio/rpmerr.h @@ -10,8 +10,14 @@ #define _em(_e) \ (((_e) << 16) | RPMLOG_MAKEPRI(RPMLOG_ERRMSG, RPMLOG_ERR)) -#define _en(_e) \ +#define _wm(_e) \ + (((_e) << 16) | RPMLOG_MAKEPRI(RPMLOG_ERRMSG, RPMLOG_WARNING)) +#define _nm(_e) \ (((_e) << 16) | RPMLOG_MAKEPRI(RPMLOG_ERRMSG, RPMLOG_NOTICE)) +#define _im(_e) \ + (((_e) << 16) | RPMLOG_MAKEPRI(RPMLOG_ERRMSG, RPMLOG_INFO)) +#define _dm(_e) \ + (((_e) << 16) | RPMLOG_MAKEPRI(RPMLOG_ERRMSG, RPMLOG_DEBUG)) /** * Tokens used by rpmError(). @@ -87,12 +93,15 @@ typedef enum rpmerrCode_e { RPMERR_FREAD = _em(134), /*!< %s: Fread failed: %s */ RPMERR_READLEAD = _em(135), /*!< %s: readLead failed */ RPMERR_WRITELEAD = _em(136), /*!< %s: writeLead failed: %s */ - RPMERR_QUERYINFO = _en(137), /*!< */ - RPMERR_MANIFEST = _en(138), /*!< %s: read manifest failed: %s */ + RPMERR_QUERYINFO = _nm(137), /*!< */ + RPMERR_MANIFEST = _nm(138), /*!< %s: read manifest failed: %s */ RPMERR_BADSIGTYPE = _em(200), /*!< Unknown signature type */ RPMERR_SIGGEN = _em(201), /*!< Error generating signature */ - RPMERR_SIGVFY = _en(202) /*!< */ + RPMERR_SIGVFY = _nm(202), /*!< */ + + RPMWARN_UNLINK = _wm(512+16), /*!< unlink(2) failed */ + RPMWARN_RMDIR = _wm(512+17) /*!< rmdir(2) failed */ } rpmerrCode; /**