RPM Package Manager, CVS Repository http://rpm5.org/cvs/ ____________________________________________________________________________
Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: j...@rpm5.org Module: rpm Date: 17-Apr-2017 22:10:38 Branch: rpm-5_4 Handle: 2017041720103700 Modified files: (Branch: rpm-5_4) rpm/lib fsm.c fsm.h Log: - splint: RIP. Summary: Revision Changes Path 2.193.4.14 +58 -213 rpm/lib/fsm.c 2.42.6.2 +12 -32 rpm/lib/fsm.h ____________________________________________________________________________ patch -p0 <<'@@ .' Index: rpm/lib/fsm.c ============================================================================ $ cvs diff -u -r2.193.4.13 -r2.193.4.14 fsm.c --- rpm/lib/fsm.c 17 Apr 2017 18:19:07 -0000 2.193.4.13 +++ rpm/lib/fsm.c 17 Apr 2017 20:10:37 -0000 2.193.4.14 @@ -37,17 +37,6 @@ #include "debug.h" -/*@access FD_t @*/ /* XXX void ptr args */ -/*@access FSMI_t @*/ -/*@access IOSM_t @*/ -/*@access IOSMI_t @*/ - -/*@access rpmfi @*/ - -/*@access rpmsx @*/ /* XXX cast */ -/*@access rpmte @*/ /* XXX cast */ -/*@access rpmts @*/ /* XXX cast */ - #ifdef __cplusplus GENfree(const void *) GENfree(unsigned short *) @@ -58,13 +47,9 @@ #define alloca_strdup(_s) strcpy((char *)alloca(strlen(_s)+1), (_s)) #define _FSM_DEBUG 0 -/*@unchecked@*/ int _fsm_debug = _FSM_DEBUG; -/*@-exportheadervar@*/ -/*@unchecked@*/ int _fsm_threads = 0; -/*@=exportheadervar@*/ /** * Retrieve transaction set from file state machine iterator. @@ -72,12 +57,9 @@ * @return transaction set */ static rpmts fsmGetTs(const IOSM_t fsm) - /*@*/ { const FSMI_t iter = fsm->iter; - /*@-compdef -refcounttrans -retexpose -usereleased @*/ return (rpmts) (iter ? iter->ts : NULL); - /*@=compdef =refcounttrans =retexpose =usereleased @*/ } /** @@ -86,12 +68,9 @@ * @return transaction element file info */ static rpmfi fsmGetFi(const IOSM_t fsm) - /*@*/ { const FSMI_t iter = fsm->iter; - /*@-compdef -refcounttrans -retexpose -usereleased @*/ return (rpmfi) (iter ? iter->fi : NULL); - /*@=compdef =refcounttrans =retexpose =usereleased @*/ } #define SUFFIX_RPMORIG ".rpmorig" @@ -106,13 +85,11 @@ * @param suffix suffix to use (NULL disables) * @retval path to file */ -static /*@only@*//*@null@*/ -const char * fsmFsPath(/*@special@*/ /*@null@*/ const IOSM_t fsm, - /*@null@*/ const struct stat * st, - /*@null@*/ const char * subdir, - /*@null@*/ const char * suffix) - /*@uses fsm->dirName, fsm->baseName */ - /*@*/ +static +const char * fsmFsPath(const IOSM_t fsm, + const struct stat * st, + const char * subdir, + const char * suffix) { const char * s = NULL; @@ -139,17 +116,13 @@ * @param _iter file info iterator * @retval NULL always */ -static /*@null@*/ void * mapFreeIterator(/*@only@*//*@null@*/ void * _iter) - /*@globals fileSystem @*/ - /*@modifies fileSystem @*/ +static void * mapFreeIterator(void * _iter) { FSMI_t iter = (FSMI_t) _iter; if (iter) { iter->fi = rpmfiUnlink(iter->fi, "mapIterator"); -/*@-internalglobs@*/ /* XXX rpmswExit() */ (void) rpmtsFree(iter->ts); iter->ts = NULL; -/*@=internalglobs@*/ } return _free(iter); } @@ -162,14 +135,11 @@ */ static void * mapInitIterator(rpmfi fi, int reverse) - /*@modifies fi @*/ { FSMI_t iter = NULL; iter = (FSMI_t) xcalloc(1, sizeof(*iter)); -/*@-assignexpose -castexpose @*/ iter->fi = rpmfiLink(fi, "mapIterator"); -/*@=assignexpose =castexpose @*/ iter->reverse = reverse; iter->i = (iter->reverse ? (fi->fc - 1) : 0); iter->isave = iter->i; @@ -181,16 +151,13 @@ * @param _iter file info iterator * @return next index, -1 on termination */ -static int mapNextIterator(/*@null@*/ void * _iter) - /*@*/ +static int mapNextIterator(void * _iter) { FSMI_t iter = (FSMI_t) _iter; int i = -1; if (iter) { -/*@-onlytrans@*/ const rpmfi fi = (rpmfi) iter->fi; -/*@=onlytrans@*/ if (iter->reverse) { if (iter->i >= 0) i = iter->i--; } else { @@ -204,7 +171,6 @@ /** \ingroup payload */ static int cpioStrCmp(const void * a, const void * b) - /*@*/ { const char * aurl = *(const char **)a; const char * burl = *(const char **)b; @@ -237,15 +203,12 @@ * @param fsmPath archive path * @return index into file info, -1 if archive path was not found */ -static int mapFind(/*@null@*/ FSMI_t iter, const char * fsmPath) - /*@modifies iter @*/ +static int mapFind(FSMI_t iter, const char * fsmPath) { int ix = -1; if (iter) { -/*@-onlytrans@*/ const rpmfi fi = (rpmfi) iter->fi; -/*@=onlytrans@*/ size_t fc = rpmfiFC(fi); if (fi && fc > 0 && fi->apath && fsmPath && *fsmPath) { const char ** p = NULL; @@ -268,7 +231,6 @@ */ typedef struct dnli_s { rpmfi fi; -/*@only@*/ /*@null@*/ char * active; int reverse; int isave; @@ -280,8 +242,7 @@ * @param _dnli directory name iterator * @retval NULL always */ -static /*@null@*/ void * dnlFreeIterator(/*@only@*//*@null@*/const void * _dnli) - /*@modifies a @*/ +static void * dnlFreeIterator(const void * _dnli) { if (_dnli) { DNLI_t dnli = (DNLI_t) _dnli; @@ -292,16 +253,14 @@ /** \ingroup payload */ -static inline int dnlCount(/*@null@*/ const DNLI_t dnli) - /*@*/ +static inline int dnlCount(const DNLI_t dnli) { return (int) (dnli ? dnli->fi->dc : 0); } /** \ingroup payload */ -static inline int dnlIndex(/*@null@*/ const DNLI_t dnli) - /*@*/ +static inline int dnlIndex(const DNLI_t dnli) { return (dnli ? dnli->isave : -1); } @@ -312,12 +271,8 @@ * @param reverse traverse directory names in reverse order? * @return directory name iterator */ -/*@-usereleased@*/ -static /*@only@*/ /*@null@*/ -void * dnlInitIterator(/*@special@*/ const IOSM_t fsm, - int reverse) - /*@uses fsm->iter @*/ - /*@*/ +static +void * dnlInitIterator(const IOSM_t fsm, int reverse) { rpmfi fi = fsmGetFi(fsm); const char * dnl; @@ -357,20 +312,20 @@ size_t jlen; if (!dnli->active[j] || j == (int)dil) - /*@innercontinue@*/ continue; + continue; (void) urlPath(fi->dnl[j], &dnl); jlen = strlen(dnl); if (jlen != (dnlen+bnlen+1)) - /*@innercontinue@*/ continue; + continue; if (strncmp(dnl, fi->dnl[dil], dnlen)) - /*@innercontinue@*/ continue; + continue; if (strncmp(dnl+dnlen, fi->bnl[i], bnlen)) - /*@innercontinue@*/ continue; + continue; if (dnl[dnlen+bnlen] != '/' || dnl[dnlen+bnlen+1] != '\0') - /*@innercontinue@*/ continue; + continue; /* This directory is included in the package. */ dnli->active[j] = 0; - /*@innerbreak@*/ break; + break; } } @@ -393,16 +348,14 @@ } return dnli; } -/*@=usereleased@*/ /** \ingroup payload * Return next directory name (from file info). * @param dnli directory name iterator * @return next directory name */ -static /*@observer@*/ /*@null@*/ -const char * dnlNextIterator(/*@null@*/ DNLI_t dnli) - /*@modifies dnli @*/ +static +const char * dnlNextIterator(DNLI_t dnli) { const char * dn = NULL; @@ -426,19 +379,13 @@ #if defined(WITH_PTHREADS) static void * fsmThread(void * _fsm) - /*@globals h_errno, fileSystem, internalState @*/ - /*@modifies arg, fileSystem, internalState @*/ { IOSM_t fsm = (IOSM_t) _fsm; -/*@-unqualifiedtrans@*/ return ((void *) ((long)fsmStage(fsm, fsm->nstage))); -/*@=unqualifiedtrans@*/ } #endif int fsmNext(IOSM_t fsm, iosmFileStage nstage) - /*@globals h_errno, fileSystem, internalState @*/ - /*@modifies fsm, fileSystem, internalState @*/ { fsm->nstage = nstage; #if defined(WITH_PTHREADS) @@ -453,12 +400,7 @@ * @param fsm file state machine data * @return Is chain only partially filled? */ -static int saveHardLink(/*@special@*/ /*@partial@*/ IOSM_t fsm) - /*@uses fsm->links, fsm->ix, fsm->sb, fsm->goal, fsm->nsuffix @*/ - /*@defines fsm->li @*/ - /*@releases fsm->path @*/ - /*@globals h_errno, fileSystem, internalState @*/ - /*@modifies fsm, fileSystem, internalState @*/ +static int saveHardLink(IOSM_t fsm) { struct stat * st = &fsm->sb; int rc = 0; @@ -489,9 +431,7 @@ if (fsm->goal == IOSM_PKGINSTALL) fsm->li->linksLeft = 0; - /*@-kepttrans@*/ fsm->li->next = fsm->links; - /*@=kepttrans@*/ fsm->links = fsm->li; } @@ -502,9 +442,7 @@ } fsm->li->filex[fsm->li->linksLeft] = fsm->ix; - /*@-observertrans -dependenttrans@*/ fsm->li->nsuffix[fsm->li->linksLeft] = fsm->nsuffix; - /*@=observertrans =dependenttrans@*/ if (fsm->goal == IOSM_PKGINSTALL) fsm->li->linksLeft++; if (fsm->goal == IOSM_PKGBUILD) @@ -544,8 +482,7 @@ * @param li set of hard links * @return NULL always */ -static /*@null@*/ void * freeHardLink(/*@only@*/ /*@null@*/ struct hardLink_s * li) - /*@modifies li @*/ +static void * freeHardLink(struct hardLink_s * li) { if (li) { li->nsuffix = _free(li->nsuffix); /* XXX elements are shared */ @@ -580,7 +517,6 @@ #if defined(SUPPORT_AR_PAYLOADS) static int arSetup(IOSM_t fsm, rpmfi fi) - /*@modifies fsm @*/ { const char * path; char * t; @@ -637,10 +573,8 @@ unsigned int * archiveSize, const char ** failedFile) { IOSM_t fsm = (IOSM_t) _fsm; -/*@-castexpose@*/ const rpmts ts = (const rpmts) _ts; const rpmfi fi = (const rpmfi) _fi; -/*@=castexpose@*/ #if defined(_USE_RPMTE) int reverse = (rpmteType(fi->te) == TR_REMOVED && fi->action != FA_COPYOUT); int adding = (rpmteType(fi->te) == TR_ADDED); @@ -655,10 +589,8 @@ fsm->multithreaded = _fsm_threads; fsm->adding = adding; -/*@+voidabstract -nullpass@*/ if (fsm->debug < 0) fprintf(stderr, "--> fsmSetup(%p, 0x%x, \"%s\", %p, %p, %p, %p, %p)\n", fsm, goal, afmt, (void *)ts, fi, cfd, archiveSize, failedFile); -/*@=voidabstract =nullpass@*/ _iosmNext = &fsmNext; if (fsm->headerRead == NULL) { @@ -694,19 +626,13 @@ fsm->goal = goal; if (cfd != NULL) { -/*@-assignexpose -castexpose @*/ fsm->cfd = fdLink(cfd, "persist (fsm)"); -/*@=assignexpose =castexpose @*/ pos = fdGetCpioPos(fsm->cfd); fdSetCpioPos(fsm->cfd, 0); } -/*@-mods@*/ /* LCL: avoid void * _ts/_fi annotations for now. */ fsm->iter = mapInitIterator(fi, reverse); -/*@-assignexpose -castexpose @*/ fsm->iter->ts = rpmtsLink(ts, "mapIterator"); -/*@=assignexpose =castexpose @*/ fsm->nofcontexts = (rpmtsFlags(ts) & RPMTRANS_FLAG_NOCONTEXTS); -/*@=mods@*/ fsm->nofdigests = (ts != NULL && !(rpmtsFlags(ts) & RPMTRANS_FLAG_NOFDIGESTS)) ? 0 : 1; @@ -722,14 +648,12 @@ RPMCALLBACK_INST_START, fi->archivePos, fi->archiveSize); } - /*@-assignexpose@*/ fsm->archiveSize = archiveSize; if (fsm->archiveSize) *fsm->archiveSize = 0; fsm->failedFile = failedFile; if (fsm->failedFile) *fsm->failedFile = NULL; - /*@=assignexpose@*/ memset(fsm->sufbuf, 0, sizeof(fsm->sufbuf)); if (fsm->goal == IOSM_PKGINSTALL) { @@ -738,22 +662,16 @@ } ec = fsm->rc = 0; -/*@-mods@*/ /* LCL: avoid void * _fsm annotation for now. */ rc = fsmUNSAFE(fsm, IOSM_CREATE); -/*@=mods@*/ if (rc && !ec) ec = rc; -/*@-mods@*/ /* LCL: avoid void * _fsm annotation for now. */ rc = fsmUNSAFE(fsm, fsm->goal); -/*@=mods@*/ if (rc && !ec) ec = rc; if (fsm->archiveSize && ec == 0) *fsm->archiveSize = (fdGetCpioPos(fsm->cfd) - pos); -/*@-nullstate@*/ /* FIX: *fsm->failedFile may be NULL */ return ec; -/*@=nullstate@*/ } int fsmTeardown(void * _fsm) @@ -778,9 +696,7 @@ fsm->iter->ts = NULL; fsm->iter = mapFreeIterator(fsm->iter); if (fsm->cfd != NULL) { -/*@-refcounttrans@*/ /* FIX: XfdFree annotation */ fsm->cfd = fdFree(fsm->cfd, "persist (fsm)"); -/*@=refcounttrans@*/ fsm->cfd = NULL; } fsm->failedFile = NULL; @@ -793,7 +709,6 @@ * @return 0 always */ static int fsmMapFContext(IOSM_t fsm) - /*@modifies fsm @*/ { fsm->fcontext = NULL; if (!fsm->nofcontexts) { @@ -983,11 +898,7 @@ * @param fsm file state machine data * @return 0 on success */ -/*@-compdef@*/ -static int extractRegular(/*@special@*/ IOSM_t fsm) - /*@uses fsm->fdigest, fsm->digest, fsm->sb, fsm->wfd @*/ - /*@globals h_errno, fileSystem, internalState @*/ - /*@modifies fsm, fileSystem, internalState @*/ +static int extractRegular(IOSM_t fsm) { const struct stat * st = &fsm->sb; size_t left = (size_t) st->st_size; @@ -1070,7 +981,6 @@ return rc; } -/*@=compdef@*/ /** \ingroup payload * Write next item to payload stream. @@ -1078,11 +988,7 @@ * @param writeData should data be written? * @return 0 on success */ -/*@-compdef -compmempass@*/ -static int writeFile(/*@special@*/ /*@partial@*/ IOSM_t fsm, int writeData) - /*@uses fsm->path, fsm->opath, fsm->sb, fsm->osb, fsm->cfd @*/ - /*@globals h_errno, fileSystem, internalState @*/ - /*@modifies fsm, fileSystem, internalState @*/ +static int writeFile(IOSM_t fsm, int writeData) { const char * path = fsm->path; const char * opath = fsm->opath; @@ -1180,8 +1086,7 @@ #if defined(HAVE_MMAP) if (mapped != (void *)-1) { -/* XXX splint misses size_t 2nd arg. */ -/*@i@*/ xx = msync(mapped, nmapped, MS_ASYNC); + xx = msync(mapped, nmapped, MS_ASYNC); #if defined(HAVE_MADVISE) && defined(MADV_DONTNEED) xx = madvise(mapped, nmapped, MADV_DONTNEED); #endif @@ -1203,23 +1108,17 @@ exit: if (fsm->rfd != NULL) (void) fsmNext(fsm, IOSM_RCLOSE); -/*@-dependenttrans@*/ fsm->opath = opath; fsm->path = path; -/*@=dependenttrans@*/ return rc; } -/*@=compdef =compmempass@*/ /** \ingroup payload * Write set of linked files to payload stream. * @param fsm file state machine data * @return 0 on success */ -static int writeLinkedFile(/*@special@*/ /*@partial@*/ IOSM_t fsm) - /*@uses fsm->path, fsm->nsuffix, fsm->ix, fsm->li, fsm->failedFile @*/ - /*@globals h_errno, fileSystem, internalState @*/ - /*@modifies fsm, fileSystem, internalState @*/ +static int writeLinkedFile(IOSM_t fsm) { const char * path = fsm->path; const char * lpath = fsm->lpath; @@ -1241,9 +1140,7 @@ if (fsm->li->filex[i] < 0) continue; fsm->ix = fsm->li->filex[i]; -/*@-compdef@*/ rc = fsmNext(fsm, IOSM_MAP); -/*@=compdef@*/ /* XXX tar and cpio have to do things differently. */ if (fsm->headerWrite == tarHeaderWrite) { @@ -1274,9 +1171,7 @@ fsm->li->filex[i] = -1; } -/*@-dependenttrans@*/ linkpath = _free(linkpath); -/*@=dependenttrans@*/ fsm->ix = iterIndex; fsm->nsuffix = nsuffix; fsm->lpath = lpath; @@ -1289,11 +1184,7 @@ * @param fsm file state machine data * @return 0 on success */ -/*@-compdef@*/ -static int fsmMakeLinks(/*@special@*/ /*@partial@*/ IOSM_t fsm) - /*@uses fsm->path, fsm->opath, fsm->nsuffix, fsm->ix, fsm->li @*/ - /*@globals h_errno, fileSystem, internalState @*/ - /*@modifies fsm, fileSystem, internalState @*/ +static int fsmMakeLinks(IOSM_t fsm) { const char * path = fsm->path; const char * opath = fsm->opath; @@ -1342,19 +1233,13 @@ fsm->opath = opath; return ec; } -/*@=compdef@*/ /** \ingroup payload * Commit hard linked file set atomically. * @param fsm file state machine data * @return 0 on success */ -/*@-compdef@*/ -static int fsmCommitLinks(/*@special@*/ /*@partial@*/ IOSM_t fsm) - /*@uses fsm->path, fsm->nsuffix, fsm->ix, fsm->sb, - fsm->li, fsm->links @*/ - /*@globals h_errno, fileSystem, internalState @*/ - /*@modifies fsm, fileSystem, internalState @*/ +static int fsmCommitLinks(IOSM_t fsm) { const char * path = fsm->path; const char * nsuffix = fsm->nsuffix; @@ -1388,17 +1273,13 @@ fsm->path = path; return rc; } -/*@=compdef@*/ /** * Remove (if created) directories not explicitly included in package. * @param fsm file state machine data * @return 0 on success */ -static int fsmRmdirs(/*@special@*/ /*@partial@*/ IOSM_t fsm) - /*@uses fsm->path, fsm->dnlx, fsm->ldn, fsm->rdbuf, fsm->iter @*/ - /*@globals h_errno, fileSystem, internalState @*/ - /*@modifies fsm, fileSystem, internalState @*/ +static int fsmRmdirs(IOSM_t fsm) { const char * path = fsm->path; void * dnli = dnlInitIterator(fsm, 1); @@ -1408,7 +1289,6 @@ fsm->path = NULL; dn[0] = '\0'; - /*@-observertrans -dependenttrans@*/ if (fsm->ldn != NULL && fsm->dnlx != NULL) while ((fsm->path = dnlNextIterator(dnli)) != NULL) { size_t dnlen = strlen(fsm->path); @@ -1423,23 +1303,18 @@ fsm->path = dn; /* Remove generated directories. */ - /*@-usereleased@*/ /* LCL: te used after release? */ do { if (*te == '/') { *te = '\0'; -/*@-compdef@*/ rc = fsmNext(fsm, IOSM_RMDIR); -/*@=compdef@*/ *te = '/'; } if (rc) - /*@innerbreak@*/ break; + break; te--; } while ((te - fsm->path) > fsm->dnlx[dc]); - /*@=usereleased@*/ } dnli = dnlFreeIterator(dnli); - /*@=observertrans =dependenttrans@*/ fsm->path = path; return rc; @@ -1450,12 +1325,7 @@ * @param fsm file state machine data * @return 0 on success */ -static int fsmMkdirs(/*@special@*/ /*@partial@*/ IOSM_t fsm) - /*@uses fsm->path, fsm->sb, fsm->osb, fsm->rdbuf, fsm->iter, - fsm->ldn, fsm->ldnlen, fsm->ldnalloc @*/ - /*@defines fsm->dnlx, fsm->ldn @*/ - /*@globals h_errno, fileSystem, internalState @*/ - /*@modifies fsm, fileSystem, internalState @*/ +static int fsmMkdirs(IOSM_t fsm) { struct stat * st = &fsm->sb; struct stat * ost = &fsm->osb; @@ -1471,7 +1341,6 @@ dn[0] = '\0'; fsm->dnlx = (unsigned short *) (dc ? xcalloc(dc, sizeof(*fsm->dnlx)) : NULL); - /*@-observertrans -dependenttrans@*/ if (fsm->dnlx != NULL) while ((fsm->path = dnlNextIterator(dnli)) != NULL) { size_t dnlen = strlen(fsm->path); @@ -1483,10 +1352,8 @@ if (dnlen <= 1) continue; - /*@-compdef -nullpass@*/ /* FIX: fsm->ldn not defined ??? */ if (dnlen <= fsm->ldnlen && !strcmp(fsm->path, fsm->ldn)) continue; - /*@=compdef =nullpass@*/ /* Copy to avoid const on fsm->path. */ (void) stpcpy(dn, fsm->path); @@ -1496,12 +1363,11 @@ (void) urlPath(dn, (const char **)&te); for (i = 1, te++; *te != '\0'; te++, i++) { if (*te != '/') - /*@innercontinue@*/ continue; + continue; *te = '\0'; /* Already validated? */ - /*@-usedef -compdef -nullpass -nullderef@*/ if (i < fsm->ldnlen && (fsm->ldn[i] == '/' || fsm->ldn[i] == '\0') && !strncmp(fsm->path, fsm->ldn, i)) @@ -1509,9 +1375,8 @@ *te = '/'; /* Move pre-existing path marker forward. */ fsm->dnlx[dc] = (te - dn); - /*@innercontinue@*/ continue; + continue; } - /*@=usedef =compdef =nullpass =nullderef@*/ /* Validate next component of path. */ rc = fsmUNSAFE(fsm, IOSM_LSTAT); @@ -1545,12 +1410,11 @@ *te = '/'; } if (rc) - /*@innerbreak@*/ break; + break; } if (rc) break; /* Save last validated path. */ -/*@-compdef@*/ /* FIX: ldn/path annotations ? */ if (fsm->ldnalloc < (dnlen + 1)) { fsm->ldnalloc = dnlen + 100; fsm->ldn = (char *) xrealloc(fsm->ldn, fsm->ldnalloc); @@ -1559,16 +1423,12 @@ strcpy(fsm->ldn, fsm->path); fsm->ldnlen = dnlen; } -/*@=compdef@*/ } dnli = dnlFreeIterator(dnli); - /*@=observertrans =dependenttrans@*/ fsm->path = path; st->st_mode = st_mode; /* XXX restore st->st_mode */ -/*@-compdef@*/ /* FIX: ldn/path annotations ? */ return rc; -/*@=compdef@*/ } #ifdef NOTYET @@ -1577,9 +1437,7 @@ * @param fsm file state machine data * @return 0 on success */ -static int fsmStat(/*@special@*/ /*@partial@*/ IOSM_t fsm) - /*@globals fileSystem, internalState @*/ - /*@modifies fsm, fileSystem, internalState @*/ +static int fsmStat(IOSM_t fsm) { int rc = 0; @@ -1608,7 +1466,6 @@ ((_x)[sizeof("/dev/log")-1] == '\0' || \ (_x)[sizeof("/dev/log")-1] == ';')) -/*@-compmempass@*/ int fsmStage(IOSM_t fsm, iosmFileStage stage) { #ifdef NOTUSED @@ -1662,21 +1519,21 @@ /* Exit on end-of-payload. */ if (rc == IOSMERR_HDR_TRAILER) { rc = 0; - /*@loopbreak@*/ break; + break; } /* Exit on error. */ if (rc) { fsm->postpone = 1; (void) fsmNext(fsm, IOSM_UNDO); - /*@loopbreak@*/ break; + break; } /* Extract file from archive. */ rc = fsmNext(fsm, IOSM_PROCESS); if (rc) { (void) fsmNext(fsm, IOSM_UNDO); - /*@loopbreak@*/ break; + break; } /* Notify on success. */ @@ -1684,7 +1541,7 @@ rc = fsmNext(fsm, IOSM_FINI); if (rc) { - /*@loopbreak@*/ break; + break; } } break; @@ -1697,12 +1554,12 @@ /* Exit on end-of-payload. */ if (rc == IOSMERR_HDR_TRAILER) { rc = 0; - /*@loopbreak@*/ break; + break; } /* Rename/erase next item. */ if (fsmNext(fsm, IOSM_FINI)) - /*@loopbreak@*/ break; + break; } break; case IOSM_PKGBUILD: @@ -1713,28 +1570,28 @@ /* Exit on end-of-payload. */ if (rc == IOSMERR_HDR_TRAILER) { rc = 0; - /*@loopbreak@*/ break; + break; } /* Exit on error. */ if (rc) { fsm->postpone = 1; (void) fsmNext(fsm, IOSM_UNDO); - /*@loopbreak@*/ break; + break; } /* Copy file into archive. */ rc = fsmNext(fsm, IOSM_PROCESS); if (rc) { (void) fsmNext(fsm, IOSM_UNDO); - /*@loopbreak@*/ break; + break; } /* Notify on success. */ (void) fsmNext(fsm, IOSM_NOTIFY); if (fsmNext(fsm, IOSM_FINI)) - /*@loopbreak@*/ break; + break; } /* Flush partial sets of hard linked files. */ @@ -1747,7 +1604,7 @@ /* Re-calculate link count for archive header. */ for (j = -1, nlink = 0, i = 0; i < fsm->li->nlink; i++) { if (fsm->li->filex[i] < 0) - /*@innercontinue@*/ continue; + continue; nlink++; if (j == -1) j = i; } @@ -1806,9 +1663,7 @@ /* Detect and create directories not explicitly in package. */ if (fsm->goal == IOSM_PKGINSTALL) { -/*@-compdef@*/ rc = fsmNext(fsm, IOSM_MKDIRS); -/*@=compdef@*/ if (!rc) fsm->mkdirsdone = 1; } @@ -1899,7 +1754,6 @@ fsm->postpone = iosmFileActionSkipped(fsm->action); if (fsm->goal == IOSM_PKGINSTALL || fsm->goal == IOSM_PKGBUILD) { - /*@-evalorder@*/ /* FIX: saveHardLink can modify fsm */ if (S_ISREG(st->st_mode) && st->st_nlink > 1) { fsm->postpone = saveHardLink(fsm); if (fsm->postpone < 0) { @@ -1907,7 +1761,6 @@ break; } } - /*@=evalorder@*/ } if (fsmGetFi(fsm)->mapflags & IOSM_PAYLOAD_LIST) fsm->postpone = 1; break; @@ -1945,7 +1798,7 @@ for (li = fsm->links, prev = NULL; li; prev = li, li = li->next) if (li == fsm->li) - /*@loopbreak@*/ break; + break; if (prev == NULL) fsm->links = fsm->li->next; @@ -1996,9 +1849,7 @@ fsm->opath = opath; } - /*@-dependenttrans@*/ fsm->path = path; - /*@=dependenttrans@*/ if (!(rc == IOSMERR_ENOENT)) return rc; rc = extractRegular(fsm); } else if (S_ISDIR(st->st_mode)) { @@ -2012,7 +1863,6 @@ } } else if (S_ISLNK(st->st_mode)) { assert(fsm->lpath != NULL); - /*@=dependenttrans@*/ rc = fsmUNSAFE(fsm, IOSM_VERIFY); if (rc == IOSMERR_ENOENT) rc = fsmNext(fsm, IOSM_SYMLINK); @@ -2027,7 +1877,7 @@ } } else if (S_ISCHR(st->st_mode) || S_ISBLK(st->st_mode) || - /*@-unrecog@*/ S_ISSOCK(st->st_mode) /*@=unrecog@*/) + S_ISSOCK(st->st_mode) ) { rc = fsmUNSAFE(fsm, IOSM_VERIFY); if (rc == IOSMERR_ENOENT) @@ -2131,20 +1981,20 @@ case IOSMERR_ENOTEMPTY: /* XXX make sure that build side permits %missingok on directories. */ if (fsm->fflags & RPMFILE_MISSINGOK) - /*@innerbreak@*/ break; + break; /* XXX common error message. */ rpmlog( (fsm->strict_erasures ? RPMLOG_ERR : RPMLOG_DEBUG), _("%s rmdir of %s failed: Directory not empty\n"), rpmfiTypeString(fi), fsm->path); - /*@innerbreak@*/ break; + break; default: rpmlog( (fsm->strict_erasures ? RPMLOG_ERR : RPMLOG_DEBUG), _("%s rmdir of %s failed: %s\n"), rpmfiTypeString(fi), fsm->path, strerror(errno)); - /*@innerbreak@*/ break; + break; } } else { rc = fsmNext(fsm, IOSM_UNLINK); @@ -2152,14 +2002,14 @@ switch (rc) { case IOSMERR_ENOENT: if (fsm->fflags & RPMFILE_MISSINGOK) - /*@innerbreak@*/ break; + break; /*@fallthrough@*/ default: rpmlog( (fsm->strict_erasures ? RPMLOG_ERR : RPMLOG_DEBUG), _(" %s: unlink of %s failed: %s\n"), rpmfiTypeString(fi), fsm->path, strerror(errno)); - /*@innerbreak@*/ break; + break; } } } @@ -2196,9 +2046,7 @@ rc = fsmMapFContext(fsm); if (!rc) rc = fsmNext(fsm, IOSM_LSETFCON); -/*@-dependenttrans -observertrans @*/ /* FIX: use the SELinux free wrapper */ fsm->fcontext = _free(fsm->fcontext); -/*@=dependenttrans =observertrans @*/ } if (S_ISLNK(st->st_mode)) { if (!rc && !getuid()) @@ -2239,7 +2087,7 @@ { for (i = 0 ; i < fsm->li->linksLeft; i++) { if (fsm->li->filex[i] < 0) - /*@innercontinue@*/ continue; + continue; rc = IOSMERR_MISSING_HARDLINK; if (fsm->failedFile && *fsm->failedFile == NULL) { fsm->ix = fsm->li->filex[i]; @@ -2248,7 +2096,7 @@ fsm->path = NULL; } } - /*@loopbreak@*/ break; + break; } } if (fsm->goal == IOSM_PKGBUILD && @@ -2285,7 +2133,7 @@ fsm->path = fsm->opath; fsm->opath = NULL; return (rc ? rc : IOSMERR_ENOENT); /* XXX HACK */ - /*@notreached@*/ break; + break; } else if (S_ISDIR(st->st_mode)) { if (S_ISDIR(ost->st_mode)) return 0; if (S_ISLNK(ost->st_mode)) { @@ -2316,7 +2164,7 @@ if (fsm->stage == IOSM_PROCESS) rc = fsmNext(fsm, IOSM_UNLINK); if (rc == 0) rc = IOSMERR_ENOENT; return (rc ? rc : IOSMERR_ENOENT); /* XXX HACK */ - /*@notreached@*/ break; + break; case IOSM_UNLINK: { const char * fn = fsm->path; @@ -2337,9 +2185,7 @@ mode = sb.st_mode; rc = rpmlioUnlink(rpmtsGetRdb(fsmGetTs(fsm)), fn, mode, b, blen, d, dlen, dalgo); if (fd != NULL) { -/*@-observertrans@*/ /* FIX: b should be initialized to NULL, not "" */ (void) munmap(b, blen); -/*@=observertrans@*/ (void) Fclose(fd); fd = NULL; } @@ -2446,4 +2292,3 @@ } return rc; } -/*@=compmempass@*/ @@ . patch -p0 <<'@@ .' Index: rpm/lib/fsm.h ============================================================================ $ cvs diff -u -r2.42.6.1 -r2.42.6.2 fsm.h --- rpm/lib/fsm.h 27 Sep 2014 15:53:43 -0000 2.42.6.1 +++ rpm/lib/fsm.h 17 Apr 2017 20:10:37 -0000 2.42.6.2 @@ -11,17 +11,14 @@ /** \ingroup payload * File state machine data. */ -typedef /*@abstract@*/ struct iosm_s * FSM_t; +typedef struct iosm_s * FSM_t; -/*@-exportlocal@*/ -/*@unchecked@*/ extern int _fsm_debug; -/*@=exportlocal@*/ /** \ingroup payload * Iterator across package file info, forward on install, backward on erase. */ -typedef /*@abstract@*/ struct iosmIterator_s * FSMI_t; +typedef struct iosmIterator_s * FSMI_t; #ifdef __cplusplus extern "C" { @@ -31,17 +28,14 @@ * Create file state machine instance. * @return file state machine */ -/*@only@*/ IOSM_t newFSM(void) - /*@*/; +IOSM_t newFSM(void); /** * Destroy file state machine instance. * @param fsm file state machine * @return always NULL */ -/*@null@*/ IOSM_t freeFSM(/*@only@*/ /*@null@*/ IOSM_t fsm) - /*@globals fileSystem @*/ - /*@modifies fsm, fileSystem @*/; +IOSM_t freeFSM(IOSM_t fsm); /** * Load external data into file state machine. @@ -55,39 +49,31 @@ * @retval failedFile pointer to first file name that failed. * @return 0 on success */ -int fsmSetup(void * _fsm, iosmFileStage goal, /*@null@*/ const char * afmt, +int fsmSetup(void * _fsm, iosmFileStage goal, const char * afmt, const void * _ts, const void * _fi, FD_t cfd, - /*@out@*/ unsigned int * archiveSize, - /*@out@*/ const char ** failedFile) - /*@globals h_errno, fileSystem, internalState @*/ - /*@modifies cfd, *archiveSize, *failedFile, - fileSystem, internalState @*/; + unsigned int * archiveSize, + const char ** failedFile); /** * Clean file state machine. * @param _fsm file state machine * @return 0 on success */ -int fsmTeardown(void * _fsm) - /*@globals h_errno, fileSystem, internalState @*/ - /*@modifies _fsm, fileSystem, internalState @*/; +int fsmTeardown(void * _fsm); /** * Map next file path and action. * @param fsm file state machine */ -int fsmMapPath(IOSM_t fsm) - /*@modifies fsm @*/; +int fsmMapPath(IOSM_t fsm); /** * Map file stat(2) info. * @param fsm file state machine */ -int fsmMapAttrs(IOSM_t fsm) - /*@modifies fsm @*/; -/*@=exportlocal@*/ +int fsmMapAttrs(IOSM_t fsm); /** * File state machine driver. @@ -95,9 +81,7 @@ * @param nstage next stage * @return 0 on success */ -int fsmNext(IOSM_t fsm, iosmFileStage nstage) - /*@globals errno, h_errno, fileSystem, internalState @*/ - /*@modifies fsm, errno, fileSystem, internalState @*/; +int fsmNext(IOSM_t fsm, iosmFileStage nstage); /** * File state machine driver. @@ -105,11 +89,7 @@ * @param stage next stage * @return 0 on success */ -/*@-exportlocal@*/ -int fsmStage(/*@partial@*/ IOSM_t fsm, iosmFileStage stage) - /*@globals errno, h_errno, fileSystem, internalState @*/ - /*@modifies fsm, errno, fileSystem, internalState @*/; -/*@=exportlocal@*/ +int fsmStage(IOSM_t fsm, iosmFileStage stage); #ifdef __cplusplus } @@ . ______________________________________________________________________ RPM Package Manager http://rpm5.org CVS Sources Repository rpm-cvs@rpm5.org