diff options
-rw-r--r-- | CHANGES | 1 | ||||
-rw-r--r-- | build/files.c | 4 | ||||
-rw-r--r-- | build/pack.c | 12 | ||||
-rw-r--r-- | install.c | 11 | ||||
-rw-r--r-- | lib/dbindex.c | 2 | ||||
-rw-r--r-- | lib/dbindex.h | 28 | ||||
-rw-r--r-- | lib/depends.c | 36 | ||||
-rw-r--r-- | lib/header.c | 8 | ||||
-rw-r--r-- | lib/install.c | 26 | ||||
-rw-r--r-- | lib/query.c | 11 | ||||
-rw-r--r-- | lib/rpmdb.c | 39 | ||||
-rw-r--r-- | lib/rpmdb.h | 8 | ||||
-rw-r--r-- | lib/rpmlib.h | 4 | ||||
-rw-r--r-- | lib/signature.c | 20 | ||||
-rw-r--r-- | lib/uninstall.c | 53 | ||||
-rw-r--r-- | po/rpm.pot | 278 | ||||
-rwxr-xr-x | rpm.c | 4 | ||||
-rw-r--r-- | rpm2cpio.c | 4 | ||||
-rw-r--r-- | tests/Makefile.am | 2 | ||||
-rw-r--r-- | tests/Makefile.in | 2 | ||||
-rw-r--r-- | tests/hello-test/ckH.exp | 28 | ||||
-rw-r--r-- | tests/hello-test/ckS.exp | 6 | ||||
-rw-r--r-- | tests/hello-test/e.exp | 2 | ||||
-rwxr-xr-x | tests/hello-test/i | 1 | ||||
-rw-r--r-- | tests/hello-test/i.exp | 8 | ||||
-rw-r--r-- | tests/hello-test/qi.exp | 6 | ||||
-rw-r--r-- | tests/hello-test/showrc.exp | 33 | ||||
-rw-r--r-- | tests/hello-test/test0.exp | 11 | ||||
-rw-r--r-- | tools/dump.c | 7 | ||||
-rw-r--r-- | tools/rpmarchive.c | 4 | ||||
-rw-r--r-- | tools/rpmgettext.c | 2 | ||||
-rw-r--r-- | tools/rpmheader.c | 4 | ||||
-rw-r--r-- | tools/rpmlead.c | 4 | ||||
-rw-r--r-- | tools/rpmsignature.c | 4 | ||||
-rw-r--r-- | verify.c | 15 |
35 files changed, 389 insertions, 299 deletions
@@ -1,4 +1,5 @@ 2.5.6 -> 2.90 + - finish hiding rpmdb index record data ("matches"). - implement abstract fd type almost everywhere. - update and rename Czech (Pavel Makovec <pavelm@terminal.cz>) - augment --showrc with -v, only display set variables without -v. diff --git a/build/files.c b/build/files.c index c4f6ff2d8..3d2dccf34 100644 --- a/build/files.c +++ b/build/files.c @@ -1451,8 +1451,8 @@ static StringBuf getOutputFrom(char *dir, char *argv[], close(toProg[1]); close(fromProg[0]); - dup2(toProg[0], 0); /* Make stdin the in pipe */ - dup2(fromProg[1], 1); /* Make stdout the out pipe */ + dup2(toProg[0], STDIN_FILENO); /* Make stdin the in pipe */ + dup2(fromProg[1], STDOUT_FILENO); /* Make stdout the out pipe */ close(toProg[0]); close(fromProg[1]); diff --git a/build/pack.c b/build/pack.c index e21f28e4e..986456791 100644 --- a/build/pack.c +++ b/build/pack.c @@ -56,6 +56,11 @@ int packageSources(Spec spec) headerAddEntry(spec->sourceHeader, RPMTAG_BUILDTIME, RPM_INT32_TYPE, getBuildTime(), 1); + { int capability = 0; + headerAddEntry(spec->sourceHeader, RPMTAG_CAPABILITY, RPM_INT32_TYPE, + &capability, 1); + } + genSourceRpmName(spec); /* XXX this should be %_srpmdir */ @@ -127,6 +132,11 @@ int packageBinaries(Spec spec) headerAddEntry(pkg->header, RPMTAG_BUILDTIME, RPM_INT32_TYPE, getBuildTime(), 1); + { int capability = 0; + headerAddEntry(pkg->header, RPMTAG_CAPABILITY, RPM_INT32_TYPE, + &capability, 1); + } + genSourceRpmName(spec); headerAddEntry(pkg->header, RPMTAG_SOURCERPM, RPM_STRING_TYPE, spec->sourceRpmName, 1); @@ -174,7 +184,7 @@ int readRPM(char *fileName, Spec *specp, struct rpmlead *lead, Header *sigs, strerror(errno)); return RPMERR_BADMAGIC; } else { - fdi = fdDup(0); + fdi = fdDup(STDIN_FILENO); } /* Get copy of lead */ @@ -326,8 +326,8 @@ int doUninstall(char * rootdir, char ** argv, int uninstallFlags, numFailed++; } else { count = 0; - for (i = 0; i < matches.count; i++) - if (matches.recs[i].recOffset) count++; + for (i = 0; i < dbiIndexSetCount(matches); i++) + if (dbiIndexRecordOffset(matches, i)) count++; if (count > 1 && !(interfaceFlags & UNINSTALL_ALLMATCHES)) { fprintf(stderr, _("\"%s\" specifies multiple packages\n"), @@ -341,9 +341,10 @@ int doUninstall(char * rootdir, char ** argv, int uninstallFlags, packageOffsets = realloc(packageOffsets, sizeof(int *) * packageOffsetsAlloced); } - for (i = 0; i < matches.count; i++) { - if (matches.recs[i].recOffset) { - packageOffsets[j++] = matches.recs[i].recOffset; + for (i = 0; i < dbiIndexSetCount(matches); i++) { + unsigned int recOffset = dbiIndexRecordOffset(matches, i); + if (recOffset) { + packageOffsets[j++] = recOffset; } } } diff --git a/lib/dbindex.c b/lib/dbindex.c index e6279bb39..f4ea52a8e 100644 --- a/lib/dbindex.c +++ b/lib/dbindex.c @@ -95,9 +95,11 @@ int dbiAppendIndexRecord(dbiIndexSet * set, dbiIndexRecord rec) { return 0; } +/* structure return */ dbiIndexSet dbiCreateIndexRecord(void) { dbiIndexSet set; + set.recs = NULL; set.count = 0; return set; } diff --git a/lib/dbindex.h b/lib/dbindex.h index 30004a184..7945df907 100644 --- a/lib/dbindex.h +++ b/lib/dbindex.h @@ -9,12 +9,12 @@ /* this will break if sizeof(int) != 4 */ -typedef struct { +typedef /*@abstract@*/ struct { unsigned int recOffset; unsigned int fileNumber; } dbiIndexRecord; -typedef struct { +typedef /*@abstract@*/ struct { dbiIndexRecord * recs; int count; } dbiIndexSet; @@ -42,6 +42,30 @@ int dbiRemoveIndexRecord(dbiIndexSet * set, dbiIndexRecord rec); dbiIndexSet dbiCreateIndexRecord(void); void dbiFreeIndexRecord(dbiIndexSet set); +extern inline int dbiIndexSetCount(dbiIndexSet set); +extern inline int dbiIndexSetCount(dbiIndexSet set) { + return set.count; +} + +/* structure return */ +extern inline dbiIndexRecord dbiReturnIndexRecordInstance(unsigned int recOffset, unsigned int fileNumber); +extern inline dbiIndexRecord dbiReturnIndexRecordInstance(unsigned int recOffset, unsigned int fileNumber) { + dbiIndexRecord rec; + rec.recOffset = recOffset; + rec.fileNumber = fileNumber; + return rec; +} + +extern inline unsigned int dbiIndexRecordOffset(dbiIndexSet set, int recno); +extern inline unsigned int dbiIndexRecordOffset(dbiIndexSet set, int recno) { + return set.recs[recno].recOffset; +} + +extern inline unsigned int dbiIndexRecordFileNumber(dbiIndexSet set, int recno); +extern inline unsigned int dbiIndexRecordFileNumber(dbiIndexSet set, int recno) { + return set.recs[recno].fileNumber; +} + #ifdef __cplusplus } #endif diff --git a/lib/depends.c b/lib/depends.c index f95edc362..6dd3dbf84 100644 --- a/lib/depends.c +++ b/lib/depends.c @@ -252,8 +252,8 @@ void rpmdepUpgradePackage(rpmDependencies rpmdep, Header h, void * key) { headerGetEntry(h, RPMTAG_NAME, NULL, (void *) &name, &count); if (!rpmdbFindPackage(rpmdep->db, name, &matches)) { - for (i = 0; i < matches.count; i++) { - rpmdepRemovePackage(rpmdep, matches.recs[i].recOffset); + for (i = 0; i < dbiIndexSetCount(matches); i++) { + rpmdepRemovePackage(rpmdep, dbiIndexRecordOffset(matches, i)); } dbiFreeIndexRecord(matches); @@ -263,8 +263,8 @@ void rpmdepUpgradePackage(rpmDependencies rpmdep, Header h, void * key) { &count)) { for (j = 0; j < count; j++) { if (!rpmdbFindPackage(rpmdep->db, obsoletes[j], &matches)) { - for (i = 0; i < matches.count; i++) { - rpmdepRemovePackage(rpmdep, matches.recs[i].recOffset); + for (i = 0; i < dbiIndexSetCount(matches); i++) { + rpmdepRemovePackage(rpmdep, dbiIndexRecordOffset(matches, i)); } dbiFreeIndexRecord(matches); @@ -457,8 +457,9 @@ static int unsatisfiedDepend(rpmDependencies rpmdep, char * reqName, if (*reqName == '/') { /* reqFlags better be 0! */ if (!rpmdbFindByFile(rpmdep->db, reqName, &matches)) { - for (i = 0; i < matches.count; i++) { - if (bsearch(&matches.recs[i].recOffset, + for (i = 0; i < dbiIndexSetCount(matches); i++) { + unsigned int recOffset = dbiIndexRecordOffset(matches, i); + if (bsearch(&recOffset, rpmdep->removedPackages, rpmdep->numRemovedPackages, sizeof(int), intcmp)) @@ -467,13 +468,14 @@ static int unsatisfiedDepend(rpmDependencies rpmdep, char * reqName, } dbiFreeIndexRecord(matches); - if (i < matches.count) return 0; + if (i < dbiIndexSetCount(matches)) return 0; } } else { if (!reqFlags && !rpmdbFindByProvides(rpmdep->db, reqName, &matches)) { - for (i = 0; i < matches.count; i++) { - if (bsearch(&matches.recs[i].recOffset, + for (i = 0; i < dbiIndexSetCount(matches); i++) { + unsigned int recOffset = dbiIndexRecordOffset(matches, i); + if (bsearch(&recOffset, rpmdep->removedPackages, rpmdep->numRemovedPackages, sizeof(int), intcmp)) @@ -482,25 +484,26 @@ static int unsatisfiedDepend(rpmDependencies rpmdep, char * reqName, } dbiFreeIndexRecord(matches); - if (i < matches.count) return 0; + if (i < dbiIndexSetCount(matches)) return 0; } if (!rpmdbFindPackage(rpmdep->db, reqName, &matches)) { - for (i = 0; i < matches.count; i++) { - if (bsearch(&matches.recs[i].recOffset, + for (i = 0; i < dbiIndexSetCount(matches); i++) { + unsigned int recOffset = dbiIndexRecordOffset(matches, i); + if (bsearch(&recOffset, rpmdep->removedPackages, rpmdep->numRemovedPackages, sizeof(int), intcmp)) continue; - if (dbrecMatchesDepFlags(rpmdep, matches.recs[i].recOffset, + if (dbrecMatchesDepFlags(rpmdep, recOffset, reqVersion, reqFlags)) { break; } } dbiFreeIndexRecord(matches); - if (i < matches.count) return 0; + if (i < dbiIndexSetCount(matches)) return 0; } } } @@ -518,11 +521,12 @@ static int checkPackageSet(rpmDependencies rpmdep, struct problemsSet * psp, Header h; for (i = 0; i < matches->count; i++) { - if (bsearch(&matches->recs[i].recOffset, rpmdep->removedPackages, + unsigned int recOffset = dbiIndexRecordOffset(*matches, i); + if (bsearch(&recOffset, rpmdep->removedPackages, rpmdep->numRemovedPackages, sizeof(int), intcmp)) continue; - h = rpmdbGetRecord(rpmdep->db, matches->recs[i].recOffset); + h = rpmdbGetRecord(rpmdep->db, recOffset); if (h == NULL) { rpmError(RPMERR_DBCORRUPT, _("cannot read header at %d for dependency check"), diff --git a/lib/header.c b/lib/header.c index a1c3c03ac..914a39819 100644 --- a/lib/header.c +++ b/lib/header.c @@ -614,7 +614,7 @@ void headerDump(Header h, FILE *f, int flags, case RPM_INT16_TYPE: while (c--) { fprintf(f, " Data: %.3d 0x%04x (%d)\n", ct++, - (unsigned) *((int_16 *) dp), + (unsigned) (*((int_16 *) dp) & 0xffff), (int) *((int_16 *) dp)); dp += sizeof(int_16); } @@ -622,7 +622,7 @@ void headerDump(Header h, FILE *f, int flags, case RPM_INT8_TYPE: while (c--) { fprintf(f, " Data: %.3d 0x%02x (%d)\n", ct++, - (unsigned) *((int_8 *) dp), + (unsigned) (*((int_8 *) dp) & 0xff), (int) *((int_8 *) dp)); dp += sizeof(int_8); } @@ -631,7 +631,7 @@ void headerDump(Header h, FILE *f, int flags, while (c > 0) { fprintf(f, " Data: %.3d ", ct); while (c--) { - fprintf(f, "%02x ", (unsigned) *(int_8 *)dp); + fprintf(f, "%02x ", (unsigned) (*(int_8 *)dp & 0xff)); ct++; dp += sizeof(int_8); if (! (ct % 8)) { @@ -645,7 +645,7 @@ void headerDump(Header h, FILE *f, int flags, while (c--) { ch = (char) *((char *) dp); fprintf(f, " Data: %.3d 0x%2x %c (%d)\n", ct++, - (unsigned)ch, + (unsigned)(ch & 0xff), (isprint(ch) ? ch : ' '), (char) *((char *) dp)); dp += sizeof(char); diff --git a/lib/install.c b/lib/install.c index 4cce459e4..861733bd5 100644 --- a/lib/install.c +++ b/lib/install.c @@ -521,7 +521,7 @@ int rpmInstallPackage(char * rootdir, rpmdb db, FD_t fd, scriptArg = 1; } else { hasOthers = 1; - scriptArg = matches.count + 1; + scriptArg = dbiIndexSetCount(matches) + 1; } if (flags & RPMINSTALL_UPGRADE) { @@ -540,17 +540,18 @@ int rpmInstallPackage(char * rootdir, rpmdb db, FD_t fd, */ if (hasOthers) { - toRemoveAlloced = matches.count + 1; + toRemoveAlloced = dbiIndexSetCount(matches) + 1; intptr = toRemove = malloc(toRemoveAlloced * sizeof(int)); - for (i = 0; i < matches.count; i++) { - if (matches.recs[i].recOffset != otherOffset) { + for (i = 0; i < dbiIndexSetCount(matches); i++) { + unsigned int recOffset = dbiIndexRecordOffset(matches, i); + if (recOffset != otherOffset) { if (!(flags & RPMINSTALL_UPGRADETOOLD)) - if (ensureOlder(db, h, matches.recs[i].recOffset)) { + if (ensureOlder(db, h, recOffset)) { headerFree(h); dbiFreeIndexRecord(matches); return 2; } - *intptr++ = matches.recs[i].recOffset; + *intptr++ = recOffset; } } @@ -568,13 +569,13 @@ int rpmInstallPackage(char * rootdir, rpmdb db, FD_t fd, rpmMessage(RPMMESS_DEBUG, _("package %s is now obsolete and will" " be removed\n"), obsoletes[i]); - toRemoveAlloced += matches.count; + toRemoveAlloced += dbiIndexSetCount(matches); j = toRemove ? intptr - toRemove : 0; toRemove = realloc(toRemove, toRemoveAlloced * sizeof(int)); intptr = toRemove + j; - for (j = 0; j < matches.count; j++) - *intptr++ = matches.recs[j].recOffset; + for (j = 0; j < dbiIndexSetCount(matches); j++) + *intptr++ = dbiIndexRecordOffset(matches, j); dbiFreeIndexRecord(matches); } @@ -1042,8 +1043,9 @@ static int packageAlreadyInstalled(rpmdb db, char * name, char * version, int type, count; if (!rpmdbFindPackage(db, name, &matches)) { - for (i = 0; i < matches.count; i++) { - sech = rpmdbGetRecord(db, matches.recs[i].recOffset); + for (i = 0; i < dbiIndexSetCount(matches); i++) { + unsigned int recOffset = dbiIndexRecordOffset(matches, i); + sech = rpmdbGetRecord(db, recOffset); if (sech == NULL) { return 1; } @@ -1054,7 +1056,7 @@ static int packageAlreadyInstalled(rpmdb db, char * name, char * version, &count); if (!strcmp(secVersion, version) && !strcmp(secRelease, release)) { - *offset = matches.recs[i].recOffset; + *offset = recOffset; if (!(flags & RPMINSTALL_REPLACEPKG)) { rpmError(RPMERR_PKGINSTALLED, _("package %s-%s-%s is already installed"), diff --git a/lib/query.c b/lib/query.c index 7abdf6f95..d1e8f2520 100644 --- a/lib/query.c +++ b/lib/query.c @@ -393,12 +393,13 @@ static void showMatches(rpmdb db, dbiIndexSet matches, int queryFlags, int i; Header h; - for (i = 0; i < matches.count; i++) { - if (matches.recs[i].recOffset) { + for (i = 0; i < dbiIndexSetCount(matches); i++) { + unsigned int recOffset = dbiIndexRecordOffset(matches, i); + if (recOffset) { rpmMessage(RPMMESS_DEBUG, _("querying record number %d\n"), - matches.recs[i].recOffset); + recOffset); - h = rpmdbGetRecord(db, matches.recs[i].recOffset); + h = rpmdbGetRecord(db, recOffset); if (h == NULL) { fprintf(stderr, _("error: could not read database record\n")); } else { @@ -443,7 +444,7 @@ int rpmQuery(char * prefix, enum rpmQuerySources source, int queryFlags, fd = fdDup(fdno); close(fdno); } else if (!strcmp(arg, "-")) { - fd = fdDup(0); + fd = fdDup(STDIN_FILENO); } else { if (fdFileno(fd = fdOpen( arg, O_RDONLY, 0)) < 0) { fprintf(stderr, _("open of %s failed: %s\n"), arg, diff --git a/lib/rpmdb.c b/lib/rpmdb.c index 331844eb1..874a8c27b 100644 --- a/lib/rpmdb.c +++ b/lib/rpmdb.c @@ -29,8 +29,7 @@ struct rpmdb_s { static void removeIndexEntry(dbiIndex * dbi, char * name, dbiIndexRecord rec, int tolerant, char * idxName); -static int addIndexEntry(dbiIndex * idx, char * index, unsigned int offset, - unsigned int fileNumber); +static int addIndexEntry(dbiIndex * idx, char * index, dbiIndexRecord rec); static void blockSignals(void); static void unblockSignals(void); @@ -301,8 +300,8 @@ int rpmdbRemove(rpmdb db, unsigned int offset, int tolerant) { char ** conflictList, ** triggerList; int i; - rec.recOffset = offset; - rec.fileNumber = 0; + /* structure assignment */ + rec = dbiReturnIndexRecordInstance(offset, 0); h = rpmdbGetRecord(db, offset); if (h == NULL) { @@ -380,7 +379,8 @@ int rpmdbRemove(rpmdb db, unsigned int offset, int tolerant) { &count)) { for (i = 0; i < count; i++) { rpmMessage(RPMMESS_DEBUG, _("removing file index for %s\n"), fileList[i]); - rec.fileNumber = i; + /* structure assignment */ + rec = dbiReturnIndexRecordInstance(offset, i); removeIndexEntry(db->fileIndex, fileList[i], rec, tolerant, "file index"); } @@ -402,22 +402,17 @@ int rpmdbRemove(rpmdb db, unsigned int offset, int tolerant) { return 0; } -static int addIndexEntry(dbiIndex * idx, char * index, unsigned int offset, - unsigned int fileNumber) { +static int addIndexEntry(dbiIndex * idx, char * index, dbiIndexRecord rec) { dbiIndexSet set; - dbiIndexRecord irec; int rc; - irec.recOffset = offset; - irec.fileNumber = fileNumber; - rc = dbiSearchIndex(idx, index, &set); if (rc == -1) /* error */ return 1; if (rc == 1) /* new item */ set = dbiCreateIndexRecord(); - dbiAppendIndexRecord(&set, irec); + dbiAppendIndexRecord(&set, rec); if (dbiUpdateIndex(idx, index, &set)) exit(1); dbiFreeIndexRecord(set); @@ -425,6 +420,7 @@ static int addIndexEntry(dbiIndex * idx, char * index, unsigned int offset, } int rpmdbAdd(rpmdb db, Header dbentry) { + dbiIndexRecord rec; unsigned int dboffset; unsigned int i, j; char ** fileList; @@ -473,9 +469,13 @@ int rpmdbAdd(rpmdb db, Header dbentry) { headerWrite(faFileno(db->pkgs), dbentry, HEADER_MAGIC_NO); /* Now update the appropriate indexes */ - if (addIndexEntry(db->nameIndex, name, dboffset, 0)) + + /* structure assignment */ + rec = dbiReturnIndexRecordInstance(dboffset, 0); + + if (addIndexEntry(db->nameIndex, name, rec)) rc = 1; - if (addIndexEntry(db->groupIndex, group, dboffset, 0)) + if (addIndexEntry(db->groupIndex, group, rec)) rc = 1; for (i = 0; i < triggerCount; i++) { @@ -483,21 +483,20 @@ int rpmdbAdd(rpmdb db, Header dbentry) { for (j = 0; j < i; j++) if (!strcmp(triggerList[i], triggerList[j])) break; if (j == i) - rc += addIndexEntry(db->triggerIndex, triggerList[i], dboffset, 0); + rc += addIndexEntry(db->triggerIndex, triggerList[i], rec); } for (i = 0; i < conflictCount; i++) - rc += addIndexEntry(db->conflictsIndex, conflictList[i], dboffset, 0); + rc += addIndexEntry(db->conflictsIndex, conflictList[i], rec); for (i = 0; i < requiredbyCount; i++) - rc += addIndexEntry(db->requiredbyIndex, requiredbyList[i], - dboffset, 0); + rc += addIndexEntry(db->requiredbyIndex, requiredbyList[i], rec); for (i = 0; i < providesCount; i++) - rc += addIndexEntry(db->providesIndex, providesList[i], dboffset, 0); + rc += addIndexEntry(db->providesIndex, providesList[i], rec); for (i = 0; i < count; i++) - rc += addIndexEntry(db->fileIndex, fileList[i], dboffset, i); + rc += addIndexEntry(db->fileIndex, fileList[i], rec); dbiSyncIndex(db->nameIndex); dbiSyncIndex(db->groupIndex); diff --git a/lib/rpmdb.h b/lib/rpmdb.h index c1f1093ee..3aaa9a494 100644 --- a/lib/rpmdb.h +++ b/lib/rpmdb.h @@ -3,6 +3,10 @@ #include "rpmlib.h" +#ifdef __cplusplus +extern "C" { +#endif + /* for RPM's internal use only */ int openDatabase(char * prefix, char * dbpath, rpmdb *rpmdbp, int mode, @@ -13,4 +17,8 @@ int rpmdbUpdateRecord(rpmdb db, int secOffset, Header secHeader); void rpmdbRemoveDatabase(char * rootdir, char * dbpath); int rpmdbMoveDatabase(char * rootdir, char * olddbpath, char * newdbpath); +#ifdef __cplusplus +} +#endif + #endif /* H_RPMDB */ diff --git a/lib/rpmlib.h b/lib/rpmlib.h index 45fe078c3..cecad8591 100644 --- a/lib/rpmlib.h +++ b/lib/rpmlib.h @@ -304,11 +304,11 @@ int rpmdbFindByRequiredBy(rpmdb db, char * requires, dbiIndexSet * matches); int rpmdbFindByConflicts(rpmdb db, char * conflicts, dbiIndexSet * matches); int rpmdbFindByTriggeredBy(rpmdb db, char * package, dbiIndexSet * matches); -/* these are just convience functions */ +/* these are just convenience functions */ int rpmdbFindByLabel(rpmdb db, char * label, dbiIndexSet * matches); int rpmdbFindByHeader(rpmdb db, Header h, dbiIndexSet * matches); -/* we pass these aroung as an array with a sentinel */ +/* we pass these around as an array with a sentinel */ struct rpmRelocation { char * oldPath; /* NULL here evals to RPMTAG_DEFAULTPREFIX, this */ char * newPath; /* odd behavior is only for backwards compatibility */ diff --git a/lib/signature.c b/lib/signature.c index 69b9e6966..331780d79 100644 --- a/lib/signature.c +++ b/lib/signature.c @@ -195,7 +195,7 @@ static int makePGPSignature(char *file, void **sig, int_32 *size, pipe(inpipe); if (!(pid = fork())) { - close(0); + close(STDIN_FILENO); dup2(inpipe[0], 3); close(inpipe[1]); dosetenv("PGPPASSFD", "3", 1); @@ -370,9 +370,9 @@ static int verifyPGPSignature(char *datafile, void *sig, pipe(outpipe); if (!(pid = fork())) { - close(1); + close(STDOUT_FILENO); close(outpipe[0]); - dup2(outpipe[1], 1); + dup2(outpipe[1], STDOUT_FILENO); if (rpmGetVar(RPMVAR_PGP_PATH)) { dosetenv("PGPPATH", rpmGetVar(RPMVAR_PGP_PATH), 1); } @@ -445,16 +445,16 @@ static int checkPassPhrase(char *passPhrase) pipe(passPhrasePipe); if (!(pid = fork())) { - close(0); - close(1); + close(STDIN_FILENO); + close(STDOUT_FILENO); if (! rpmIsVerbose()) { - close(2); + close(STDERR_FILENO); } - if ((fd = open("/dev/null", O_RDONLY)) != 0) { - dup2(fd, 0); + if ((fd = open("/dev/null", O_RDONLY)) != STDIN_FILENO) { + dup2(fd, STDIN_FILENO); } - if ((fd = open("/dev/null", O_WRONLY)) != 1) { - dup2(fd, 1); + if ((fd = open("/dev/null", O_WRONLY)) != STDOUT_FILENO) { + dup2(fd, STDOUT_FILENO); } dup2(passPhrasePipe[0], 3); dosetenv("PGPPASSFD", "3", 1); diff --git a/lib/uninstall.c b/lib/uninstall.c index bd9f99d41..0b98291ac 100644 --- a/lib/uninstall.c +++ b/lib/uninstall.c @@ -47,16 +47,17 @@ int findSharedFiles(rpmdb db, int offset, char ** fileList, int fileCount, for (i = 0; i < fileCount; i++) { if (!rpmdbFindByFile(db, fileList[i], &matches)) { - for (j = 0; j < matches.count; j++) { - if (matches.recs[j].recOffset != offset) { + for (j = 0; j < dbiIndexSetCount(matches); j++) { + unsigned int recOffset = dbiIndexRecordOffset(matches, j); + if (recOffset != offset) { if (itemsUsed == itemsAllocated) { itemsAllocated += 10; list = realloc(list, sizeof(struct sharedFile) * itemsAllocated); } list[itemsUsed].mainFileNumber = i; - list[itemsUsed].secRecOffset = matches.recs[j].recOffset; - list[itemsUsed].secFileNumber = matches.recs[j].fileNumber; + list[itemsUsed].secRecOffset = dbiIndexRecordOffset(matches, j); + list[itemsUsed].secFileNumber = dbiIndexRecordFileNumber(matches, j); itemsUsed++; } } @@ -230,7 +231,7 @@ int rpmRemovePackage(char * prefix, rpmdb db, unsigned int offset, int flags) { return 1; } - scriptArg = matches.count - 1; + scriptArg = dbiIndexSetCount(matches) - 1; dbiFreeIndexRecord(matches); if (!(flags & RPMUNINSTALL_NOTRIGGERS)) { @@ -376,7 +377,7 @@ static int runScript(Header h, char * root, int progArgc, char ** progArgv, int i; int freePrefixes = 0; int pipes[2]; - int out = 1; + FD_t out; if (!progArgv && !script) return 0; @@ -440,28 +441,30 @@ static int runScript(Header h, char * root, int progArgc, char ** progArgv, if (errfd != NULL) { if (rpmIsVerbose()) { - out = fdFileno(errfd); + out = errfd; } else { - out = open("/dev/null", O_WRONLY); - if (out < 0) { - out = fdFileno(errfd); + out = fdOpen("/dev/null", O_WRONLY, 0); + if (fdFileno(out) < 0) { + out = errfd; } } + } else { + out = fdDup(STDOUT_FILENO); } if (!(child = fork())) { /* make stdin inaccessible */ pipe(pipes); close(pipes[1]); - dup2(pipes[0], 0); + dup2(pipes[0], STDIN_FILENO); close(pipes[0]); if (errfd != NULL) { - if (fdFileno(errfd) != 2) dup2(fdFileno(errfd), 2); - if (out != 1) dup2(out, 1); + if (fdFileno(errfd) != STDERR_FILENO) dup2(fdFileno(errfd), STDERR_FILENO); + if (fdFileno(out) != STDOUT_FILENO) dup2(fdFileno(out), STDOUT_FILENO); /* make sure we don't close stdin/stderr/stdout by mistake! */ - if (out > 2 && out != fdFileno(errfd)) close (out); - if (fdFileno(errfd) > 2) fdClose (errfd); + if (fdFileno(out) > STDERR_FILENO && out != errfd) fdClose (out); + if (fdFileno(errfd) > STDERR_FILENO) fdClose (errfd); } doputenv(SCRIPT_PATH); @@ -491,9 +494,9 @@ static int runScript(Header h, char * root, int progArgc, char ** progArgv, if (freePrefixes) free(prefixes); + fdClose(out); /* XXX dup'd STDOUT_FILENO */ if (errfd != NULL) { - if (out > 2) close(out); - if (fdFileno(errfd) > 2) fdClose(errfd); + if (fdFileno(errfd) > STDERR_FILENO) fdClose(errfd); } if (script) { @@ -690,7 +693,7 @@ static int handleOneTrigger(char * root, rpmdb db, int sense, Header sourceH, if (!triggersAlreadyRun || !triggersAlreadyRun[index]) { rc = runScript(triggeredH, root, 1, triggerProgs + index, triggerScripts[index], - matches.count + arg1correction, arg2, 0); + dbiIndexSetCount(matches) + arg1correction, arg2, 0); if (triggersAlreadyRun) triggersAlreadyRun[index] = 1; } @@ -724,12 +727,13 @@ int runTriggers(char * root, rpmdb db, int sense, Header h, return 0; rpmdbFindPackage(db, packageName, &otherMatches); - numPackage = otherMatches.count + countCorrection; + numPackage = dbiIndexSetCount(otherMatches) + countCorrection; dbiFreeIndexRecord(otherMatches); rc = 0; - for (i = 0; i < matches.count; i++) { - if ((triggeredH = rpmdbGetRecord(db, matches.recs[i].recOffset)) == NULL) + for (i = 0; i < dbiIndexSetCount(matches); i++) { + unsigned int recOffset = dbiIndexRecordOffset(matches, i); + if ((triggeredH = rpmdbGetRecord(db, recOffset)) == NULL) return 1; rc |= handleOneTrigger(root, db, sense, h, triggeredH, 0, numPackage, @@ -771,11 +775,12 @@ int runImmedTriggers(char * root, rpmdb db, int sense, Header h, continue; } - for (j = 0; j < matches.count; j++) { - if ((sourceH = rpmdbGetRecord(db, matches.recs[j].recOffset)) == NULL) + for (j = 0; j < dbiIndexSetCount(matches); j++) { + unsigned int recOffset = dbiIndexRecordOffset(matches, j); + if ((sourceH = rpmdbGetRecord(db, recOffset)) == NULL) return 1; rc |= handleOneTrigger(root, db, sense, sourceH, h, - countCorrection, matches.count, triggersRun); + countCorrection, dbiIndexSetCount(matches), triggersRun); headerFree(sourceH); if (triggersRun[triggerIndices[i]]) break; } diff --git a/po/rpm.pot b/po/rpm.pot index 86967ec48..653ac085e 100644 --- a/po/rpm.pot +++ b/po/rpm.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 1998-11-18 16:35-0500\n" +"POT-Creation-Date: 1998-11-19 13:03-0500\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" @@ -79,7 +79,7 @@ msgstr "" msgid "Couldn't write header/archive to temp file" msgstr "" -#: ../build/pack.c:334 ../checksig.c:87 +#: ../build/pack.c:344 ../checksig.c:87 #, c-format msgid "Generating signature: %d\n" msgstr "" @@ -168,7 +168,7 @@ msgstr "" msgid "error: cannot open file %s\n" msgstr "" -#: ../install.c:84 ../install.c:408 +#: ../install.c:84 ../install.c:409 #, c-format msgid "Installing %s\n" msgstr "" @@ -182,7 +182,7 @@ msgstr "" msgid "error: %s does not appear to be a RPM package\n" msgstr "" -#: ../install.c:107 ../install.c:203 ../install.c:412 +#: ../install.c:107 ../install.c:203 ../install.c:413 #, c-format msgid "error: %s cannot be installed\n" msgstr "" @@ -251,7 +251,7 @@ msgstr "" msgid "counting packages to uninstall\n" msgstr "" -#: ../install.c:322 ../lib/query.c:600 ../verify.c:253 +#: ../install.c:322 ../lib/query.c:601 ../verify.c:254 #, c-format msgid "package %s is not installed\n" msgstr "" @@ -266,31 +266,31 @@ msgstr "" msgid "\"%s\" specifies multiple packages\n" msgstr "" -#: ../install.c:355 +#: ../install.c:356 #, c-format msgid "found %d packages to uninstall\n" msgstr "" -#: ../install.c:370 +#: ../install.c:371 msgid "removing these packages would break dependencies:\n" msgstr "" -#: ../install.c:381 +#: ../install.c:382 #, c-format msgid "uninstalling record number %d\n" msgstr "" -#: ../install.c:403 +#: ../install.c:404 #, c-format msgid "error: cannot open %s\n" msgstr "" -#: ../install.c:451 +#: ../install.c:452 #, c-format msgid " is needed by %s-%s-%s\n" msgstr "" -#: ../install.c:454 +#: ../install.c:455 #, c-format msgid " conflicts with %s-%s-%s\n" msgstr "" @@ -1315,40 +1315,40 @@ msgstr "" msgid "Unsatisfied dependencies for %s-%s-%s: " msgstr "" -#: ../verify.c:133 +#: ../verify.c:134 #, c-format -msgid "verifying record number %d\n" +msgid "verifying record number %u\n" msgstr "" -#: ../lib/query.c:403 ../verify.c:138 +#: ../lib/query.c:404 ../verify.c:139 msgid "error: could not read database record\n" msgstr "" -#: ../lib/query.c:489 ../verify.c:177 +#: ../lib/query.c:490 ../verify.c:178 msgid "could not read database record!\n" msgstr "" -#: ../lib/query.c:440 ../lib/query.c:449 ../verify.c:196 ../verify.c:205 +#: ../lib/query.c:441 ../lib/query.c:450 ../verify.c:197 ../verify.c:206 #, c-format msgid "open of %s failed: %s\n" msgstr "" -#: ../verify.c:219 +#: ../verify.c:220 #, c-format msgid "%s is not an RPM\n" msgstr "" -#: ../lib/query.c:500 ../verify.c:228 +#: ../lib/query.c:501 ../verify.c:229 #, c-format msgid "group %s does not contain any packages\n" msgstr "" -#: ../lib/query.c:569 ../verify.c:242 +#: ../lib/query.c:570 ../verify.c:243 #, c-format msgid "file %s is not owned by any package\n" msgstr "" -#: ../lib/query.c:603 ../verify.c:255 +#: ../lib/query.c:604 ../verify.c:256 #, c-format msgid "error looking for package %s\n" msgstr "" @@ -1403,7 +1403,7 @@ msgstr "" msgid "no copyright!\n" msgstr "" -#: ../build/build.c:91 ../build/pack.c:252 +#: ../build/build.c:91 ../build/pack.c:262 msgid "Unable to open temp file" msgstr "" @@ -1573,7 +1573,7 @@ msgstr "" msgid "Could not open %%files file: %s" msgstr "" -#: ../build/files.c:1083 ../build/pack.c:441 +#: ../build/files.c:1083 ../build/pack.c:451 #, c-format msgid "line: %s" msgstr "" @@ -1649,101 +1649,101 @@ msgstr "" msgid "Could not canonicalize hostname: %s\n" msgstr "" -#: ../build/pack.c:140 +#: ../build/pack.c:150 #, c-format msgid "Could not generate output filename for package %s: %s\n" msgstr "" -#: ../build/pack.c:173 +#: ../build/pack.c:183 #, c-format msgid "readRPM: open %s: %s\n" msgstr "" -#: ../build/pack.c:182 +#: ../build/pack.c:192 #, c-format msgid "readRPM: read %s: %s\n" msgstr "" -#: ../build/pack.c:202 +#: ../build/pack.c:212 #, c-format msgid "readRPM: %s is not an RPM package\n" msgstr "" -#: ../build/pack.c:208 +#: ../build/pack.c:218 #, c-format msgid "readRPM: reading header from %s\n" msgstr "" -#: ../build/pack.c:263 +#: ../build/pack.c:273 msgid "Bad CSA data" msgstr "" -#: ../build/pack.c:286 +#: ../build/pack.c:296 #, c-format msgid "Could not open %s\n" msgstr "" -#: ../build/pack.c:318 ../build/pack.c:361 +#: ../build/pack.c:328 ../build/pack.c:371 #, c-format msgid "Unable to write package: %s" msgstr "" -#: ../build/pack.c:351 +#: ../build/pack.c:361 #, c-format msgid "Unable to read sigtarget: %s" msgstr "" -#: ../build/pack.c:376 +#: ../build/pack.c:386 #, c-format msgid "Wrote: %s\n" msgstr "" -#: ../build/pack.c:394 +#: ../build/pack.c:404 #, c-format msgid "cpio failed on file %s: %s" msgstr "" -#: ../build/pack.c:397 +#: ../build/pack.c:407 #, c-format msgid "cpio failed on file %s: %d" msgstr "" -#: ../build/pack.c:411 +#: ../build/pack.c:421 #, c-format msgid "cpio_copy write failed: %s" msgstr "" -#: ../build/pack.c:418 +#: ../build/pack.c:428 #, c-format msgid "cpio_copy read failed: %s" msgstr "" -#: ../build/pack.c:497 +#: ../build/pack.c:507 #, c-format msgid "Could not open PreIn file: %s" msgstr "" -#: ../build/pack.c:504 +#: ../build/pack.c:514 #, c-format msgid "Could not open PreUn file: %s" msgstr "" -#: ../build/pack.c:511 +#: ../build/pack.c:521 #, c-format msgid "Could not open PostIn file: %s" msgstr "" -#: ../build/pack.c:518 +#: ../build/pack.c:528 #, c-format msgid "Could not open PostUn file: %s" msgstr "" -#: ../build/pack.c:526 +#: ../build/pack.c:536 #, c-format msgid "Could not open VerifyScript file: %s" msgstr "" -#: ../build/pack.c:542 +#: ../build/pack.c:552 #, c-format msgid "Could not open Trigger script file: %s" msgstr "" @@ -2103,7 +2103,7 @@ msgstr "" msgid "error removing record %s into %s" msgstr "" -#: ../lib/depends.c:373 ../lib/depends.c:528 +#: ../lib/depends.c:373 ../lib/depends.c:532 #, c-format msgid "cannot read header at %d for dependency check" msgstr "" @@ -2113,21 +2113,21 @@ msgstr "" msgid "dependencies: looking for %s\n" msgstr "" -#: ../lib/depends.c:621 +#: ../lib/depends.c:625 #, c-format msgid "package %s require not satisfied: %s\n" msgstr "" -#: ../lib/depends.c:664 +#: ../lib/depends.c:668 #, c-format msgid "package %s conflicts: %s\n" msgstr "" -#: ../lib/depends.c:763 +#: ../lib/depends.c:767 msgid "dbrecMatchesDepFlags() failed to read header" msgstr "" -#: ../lib/depends.c:815 +#: ../lib/depends.c:819 #, c-format msgid "loop in prerequisite chain: %s" msgstr "" @@ -2285,7 +2285,7 @@ msgstr "" msgid "instchangelog value in rpmrc should be a number, but isn't" msgstr "" -#: ../lib/install.c:454 ../lib/install.c:734 +#: ../lib/install.c:454 ../lib/install.c:735 msgid "stopping install as we're running --test\n" msgstr "" @@ -2305,100 +2305,100 @@ msgid "package: %s-%s-%s files test = %d\n" msgstr "" #. no matches -#: ../lib/install.c:568 +#: ../lib/install.c:569 #, c-format msgid "package %s is now obsolete and will be removed\n" msgstr "" -#: ../lib/install.c:679 +#: ../lib/install.c:680 #, c-format msgid "file %s in netshared path\n" msgstr "" -#: ../lib/install.c:696 +#: ../lib/install.c:697 #, c-format msgid "%s exists - creating with alternate name\n" msgstr "" -#: ../lib/install.c:701 +#: ../lib/install.c:702 #, c-format msgid "%s exists - backing up\n" msgstr "" -#: ../lib/install.c:740 +#: ../lib/install.c:741 msgid "running preinstall script (if any)\n" msgstr "" -#: ../lib/install.c:771 +#: ../lib/install.c:772 #, c-format msgid "warning: %s created as %s" msgstr "" -#: ../lib/install.c:805 +#: ../lib/install.c:806 #, c-format msgid "warning: %s saved as %s" msgstr "" -#: ../lib/install.c:809 ../lib/install.c:1519 ../lib/uninstall.c:591 +#: ../lib/install.c:810 ../lib/install.c:1521 ../lib/uninstall.c:594 #, c-format msgid "rename of %s to %s failed: %s" msgstr "" -#: ../lib/install.c:910 +#: ../lib/install.c:911 msgid "running postinstall script (if any)\n" msgstr "" -#: ../lib/install.c:931 +#: ../lib/install.c:932 msgid "removing old versions of package\n" msgstr "" #. this would probably be a good place to check if disk space #. was used up - if so, we should return a different error -#: ../lib/install.c:1022 +#: ../lib/install.c:1023 #, c-format msgid "unpacking of archive failed on file %s: %d: %s" msgstr "" -#: ../lib/install.c:1060 +#: ../lib/install.c:1062 #, c-format msgid "package %s-%s-%s is already installed" msgstr "" -#: ../lib/install.c:1108 +#: ../lib/install.c:1110 #, c-format msgid "%s skipped due to missingok flag\n" msgstr "" -#: ../lib/install.c:1126 +#: ../lib/install.c:1128 msgid "\tfile type on disk is different then package - saving\n" msgstr "" -#: ../lib/install.c:1129 +#: ../lib/install.c:1131 msgid "" "\tfile type in database is different then disk and package file - saving\n" msgstr "" -#: ../lib/install.c:1133 +#: ../lib/install.c:1135 msgid "\tfile type changed - replacing\n" msgstr "" -#: ../lib/install.c:1137 +#: ../lib/install.c:1139 msgid "\tcan't check file for changes - replacing\n" msgstr "" #. assume the file has been removed, don't freak -#: ../lib/install.c:1149 ../lib/install.c:1159 +#: ../lib/install.c:1151 ../lib/install.c:1161 msgid "\tfile not present - creating" msgstr "" #. this config file has never been modified, so #. just replace it -#: ../lib/install.c:1172 +#: ../lib/install.c:1174 msgid "\told == current, replacing with new version\n" msgstr "" #. this file is the same in all versions of this package -#: ../lib/install.c:1179 +#: ../lib/install.c:1181 msgid "\told == new, keeping\n" msgstr "" @@ -2406,78 +2406,78 @@ msgstr "" #. the ones in the two packages are different. It would #. be nice if RPM was smart enough to at least try and #. merge the difference ala CVS, but... -#: ../lib/install.c:1187 +#: ../lib/install.c:1189 msgid "\tfiles changed too much - backing up\n" msgstr "" -#: ../lib/install.c:1249 ../lib/rpmdb.c:309 ../lib/uninstall.c:117 -#: ../lib/uninstall.c:217 +#: ../lib/install.c:1251 ../lib/rpmdb.c:308 ../lib/uninstall.c:118 +#: ../lib/uninstall.c:218 #, c-format msgid "cannot read header at %d for uninstall" msgstr "" -#: ../lib/install.c:1262 ../lib/uninstall.c:130 +#: ../lib/install.c:1264 ../lib/uninstall.c:131 #, c-format msgid "package %s-%s-%s contain shared files\n" msgstr "" -#: ../lib/install.c:1267 ../lib/uninstall.c:135 +#: ../lib/install.c:1269 ../lib/uninstall.c:136 #, c-format msgid "package %s contains no files" msgstr "" -#: ../lib/install.c:1289 ../lib/uninstall.c:158 +#: ../lib/install.c:1291 ../lib/uninstall.c:159 #, c-format msgid "file %s is shared\n" msgstr "" -#: ../lib/install.c:1305 +#: ../lib/install.c:1307 msgid "\told version already replaced\n" msgstr "" -#: ../lib/install.c:1308 +#: ../lib/install.c:1310 msgid "\tother version never installed\n" msgstr "" -#: ../lib/install.c:1316 +#: ../lib/install.c:1318 #, c-format msgid "%s conflicts with file from %s-%s-%s" msgstr "" -#: ../lib/install.c:1335 +#: ../lib/install.c:1337 #, c-format msgid "%s from %s-%s-%s will be replaced\n" msgstr "" -#: ../lib/install.c:1399 +#: ../lib/install.c:1401 msgid "installing a source package\n" msgstr "" -#: ../lib/install.c:1415 ../lib/install.c:1420 +#: ../lib/install.c:1417 ../lib/install.c:1422 #, c-format msgid "cannot write to %s" msgstr "" -#: ../lib/install.c:1424 +#: ../lib/install.c:1426 #, c-format msgid "sources in: %s\n" msgstr "" -#: ../lib/install.c:1425 +#: ../lib/install.c:1427 #, c-format msgid "spec file in: %s\n" msgstr "" -#: ../lib/install.c:1458 ../lib/install.c:1497 +#: ../lib/install.c:1460 ../lib/install.c:1499 msgid "source package contains no .spec file" msgstr "" -#: ../lib/install.c:1517 +#: ../lib/install.c:1519 #, c-format msgid "renaming %s to %s\n" msgstr "" -#: ../lib/install.c:1633 +#: ../lib/install.c:1635 #, c-format msgid "package %s-%s-%s (which is newer) is already installed" msgstr "" @@ -2653,60 +2653,60 @@ msgstr "" msgid "package has neither file owner or id lists" msgstr "" -#: ../lib/query.c:398 +#: ../lib/query.c:399 #, c-format msgid "querying record number %d\n" msgstr "" -#: ../lib/query.c:465 +#: ../lib/query.c:466 msgid "old format source packages cannot be queried\n" msgstr "" -#: ../lib/query.c:474 +#: ../lib/query.c:475 #, c-format msgid "%s does not appear to be a RPM package\n" msgstr "" -#: ../lib/query.c:478 +#: ../lib/query.c:479 #, c-format msgid "query of %s failed\n" msgstr "" -#: ../lib/query.c:510 +#: ../lib/query.c:511 #, c-format msgid "no package provides %s\n" msgstr "" -#: ../lib/query.c:520 +#: ../lib/query.c:521 #, c-format msgid "no package triggers %s\n" msgstr "" -#: ../lib/query.c:530 +#: ../lib/query.c:531 #, c-format msgid "no package requires %s\n" msgstr "" -#: ../lib/query.c:548 ../lib/query.c:554 +#: ../lib/query.c:549 ../lib/query.c:555 msgid "maximum path length exceeded\n" msgstr "" -#: ../lib/query.c:566 +#: ../lib/query.c:567 #, c-format msgid "file %s: %s\n" msgstr "" -#: ../lib/query.c:582 +#: ../lib/query.c:583 #, c-format msgid "invalid package number: %s\n" msgstr "" -#: ../lib/query.c:585 +#: ../lib/query.c:586 #, c-format msgid "showing package: %d\n" msgstr "" -#: ../lib/query.c:588 +#: ../lib/query.c:589 #, c-format msgid "record %d could not be read\n" msgstr "" @@ -2716,7 +2716,7 @@ msgstr "" msgid "rebuilding database in rootdir %s\n" msgstr "" -#: ../lib/rebuilddb.c:18 ../lib/rpmdb.c:44 ../lib/rpmdb.c:57 +#: ../lib/rebuilddb.c:18 ../lib/rpmdb.c:43 ../lib/rpmdb.c:56 msgid "no dbpath has been set" msgstr "" @@ -2771,76 +2771,76 @@ msgstr "" msgid "failed to remove %s: %s\n" msgstr "" -#: ../lib/rpmdb.c:112 +#: ../lib/rpmdb.c:111 #, c-format msgid "opening database in %s\n" msgstr "" -#: ../lib/rpmdb.c:121 +#: ../lib/rpmdb.c:120 #, c-format msgid "failed to open %s\n" msgstr "" -#: ../lib/rpmdb.c:134 ../lib/rpmdb.c:141 +#: ../lib/rpmdb.c:133 ../lib/rpmdb.c:140 #, c-format msgid "cannot get %s lock on database" msgstr "" -#: ../lib/rpmdb.c:135 +#: ../lib/rpmdb.c:134 msgid "exclusive" msgstr "" -#: ../lib/rpmdb.c:142 +#: ../lib/rpmdb.c:141 msgid "shared" msgstr "" -#: ../lib/rpmdb.c:275 +#: ../lib/rpmdb.c:274 #, c-format msgid "package %s not listed in %s" msgstr "" -#: ../lib/rpmdb.c:286 +#: ../lib/rpmdb.c:285 #, c-format msgid "package %s not found in %s" msgstr "" -#: ../lib/rpmdb.c:317 +#: ../lib/rpmdb.c:316 msgid "package has no name" msgstr "" -#: ../lib/rpmdb.c:319 +#: ../lib/rpmdb.c:318 msgid "removing name index\n" msgstr "" -#: ../lib/rpmdb.c:324 +#: ../lib/rpmdb.c:323 msgid "package has no group\n" msgstr "" -#: ../lib/rpmdb.c:326 +#: ../lib/rpmdb.c:325 msgid "removing group index\n" msgstr "" -#: ../lib/rpmdb.c:333 +#: ../lib/rpmdb.c:332 #, c-format msgid "removing provides index for %s\n" msgstr "" -#: ../lib/rpmdb.c:348 +#: ../lib/rpmdb.c:347 #, c-format msgid "removing requiredby index for %s\n" msgstr "" -#: ../lib/rpmdb.c:360 +#: ../lib/rpmdb.c:359 #, c-format msgid "removing trigger index for %s\n" msgstr "" -#: ../lib/rpmdb.c:371 +#: ../lib/rpmdb.c:370 #, c-format msgid "removing conflict index for %s\n" msgstr "" -#: ../lib/rpmdb.c:382 +#: ../lib/rpmdb.c:381 #, c-format msgid "removing file index for %s\n" msgstr "" @@ -2849,16 +2849,16 @@ msgstr "" msgid "package has no files\n" msgstr "" -#: ../lib/rpmdb.c:462 +#: ../lib/rpmdb.c:458 msgid "cannot allocate space for database" msgstr "" -#: ../lib/rpmdb.c:526 +#: ../lib/rpmdb.c:525 #, c-format msgid "cannot read header at %d for update" msgstr "" -#: ../lib/rpmdb.c:535 +#: ../lib/rpmdb.c:534 msgid "header changed size!" msgstr "" @@ -3045,102 +3045,102 @@ msgstr "" #. This shouldn't happen, but some versions of RPM didn't #. implement --justdb properly, and chose to leave this stuff #. out. -#: ../lib/uninstall.c:148 ../lib/uninstall.c:278 +#: ../lib/uninstall.c:149 ../lib/uninstall.c:279 msgid "package is missing FILESTATES\n" msgstr "" -#: ../lib/uninstall.c:163 +#: ../lib/uninstall.c:164 msgid " file has already been replaced\n" msgstr "" -#: ../lib/uninstall.c:167 +#: ../lib/uninstall.c:168 msgid " file was never installed\n" msgstr "" -#: ../lib/uninstall.c:171 +#: ../lib/uninstall.c:172 msgid " file is netshared (so don't touch it)\n" msgstr "" -#: ../lib/uninstall.c:178 +#: ../lib/uninstall.c:179 msgid " file is truely shared - saving\n" msgstr "" -#: ../lib/uninstall.c:228 +#: ../lib/uninstall.c:229 #, c-format msgid "cannot read packages named %s for uninstall" msgstr "" -#: ../lib/uninstall.c:256 +#: ../lib/uninstall.c:257 #, c-format msgid "will remove files test = %d\n" msgstr "" -#: ../lib/uninstall.c:304 +#: ../lib/uninstall.c:305 #, c-format msgid "%s has a netshared override\n" msgstr "" -#: ../lib/uninstall.c:342 +#: ../lib/uninstall.c:343 msgid "running postuninstall script (if any)\n" msgstr "" -#: ../lib/uninstall.c:356 +#: ../lib/uninstall.c:357 msgid "removing database entry\n" msgstr "" -#: ../lib/uninstall.c:505 +#: ../lib/uninstall.c:508 msgid "execution of script failed" msgstr "" -#: ../lib/uninstall.c:550 +#: ../lib/uninstall.c:553 #, c-format msgid "%s has already been replaced\n" msgstr "" #. if it's a config file, we may not want to remove it -#: ../lib/uninstall.c:557 +#: ../lib/uninstall.c:560 #, c-format msgid "finding md5sum of %s\n" msgstr "" -#: ../lib/uninstall.c:566 +#: ../lib/uninstall.c:569 msgid " failed - assuming file removed\n" msgstr "" -#: ../lib/uninstall.c:569 +#: ../lib/uninstall.c:572 msgid " file changed - will save\n" msgstr "" -#: ../lib/uninstall.c:573 +#: ../lib/uninstall.c:576 msgid " file unchanged - will remove\n" msgstr "" -#: ../lib/uninstall.c:581 +#: ../lib/uninstall.c:584 #, c-format msgid "keeping %s\n" msgstr "" -#: ../lib/uninstall.c:585 +#: ../lib/uninstall.c:588 #, c-format msgid "saving %s as %s.rpmsave\n" msgstr "" -#: ../lib/uninstall.c:599 +#: ../lib/uninstall.c:602 #, c-format msgid "%s - removing\n" msgstr "" -#: ../lib/uninstall.c:605 +#: ../lib/uninstall.c:608 #, c-format msgid "cannot remove %s - directory not empty" msgstr "" -#: ../lib/uninstall.c:608 +#: ../lib/uninstall.c:611 #, c-format msgid "rmdir of %s failed: %s" msgstr "" -#: ../lib/uninstall.c:618 +#: ../lib/uninstall.c:621 #, c-format msgid "removal of %s failed: %s" msgstr "" @@ -1097,14 +1097,14 @@ int main(int argc, char ** argv) { if (!(pipeChild = fork())) { close(p[1]); - dup2(p[0], 0); + dup2(p[0], STDIN_FILENO); close(p[0]); execl("/bin/sh", "/bin/sh", "-c", pipeOutput, NULL); fprintf(stderr, _("exec failed\n")); } close(p[0]); - dup2(p[1], 1); + dup2(p[1], STDOUT_FILENO); close(p[1]); } diff --git a/rpm2cpio.c b/rpm2cpio.c index 7292bcc6c..abe8ad70d 100644 --- a/rpm2cpio.c +++ b/rpm2cpio.c @@ -23,7 +23,7 @@ int main(int argc, char **argv) gzFile stream; if (argc == 1) { - fdi = fdDup(0); + fdi = fdDup(STDIN_FILENO); } else { fdi = fdOpen(argv[1], O_RDONLY, 0644); } @@ -32,7 +32,7 @@ int main(int argc, char **argv) perror("cannot open package"); exit(1); } - fdo = fdDup(1); + fdo = fdDup(STDOUT_FILENO); rc = rpmReadPackageHeader(fdi, &hd, &isSource, NULL, NULL); if (rc == 1) { diff --git a/tests/Makefile.am b/tests/Makefile.am index 166c28e0d..a4c7b0520 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -8,7 +8,9 @@ check-recursive: ./usr/ ./bin ./var ./usr ./bin ./var: ../rpm make -C .. DESTDIR=`pwd` install cp rpmrc macros ./$(pkglibdir) + rm -f ./@GZIPBIN@ ln -s @GZIPBIN@ ./@GZIPBIN@ + rm -f ./@BZIP2BIN@ ln -s @BZIP2BIN@ ./@BZIP2BIN@ clean-local: diff --git a/tests/Makefile.in b/tests/Makefile.in index 3f3ba1325..eeb945561 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -305,7 +305,9 @@ check-recursive: ./usr/ ./bin ./var ./usr ./bin ./var: ../rpm make -C .. DESTDIR=`pwd` install cp rpmrc macros ./$(pkglibdir) + rm -f ./@GZIPBIN@ ln -s @GZIPBIN@ ./@GZIPBIN@ + rm -f ./@BZIP2BIN@ ln -s @BZIP2BIN@ ./@BZIP2BIN@ clean-local: diff --git a/tests/hello-test/ckH.exp b/tests/hello-test/ckH.exp index b37d7542e..4baa67706 100644 --- a/tests/hello-test/ckH.exp +++ b/tests/hello-test/ckH.exp @@ -1,4 +1,4 @@ -Entry count: 52 +Entry count: 53 CT TAG TYPE OFSET COUNT Entry : 000 (100)(unknown) STRING_ARRAY_TYPE 0xffffffff 00000001 @@ -16,11 +16,11 @@ Entry : 005 (1004)RPMTAG_SUMMARY I18N_STRING_TYPE 0xffffffff 00000001 Entry : 006 (1005)RPMTAG_DESCRIPTION I18N_STRING_TYPE 0xffffffff 00000001 Data: 000 Simple rpm demonstration. Entry : 007 (1006)RPMTAG_BUILDTIME INT32_TYPE 0xffffffff 00000001 - Data: 000 0x362cd576 (908907894) + Data: 000 0x36545684 (911496836) Entry : 008 (1007)RPMTAG_BUILDHOST STRING_TYPE 0xffffffff 00000001 Data: 000 krusty.devel.redhat.com Entry : 009 (1009)RPMTAG_SIZE INT32_TYPE 0xffffffff 00000001 - Data: 000 0x00007c67 (31847) + Data: 000 0x000099a8 (39336) Entry : 010 (1010)RPMTAG_DISTRIBUTION STRING_TYPE 0xffffffff 00000001 Data: 000 RPM test suite. Entry : 011 (1011)RPMTAG_VENDOR STRING_TYPE 0xffffffff 00000001 @@ -44,7 +44,7 @@ Entry : 018 (1027)RPMTAG_FILENAMES STRING_ARRAY_TYPE 0xffffffff 00000003 Entry : 019 (1028)RPMTAG_FILESIZES INT32_TYPE 0xffffffff 00000003 Data: 000 0x00000400 (1024) Data: 001 0x00000024 (36) - Data: 002 0x00007843 (30787) + Data: 002 0x00009584 (38276) Entry : 020 (1030)RPMTAG_FILEMODES INT16_TYPE 0xffffffff 00000003 Data: 000 0x41ed (16877) Data: 001 0xffff81a4 (-32348) @@ -54,13 +54,13 @@ Entry : 021 (1033)RPMTAG_FILERDEVS INT16_TYPE 0xffffffff 00000003 Data: 001 0x0000 (0) Data: 002 0x0000 (0) Entry : 022 (1034)RPMTAG_FILEMTIMES INT32_TYPE 0xffffffff 00000003 - Data: 000 0x362cd571 (908907889) + Data: 000 0x3654567f (911496831) Data: 001 0x362ca336 (908895030) - Data: 002 0x362cd571 (908907889) + Data: 002 0x3654567f (911496831) Entry : 023 (1035)RPMTAG_FILEMD5S STRING_ARRAY_TYPE 0xffffffff 00000003 Data: 000 Data: 001 33cccc1f055d73acaceed7d8204e99c7 - Data: 002 741e702cdf114c95a9e965fa8aa40864 + Data: 002 dbf1372435b9a3d68d4f650b687f2081 Entry : 024 (1036)RPMTAG_FILELINKTOS STRING_ARRAY_TYPE 0xffffffff 00000003 Data: 000 Data: 001 @@ -84,7 +84,7 @@ Entry : 029 (1045)RPMTAG_FILEVERIFYFLAGS INT32_TYPE 0xffffffff 0000 Data: 001 0x00000000 (0) Data: 002 0xffffffff (-1) Entry : 030 (1046)RPMTAG_ARCHIVESIZE INT32_TYPE 0xffffffff 00000001 - Data: 000 0x00007aac (31404) + Data: 000 0x000097ec (38892) Entry : 031 (1047)RPMTAG_PROVIDES STRING_ARRAY_TYPE 0xffffffff 00000001 Data: 000 hi Entry : 032 (1048)RPMTAG_REQUIREFLAGS INT32_TYPE 0xffffffff 00000003 @@ -106,7 +106,7 @@ Entry : 036 (1054)RPMTAG_CONFLICTNAME STRING_ARRAY_TYPE 0xffffffff 0000000 Entry : 037 (1055)RPMTAG_CONFLICTVERSION STRING_ARRAY_TYPE 0xffffffff 00000001 Data: 000 Entry : 038 (1064)RPMTAG_RPMVERSION STRING_TYPE 0xffffffff 00000001 - Data: 000 2.90 + Data: 000 2.5.6 Entry : 039 (1080)RPMTAG_CHANGELOGTIME INT32_TYPE 0xffffffff 00000001 Data: 000 0x362cf9d0 (908917200) Entry : 040 (1081)RPMTAG_CHANGELOGNAME STRING_ARRAY_TYPE 0xffffffff 00000001 @@ -124,18 +124,20 @@ Entry : 045 (1088)RPMTAG_POSTUNPROG STRING_TYPE 0xffffffff 00000001 Entry : 046 (1090)RPMTAG_OBSOLETES STRING_ARRAY_TYPE 0xffffffff 00000001 Data: 000 howdy Entry : 047 (1094)RPMTAG_COOKIE STRING_TYPE 0xffffffff 00000001 - Data: 000 krusty.devel.redhat.com 908907894 + Data: 000 krusty.devel.redhat.com 911496836 Entry : 048 (1095)RPMTAG_FILEDEVICES INT32_TYPE 0xffffffff 00000003 Data: 000 0x00000804 (2052) Data: 001 0x00000804 (2052) Data: 002 0x00000804 (2052) Entry : 049 (1096)RPMTAG_FILEINODES INT32_TYPE 0xffffffff 00000003 - Data: 000 0x000194d7 (103639) - Data: 001 0x000194d8 (103640) - Data: 002 0x00010de9 (69097) + Data: 000 0x0001b49e (111774) + Data: 001 0x0001b49f (111775) + Data: 002 0x0001a4e3 (107747) Entry : 050 (1097)RPMTAG_FILELANGS STRING_ARRAY_TYPE 0xffffffff 00000003 Data: 000 Data: 001 Data: 002 Entry : 051 (1098)RPMTAG_PREFIXES STRING_ARRAY_TYPE 0xffffffff 00000001 Data: 000 /usr +Entry : 052 (1105)RPMTAG_CAPABILITY INT32_TYPE 0xffffffff 00000001 + Data: 000 0x00000000 (0) diff --git a/tests/hello-test/ckS.exp b/tests/hello-test/ckS.exp index e90798c94..f55a05433 100644 --- a/tests/hello-test/ckS.exp +++ b/tests/hello-test/ckS.exp @@ -2,7 +2,7 @@ Entry count: 2 CT TAG TYPE OFSET COUNT Entry : 000 (1000)RPMTAG_NAME INT32_TYPE 0xffffffff 00000001 - Data: 000 0x00003178 (12664) + Data: 000 0x000041c3 (16835) Entry : 001 (1004)RPMTAG_SUMMARY BIN_TYPE 0xffffffff 00000016 - Data: 000 4f a6 f0 cc 7c b3 27 61 - Data: 008 09 35 67 1d e1 77 8b 68 + Data: 000 15 ffffffb1 ffffffad ffffffc7 03 ffffffb6 53 33 + Data: 008 27 52 52 ffffffad fffffff7 1f ffffffb2 25 diff --git a/tests/hello-test/e.exp b/tests/hello-test/e.exp index 89f331cc9..6bbc5b64c 100644 --- a/tests/hello-test/e.exp +++ b/tests/hello-test/e.exp @@ -1,7 +1,7 @@ D: counting packages to uninstall D: opening database in //var/lib/rpm/ D: found 1 packages to uninstall -D: uninstalling record number 1752 +D: uninstalling record number 24 D: will remove files test = 0 D: /hello-test/../usr/local/bin/hello - removing D: /usr/doc/hello-1.0/FAQ - removing diff --git a/tests/hello-test/i b/tests/hello-test/i index 943c221ff..cd810ceeb 100755 --- a/tests/hello-test/i +++ b/tests/hello-test/i @@ -4,6 +4,7 @@ rpm=${rpm:=rpm} destdir="`pwd`" destdir="`dirname $destdir`" +rm -rf $destdir/var/lib/rpm/* $rpm -i -vv --nodeps --prefix="`pwd`/../usr" $myrpm | \ sed -e "s,$destdir,,g" > $0.out diff --git a/tests/hello-test/i.exp b/tests/hello-test/i.exp index 0ff27b996..1760e6e0f 100644 --- a/tests/hello-test/i.exp +++ b/tests/hello-test/i.exp @@ -7,8 +7,8 @@ D: New Header signature D: Signature size: 68 D: Signature pad : 4 D: sigsize : 72 -D: Header + Archive: 13492 -D: expected size : 13492 +D: Header + Archive: 16835 +D: expected size : 16835 D: found 0 source and 1 binary packages D: opening database mode: 01002 D: opening database in //var/lib/rpm/ @@ -18,8 +18,8 @@ D: New Header signature D: Signature size: 68 D: Signature pad : 4 D: sigsize : 72 -D: Header + Archive: 13492 -D: expected size : 13492 +D: Header + Archive: 16835 +D: expected size : 16835 D: package: hello-1.0-1 files test = 0 D: relocating /usr/local/bin/hello to /hello-test/../usr/local/bin/hello D: running preinstall script (if any) diff --git a/tests/hello-test/qi.exp b/tests/hello-test/qi.exp index c3800a07f..5da1a8652 100644 --- a/tests/hello-test/qi.exp +++ b/tests/hello-test/qi.exp @@ -1,9 +1,9 @@ Name : hello Distribution: RPM test suite. Version : 1.0 Vendor: Red Hat Software -Release : 1 Build Date: Tue Oct 20 14:21:44 1998 -Install date: Tue Oct 20 14:21:47 1998 Build Host: krusty.devel.redhat.com +Release : 1 Build Date: Thu Nov 19 12:33:56 1998 +Install date: Thu Nov 19 12:34:00 1998 Build Host: krusty.devel.redhat.com Group : Utilities Source RPM: hello-1.0-1.src.rpm -Size : 31847 License: GPL +Size : 39336 License: GPL Packager : Red Hat Software <bugs@redhat.com> URL : http://www.redhat.com Summary : hello -- hello, world rpm diff --git a/tests/hello-test/showrc.exp b/tests/hello-test/showrc.exp index db538f8ee..b4429d6b9 100644 --- a/tests/hello-test/showrc.exp +++ b/tests/hello-test/showrc.exp @@ -1,29 +1,44 @@ ARCHITECTURE AND OS: -build arch : i386 -compatible build archs: i386 noarch +build arch : sparc +compatible build archs: sparc noarch build os : Linux -compatible build os's : linux -install arch : i386 +compatible build os's : Linux +install arch : sparc install os : Linux -compatible archs : i386 noarch -compatible os's : linux - +compatible archs : sparc noarch +compatible os's : Linux RPMRC VALUES: builddir : /usr/src/redhat/BUILD +buildroot : (not set) buildshell : /bin/sh bzip2bin : /usr/bin/bzip2 dbpath : /var/lib/rpm defaultdocdir : /usr/doc +distribution : (not set) +excludedocs : (not set) fixperms : a+rX,g-w,o-w +ftpport : (not set) +ftpproxy : (not set) gzipbin : /bin/gzip instchangelog : 5 -macrofiles : /usr/lib/rpm/macros -optflags : -O2 -m486 -fno-strength-reduce +langpatt : (not set) +messagelevel : (not set) +netsharedpath : (not set) +optflags : -O2 +packager : (not set) +pgp_name : (not set) +pgp_path : (not set) +provides : (not set) +require_distribution : (not set) +require_icon : (not set) +require_vendor : (not set) rpmdir : /usr/src/redhat/RPMS rpmfilename : %{ARCH}/%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}.rpm signature : none sourcedir : /usr/src/redhat/SOURCES specdir : /usr/src/redhat/SPECS srcrpmdir : /usr/src/redhat/SRPMS +timecheck : (not set) tmppath : /var/tmp topdir : /usr/src/redhat +vendor : (not set) diff --git a/tests/hello-test/test0.exp b/tests/hello-test/test0.exp index 45b5ea403..f649abe2b 100644 --- a/tests/hello-test/test0.exp +++ b/tests/hello-test/test0.exp @@ -27,8 +27,19 @@ Executing: %install install -m 0755 hello /var/tmp/hello-root/usr/local/bin + exit 0 Processing files: hello +Executing: %doc ++ umask 022 ++ cd /usr/src/redhat/BUILD ++ cd hello-1.0 ++ DOCDIR=/var/tmp/hello-root/usr/doc/hello-1.0 ++ export DOCDIR ++ rm -rf /var/tmp/hello-root/usr/doc/hello-1.0 ++ /bin/mkdir -p /var/tmp/hello-root/usr/doc/hello-1.0 ++ cp -pr FAQ /var/tmp/hello-root/usr/doc/hello-1.0 ++ exit 0 Finding provides... Finding requires... +Prereqs: /bin/sh Requires: ld-linux.so.2 libc.so.6 Wrote: /usr/src/redhat/SRPMS/hello-1.0-1.src.rpm Wrote: /usr/src/redhat/RPMS/sparc/hello-1.0-1.sparc.rpm diff --git a/tools/dump.c b/tools/dump.c index 6637c9c4e..becec45e7 100644 --- a/tools/dump.c +++ b/tools/dump.c @@ -5,10 +5,10 @@ int main(int argc, char ** argv) { Header h; - FD_t fdi, fdo; + FD_t fdi; if (argc == 1) { - fdi = fdDup(0); + fdi = fdDup(STDIN_FILENO); } else { fdi = fdOpen(argv[1], O_RDONLY, 0644); } @@ -25,8 +25,7 @@ int main(int argc, char ** argv) } fdClose(fdi); - fdo = fdDup(1); - headerDump(h, stdout, fdo, rpmTagTable); + headerDump(h, stdout, HEADER_DUMP_INLINE, rpmTagTable); headerFree(h); return 0; diff --git a/tools/rpmarchive.c b/tools/rpmarchive.c index 27a74103b..99f8b08c3 100644 --- a/tools/rpmarchive.c +++ b/tools/rpmarchive.c @@ -15,7 +15,7 @@ int main(int argc, char **argv) int ct; if (argc == 1) { - fdi = fdDup(0); + fdi = fdDup(STDIN_FILENO); } else { fdi = fdOpen(argv[1], O_RDONLY, 0644); } @@ -25,7 +25,7 @@ int main(int argc, char **argv) hd = headerRead(fdi, (lead.major >= 3) ? HEADER_MAGIC_YES : HEADER_MAGIC_NO); - fdo = fdDup(1); + fdo = fdDup(STDOUT_FILENO); while ((ct = fdRead(fdi, &buffer, 1024))) { fdWrite(fdo, &buffer, ct); } diff --git a/tools/rpmgettext.c b/tools/rpmgettext.c index f7767b0ba..41698a112 100644 --- a/tools/rpmgettext.c +++ b/tools/rpmgettext.c @@ -988,7 +988,7 @@ main(int argc, char **argv) /* XXX I don't want to read rpmrc yet */ rpmSetVar(RPMVAR_TMPPATH, "/tmp"); - fdi = fdDup(0); + fdi = fdDup(STDIN_FILENO); if (!strcmp(program_name, RPMGETTEXT)) { if (optind == argc) { diff --git a/tools/rpmheader.c b/tools/rpmheader.c index c528ea842..dd3644246 100644 --- a/tools/rpmheader.c +++ b/tools/rpmheader.c @@ -13,7 +13,7 @@ int main(int argc, char **argv) Header hd; if (argc == 1) { - fdi = fdDup(0); + fdi = fdDup(STDIN_FILENO); } else { fdi = fdOpen(argv[1], O_RDONLY, 0644); } @@ -22,7 +22,7 @@ int main(int argc, char **argv) rpmReadSignature(fdi, NULL, lead.signature_type); hd = headerRead(fdi, (lead.major >= 3) ? HEADER_MAGIC_YES : HEADER_MAGIC_NO); - fdo = fdDup(1); + fdo = fdDup(STDOUT_FILENO); headerWrite(fdo, hd, HEADER_MAGIC_YES); return 0; diff --git a/tools/rpmlead.c b/tools/rpmlead.c index febe877c9..b459adbac 100644 --- a/tools/rpmlead.c +++ b/tools/rpmlead.c @@ -11,13 +11,13 @@ int main(int argc, char **argv) struct rpmlead lead; if (argc == 1) { - fdi = fdDup(0); + fdi = fdDup(STDIN_FILENO); } else { fdi = fdOpen(argv[1], O_RDONLY, 0644); } readLead(fdi, &lead); - fdo = fdDup(1); + fdo = fdDup(STDOUT_FILENO); writeLead(fdo, &lead); return 0; diff --git a/tools/rpmsignature.c b/tools/rpmsignature.c index 56d410c6a..6ff275f32 100644 --- a/tools/rpmsignature.c +++ b/tools/rpmsignature.c @@ -12,7 +12,7 @@ int main(int argc, char **argv) Header sig; if (argc == 1) { - fdi = fdDup(0); + fdi = fdDup(STDIN_FILENO); } else { fdi = fdOpen(argv[1], O_RDONLY, 0644); } @@ -24,7 +24,7 @@ int main(int argc, char **argv) fprintf(stderr, _("No signature available.\n")); break; default: - fdo = fdDup(1); + fdo = fdDup(STDOUT_FILENO); rpmWriteSignature(fdo, sig); } @@ -113,7 +113,7 @@ static int verifyPackage(char * root, rpmdb db, Header h, int verifyFlags) { if ((verifyFlags & VERIFY_FILES) && (rc = verifyHeader(root, h, verifyFlags)) != 0) ec = rc;; - fdo = fdDup(1); + fdo = fdDup(STDOUT_FILENO); if ((verifyFlags & VERIFY_SCRIPT) && (rc = rpmVerifyScript(root, h, fdo)) != 0) ec = rc; @@ -127,13 +127,14 @@ static int verifyMatches(char * prefix, rpmdb db, dbiIndexSet matches, Header h; ec = 0; - for (i = 0; i < matches.count; i++) { - if (matches.recs[i].recOffset == 0) + for (i = 0; i < dbiIndexSetCount(matches); i++) { + unsigned int recOffset = dbiIndexRecordOffset(matches, i); + if (recOffset == 0) continue; - rpmMessage(RPMMESS_DEBUG, _("verifying record number %d\n"), - matches.recs[i].recOffset); + rpmMessage(RPMMESS_DEBUG, _("verifying record number %u\n"), + recOffset); - h = rpmdbGetRecord(db, matches.recs[i].recOffset); + h = rpmdbGetRecord(db, recOffset); if (h == NULL) { fprintf(stderr, _("error: could not read database record\n")); ec = 1; @@ -199,7 +200,7 @@ int doVerify(char * prefix, enum verifysources source, char ** argv, fd = fdDup(fdno); close(fdno); } else if (!strcmp(arg, "-")) { - fd = fdDup(0); + fd = fdDup(STDIN_FILENO); } else { if (fdFileno(fd = fdOpen(arg, O_RDONLY, 0)) < 0) { fprintf(stderr, _("open of %s failed: %s\n"), arg, |