Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attribute marker in -V mode undefined for multi-attribute files #2846

Open
dmnks opened this issue Jan 16, 2024 · 1 comment
Open

Attribute marker in -V mode undefined for multi-attribute files #2846

dmnks opened this issue Jan 16, 2024 · 1 comment
Labels

Comments

@dmnks
Copy link
Contributor

dmnks commented Jan 16, 2024

Description
The attribute marker in --verify mode is only one character long, however file entries may in fact have multiple attributes. For example, the following are all valid entries:

%config %doc /etc/docfile
%config %license /etc/license
%config %ghost /etc/ghost

In these cases, the marker will currently show whichever attribute comes first in the internal attrFormat string returned from rpmFFlagsString():

static int verifyHeader( ...
{
[...]
attrFormat = rpmFFlagsString(fileAttrs);
ac = rstreq(attrFormat, "") ? ' ' : attrFormat[0];
[...]
}

As a result, the actual marker shown in the output is not well-defined for such combined file entries. There are two ways to fix this:

  1. Define the priority of attributes, e.g. a g for %ghost is more specific and so should be shown instead of c for %config.
  2. Add new markers, e.g. as uppercase variants of the existing ones. For example, a %ghost and %config entry would show up as a G.

To Reproduce
Steps to reproduce the behavior:

  1. Build a package with the following %build and %files section:
%build
mkdir -p %{buildroot}/etc
touch %{buildroot}/etc/docfile
touch %{buildroot}/etc/license

%files
%config %doc /etc/docfile
%config %license /etc/license
%config %ghost /etc/ghost
  1. Install the built package
  2. Create the ghost file manually:
touch /etc/ghost
  1. Modify the other files:
chmod -w /etc/docfile /etc/license
  1. Verify the package:
rpm -V <package-name>

Actual output

.M.......  d /etc/docfile
.M.......  c /etc/ghost
.M.......  c /etc/license

Expected output
Variant 1:

.M.......  d /etc/docfile
.M.......  g /etc/ghost
.M.......  l /etc/license

Variant 2:

.M.......  D /etc/docfile
.M.......  G /etc/ghost
.M.......  L /etc/license

Environment

  • Fedora 39
  • RPM 4.19.90 (built from master)

Additional context
This was originally filed in Red Hat Jira: https://issues.redhat.com/browse/RHEL-20649

@dmnks dmnks added the bug label Jan 16, 2024
@pmatilai
Copy link
Member

I think it's slighly more subtle: whether a file is a %license or not has little relevance to verify results. However a content mismatch on a %config file is something entirely different (with possible noreplace/missingok modifiers) and yet again quite different for a %ghost which can also have be a %config. But %license doesn't combine with anything else.

Using different letters/uppercase for the various combos is a no-go: we may currently only have 11 such attributes but there's room for 32 in total. That is already more than the alphabets have, and when you consider their combinations...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Backlog
Development

No branches or pull requests

2 participants