**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:

```spec
%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()`:

```c
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:

```spec
%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
```

3. Install the built package
4. Create the ghost file manually:
```sh
touch /etc/ghost
```
5. Modify the other files:
```sh
chmod -w /etc/docfile /etc/license
``` 
6. Verify the package:
```sh
rpm -V <package-name>
```

**Actual output**
```sh
.M.......  d /etc/docfile
.M.......  c /etc/ghost
.M.......  c /etc/license
```

**Expected output**
Variant 1:
```sh
.M.......  d /etc/docfile
.M.......  g /etc/ghost
.M.......  l /etc/license
```
Variant 2:
```sh
.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


-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/2846
You are receiving this because you are subscribed to this thread.

Message ID: <rpm-software-management/rpm/issues/2...@github.com>
_______________________________________________
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint

Reply via email to