summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES3
-rw-r--r--lib/fsm.c11
-rw-r--r--lib/poptQV.c16
-rw-r--r--lib/query.c16
-rw-r--r--lib/rpmcli.h1
-rw-r--r--lib/rpmlib.h2
-rw-r--r--lib/verify.c6
-rw-r--r--rpm.spec.in2
-rwxr-xr-xrpmqv.c1
9 files changed, 53 insertions, 5 deletions
diff --git a/CHANGES b/CHANGES
index e039833e3..6d70458ca 100644
--- a/CHANGES
+++ b/CHANGES
@@ -125,6 +125,9 @@
- fix: partial sets of hardlinked files permitted in payload.
- fix: mark rpmdb files with %config to prevent erasure on downgrade.
- work around a (possible) compiler problem on ia64.
+ - fix: rpm -qlv link count for directories dinna include '..'.
+ - fix: rpm -qlv size for directories should be zero.
+ - add --noghost to filter non-payload files from rpm -qlv output.
4.0 -> 4.0.[12]
- add doxygen and lclint annotations most everywhere.
diff --git a/lib/fsm.c b/lib/fsm.c
index 8363ae478..7a2fe4ea0 100644
--- a/lib/fsm.c
+++ b/lib/fsm.c
@@ -571,6 +571,7 @@ assert(fi->type == TR_ADDED);
break;
case FA_BACKUP:
+ if (!(fsm->fflags & RPMFILE_GHOST)) /* XXX Don't if %ghost file. */
switch (fi->type) {
case TR_ADDED:
fsm->osuffix = SUFFIX_RPMORIG;
@@ -583,15 +584,21 @@ assert(fi->type == TR_ADDED);
case FA_ALTNAME:
assert(fi->type == TR_ADDED);
- fsm->nsuffix = SUFFIX_RPMNEW;
+ if (!(fsm->fflags & RPMFILE_GHOST)) /* XXX Don't if %ghost file. */
+ fsm->nsuffix = SUFFIX_RPMNEW;
break;
case FA_SAVE:
assert(fi->type == TR_ADDED);
- fsm->osuffix = SUFFIX_RPMSAVE;
+ if (!(fsm->fflags & RPMFILE_GHOST)) /* XXX Don't if %ghost file. */
+ fsm->osuffix = SUFFIX_RPMSAVE;
break;
case FA_ERASE:
assert(fi->type == TR_REMOVED);
+ /*
+ * XXX TODO: %ghost probably shouldn't be removed, but that changes
+ * legacy rpm behavior.
+ */
break;
default:
break;
diff --git a/lib/poptQV.c b/lib/poptQV.c
index 704555764..7c889ac9d 100644
--- a/lib/poptQV.c
+++ b/lib/poptQV.c
@@ -150,6 +150,20 @@ struct poptOption rpmQueryPoptTable[] = {
N_("dump basic file information"), NULL },
{ "list", 'l', 0, 0, 'l',
N_("list files in package"), NULL },
+
+ /* Duplicate file attr flags from packages into command line options. */
+ { "noghost", '\0', POPT_BIT_CLR|POPT_ARGFLAG_DOC_HIDDEN,
+ &rpmQVArgs.qva_fflags, RPMFILE_GHOST,
+ N_("skip %%ghost files"), NULL },
+#ifdef NOTEVER /* XXX there's hardly a need for these */
+ { "nolicense", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
+ &rpmQVArgs.qva_fflags, RPMFILE_LICENSE,
+ N_("skip %%license files"), NULL },
+ { "noreadme", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
+ &rpmQVArgs.qva_fflags, RPMFILE_README,
+ N_("skip %%readme files"), NULL },
+#endif
+
{ "qf", '\0', POPT_ARG_STRING | POPT_ARGFLAG_DOC_HIDDEN, 0,
POPT_QUERYFORMAT, NULL, NULL },
{ "queryformat", '\0', POPT_ARG_STRING, 0, POPT_QUERYFORMAT,
@@ -174,6 +188,7 @@ struct poptOption rpmVerifyPoptTable[] = {
{ NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmQVSourcePoptTable, 0,
NULL, NULL },
+ /* Duplicate file verify flags from packages into command line options. */
{ "nomd5", '\0', POPT_BIT_SET, &rpmQVArgs.qva_flags, VERIFY_MD5,
N_("don't verify MD5 digest of files"), NULL },
{ "nosize", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
@@ -204,6 +219,7 @@ struct poptOption rpmVerifyPoptTable[] = {
N_("don't verify package dependencies"), NULL },
{ "noscript", '\0', POPT_BIT_SET,&rpmQVArgs.qva_flags, VERIFY_SCRIPT,
N_("don't execute %verifyscript (if any)"), NULL },
+ /* XXX legacy had a trailing s on --noscript */
{ "noscripts", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
&rpmQVArgs.qva_flags, VERIFY_SCRIPT,
N_("don't execute %verifyscript (if any)"), NULL },
diff --git a/lib/query.c b/lib/query.c
index c25d37a1c..32c613f8e 100644
--- a/lib/query.c
+++ b/lib/query.c
@@ -246,6 +246,11 @@ int showQueryPackage(QVA_t qva, /*@unused@*/rpmdb rpmdb, Header h)
&& !(fileFlagsList[i] & RPMFILE_CONFIG))
continue;
+ /* If not querying %ghost, skip ghost files. */
+ if (!(qva->qva_fflags & RPMFILE_GHOST)
+ && (fileFlagsList[i] & RPMFILE_GHOST))
+ continue;
+
if (!rpmIsVerbose() && prefix)
te = stpcpy(te, prefix);
@@ -306,15 +311,22 @@ int showQueryPackage(QVA_t qva, /*@unused@*/rpmdb rpmdb, Header h)
} else {
char * filespec;
int nlink;
+ size_t fileSize;
filespec = xmalloc(strlen(dirNames[dirIndexes[i]])
+ strlen(baseNames[i]) + 1);
strcpy(filespec, dirNames[dirIndexes[i]]);
strcat(filespec, baseNames[i]);
+ fileSize = fileSizeList[i];
nlink = countLinks(fileRdevList, fileInodeList, count, i);
+
+if (S_ISDIR(fileModeList[i])) {
+ nlink++;
+ fileSize = 0;
+}
if (fileOwnerList && fileGroupList) {
- printFileInfo(te, filespec, fileSizeList[i],
+ printFileInfo(te, filespec, fileSize,
fileModeList[i], fileMTimeList[i],
fileRdevList[i], nlink,
fileOwnerList[i],
@@ -322,7 +334,7 @@ int showQueryPackage(QVA_t qva, /*@unused@*/rpmdb rpmdb, Header h)
-1, fileLinktoList[i]);
te += strlen(te);
} else if (fileUIDList && fileGIDList) {
- printFileInfo(te, filespec, fileSizeList[i],
+ printFileInfo(te, filespec, fileSize,
fileModeList[i], fileMTimeList[i],
fileRdevList[i], nlink,
NULL, NULL, fileUIDList[i],
diff --git a/lib/rpmcli.h b/lib/rpmcli.h
index f90a21bee..362af31f3 100644
--- a/lib/rpmcli.h
+++ b/lib/rpmcli.h
@@ -213,6 +213,7 @@ struct rpmQVArguments_s {
rpmQVSources qva_source; /*!< Identify CLI arg type. */
int qva_sourceCount;/*!< Exclusive check (>1 is error). */
rpmQueryFlags qva_flags; /*!< Bit(s) to control operation. */
+ rpmfileAttrs qva_fflags; /*!< Bit(s) to filter on attribute. */
/*@unused@*/ int qva_verbose; /*!< (unused) */
/*@only@*/ /*@null@*/ const char * qva_queryFormat; /*!< Format for headerSprintf(). */
/*@observer@*/ /*@null@*/ const char * qva_prefix; /*!< Path to top of install tree. */
diff --git a/lib/rpmlib.h b/lib/rpmlib.h
index e7700fd02..e468e8bea 100644
--- a/lib/rpmlib.h
+++ b/lib/rpmlib.h
@@ -395,6 +395,8 @@ typedef enum rpmfileAttrs_e {
#define RPMFILE_MULTILIB(N) ((N) << RPMFILE_MULTILIB_SHIFT)
#define RPMFILE_MULTILIB_MASK RPMFILE_MULTILIB(7)
+#define RPMFILE_ALL ~(RPMFILE_NONE)
+
/* XXX Check file flags for multilib marker. */
#define isFileMULTILIB(_fflags) ((_fflags) & RPMFILE_MULTILIB_MASK)
diff --git a/lib/verify.c b/lib/verify.c
index 11a5ed83d..edc266649 100644
--- a/lib/verify.c
+++ b/lib/verify.c
@@ -409,6 +409,12 @@ static int verifyHeader(QVA_t qva, Header h)
int rc;
fileAttrs = fileFlags[i];
+
+ /* If not verifying %ghost, skip ghost files. */
+ if (!(qva->qva_fflags & RPMFILE_GHOST)
+ && (fileAttrs & RPMFILE_GHOST))
+ continue;
+
rc = rpmVerifyFile(prefix, h, i, &verifyResult, omitMask);
if (rc) {
if (!(fileAttrs & RPMFILE_MISSINGOK) || rpmIsVerbose()) {
diff --git a/rpm.spec.in b/rpm.spec.in
index 6a0bd5cff..a9c640785 100644
--- a/rpm.spec.in
+++ b/rpm.spec.in
@@ -241,7 +241,7 @@ fi
%config(noreplace,missingok) /etc/rpm/macros.db1
%attr(0755, @RPMUSER@, @RPMGROUP@) %dir /var/lib/rpm
-%define rpmdbattr %attr(0644, @RPMUSER@, @RPMGROUP@) %verify(not md5 size mtime) %ghost %config(missingok)
+%define rpmdbattr %attr(0644, @RPMUSER@, @RPMGROUP@) %verify(not md5 size mtime) %ghost %config(missingok,noreplace)
%rpmdbattr /var/lib/rpm/Basenames
%rpmdbattr /var/lib/rpm/Conflictname
%rpmdbattr /var/lib/rpm/__db.001
diff --git a/rpmqv.c b/rpmqv.c
index 205c3d628..551a372ee 100755
--- a/rpmqv.c
+++ b/rpmqv.c
@@ -396,6 +396,7 @@ int main(int argc, const char ** argv)
qva->qva_queryFormat = _free(qva->qva_queryFormat);
memset(qva, 0, sizeof(*qva));
qva->qva_source = RPMQV_PACKAGE;
+ qva->qva_fflags = RPMFILE_ALL;
qva->qva_mode = ' ';
qva->qva_char = ' ';
#endif