Bug 1449732

Summary: Debuginfo directories and files sometimes marked as configuration files
Product: [Fedora] Fedora Reporter: Mattias Ellert <mattias.ellert>
Component: rpmAssignee: Packaging Maintenance Team <packaging-team-maint>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: ignatenko, kardos.lubos, mjw, packaging-team-maint, pmatilai, vmukhame
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rpm-4.13.0.1-23.fc27 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-07-05 22:19:09 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Mattias Ellert 2017-05-10 14:33:29 UTC
Description of problem:

$ rpm -q xrootd-client-libs
xrootd-client-libs-4.6.0-9.fc27.x86_64
$ rpm -Vv xrootd-client-libs
.........    /etc/xrootd
.........  c /etc/xrootd/client.conf
.........    /etc/xrootd/client.plugins.d
.........  c /etc/xrootd/client.plugins.d/client-plugin.conf.example
.........  n /usr/lib/.build-id
.........  n /usr/lib/.build-id/02
.........  c /usr/lib/.build-id/02/f0a4de3eb03411c12b780297edec7c774ed5d7
.........  n /usr/lib/.build-id/66
.........  c /usr/lib/.build-id/66/12593d4bfa2e794cccf96869074dd2a97a7e5e
.........  n /usr/lib/.build-id/8d
.........  c /usr/lib/.build-id/8d/e3fad9f1b101ca41aae3bec9da6c75fb57cd72
.........  n /usr/lib/.build-id/aa
.........  c /usr/lib/.build-id/aa/398bf66e04f76ba08576f5d08ab36b4e58f61e
.........  n /usr/lib/.build-id/ef
.........  c /usr/lib/.build-id/ef/852b12b6da3d4eeb96c9963eb0c6d5de8dce95
.........    /usr/lib64/libXrdCl.so.2
.........    /usr/lib64/libXrdCl.so.2.0.0
.........    /usr/lib64/libXrdClient.so.2
.........    /usr/lib64/libXrdClient.so.2.0.0
.........    /usr/lib64/libXrdFfs.so.2
.........    /usr/lib64/libXrdFfs.so.2.0.0
.........    /usr/lib64/libXrdPosix.so.2
.........    /usr/lib64/libXrdPosix.so.2.0.0
.........    /usr/lib64/libXrdPosixPreload.so
.........    /usr/lib64/libXrdPosixPreload.so.1
.........    /usr/lib64/libXrdPosixPreload.so.1.0.0
$ rpmlint xrootd-client-libs | grep conffile
xrootd-client-libs.x86_64: W: non-etc-or-var-file-marked-as-conffile /usr/lib/.build-id/02/f0a4de3eb03411c12b780297edec7c774ed5d7
xrootd-client-libs.x86_64: W: non-etc-or-var-file-marked-as-conffile /usr/lib/.build-id/66/12593d4bfa2e794cccf96869074dd2a97a7e5e
xrootd-client-libs.x86_64: W: non-etc-or-var-file-marked-as-conffile /usr/lib/.build-id/8d/e3fad9f1b101ca41aae3bec9da6c75fb57cd72
xrootd-client-libs.x86_64: W: non-etc-or-var-file-marked-as-conffile /usr/lib/.build-id/aa/398bf66e04f76ba08576f5d08ab36b4e58f61e
xrootd-client-libs.x86_64: W: non-etc-or-var-file-marked-as-conffile /usr/lib/.build-id/ef/852b12b6da3d4eeb96c9963eb0c6d5de8dce95

Version-Release number of selected component (if applicable):

rpm-4.13.0.1-20.fc27

How reproducible:

Always

Steps to Reproduce:
1. rebuild an affected package (e.g. xrootd)

Actual results:

Debuginfo directories and files marked as config

Expected results:

Debuginfo directories and files not marked as config

Additional info:

This seems to happen if the last entry in a %files section is a file marked %config(noreplace). The debuginfo directories and files then seem to inherit this attribute. I didn't investigate if other attributes are also inherited this way.

Comment 1 Mark Wielaard 2017-05-10 15:24:17 UTC
Something similar happened in the past with %attr being used and not being reset.
This was fixed in rpm-4.13.0.1-8.fc27 with the following patch:
0015-reset-buildid-file-attrs.patch
Which was https://bugzilla.redhat.com/show_bug.cgi?id=1432372
Upstream patch: http://lists.rpm.org/pipermail/rpm-maint/2017-March/005252.html

Apparently something similar is needed for %config. But I don't know what exactly.

Comment 2 Panu Matilainen 2017-05-11 11:59:30 UTC
Yeah its closely related to bug 1432372, this seems to fix it but didn't commit as I didn't look too closely and only cursory testing:

diff --git a/build/files.c b/build/files.c
index f58569e..77cbd9d 100644
--- a/build/files.c
+++ b/build/files.c
@@ -1843,6 +1843,8 @@ static int generateBuildIDs(FileList fl)
               Uses parseForAttr to reset ar, arFlags, and specdFlags.
               Note that parseForAttr pokes at the attrstr, so we cannot
               just pass a static string. */
+           fl->cur.attrFlags = 0;
+           fl->def.attrFlags = 0;
            fl->def.verifyFlags = RPMVERIFY_ALL;
            fl->cur.verifyFlags = RPMVERIFY_ALL;
            fl->def.specdFlags |= SPECD_VERIFY;

Longer term, it might actually be easier to have generateBuildIDs() generate %files manifests which are fed into the spec parsing routines instead of doing this stuff manually. Because .. as you've witnessed, the internals are not very well suited to this, to put it mildly :)

Comment 3 Mattias Ellert 2017-05-13 09:21:20 UTC
If whatever "inherited" values these variables have should be cleared and replaced with the default values, why does it say "specdFlags |= SPECD_VERIFY" and not "specdFlags = SPECD_VERIFY"?

Comment 4 Mark Wielaard 2017-05-19 21:18:58 UTC
(In reply to Panu Matilainen from comment #2)
> Yeah its closely related to bug 1432372, this seems to fix it but didn't
> commit as I didn't look too closely and only cursory testing:
> 
> diff --git a/build/files.c b/build/files.c
> index f58569e..77cbd9d 100644
> --- a/build/files.c
> +++ b/build/files.c
> @@ -1843,6 +1843,8 @@ static int generateBuildIDs(FileList fl)
>                Uses parseForAttr to reset ar, arFlags, and specdFlags.
>                Note that parseForAttr pokes at the attrstr, so we cannot
>                just pass a static string. */
> +           fl->cur.attrFlags = 0;
> +           fl->def.attrFlags = 0;
>             fl->def.verifyFlags = RPMVERIFY_ALL;
>             fl->cur.verifyFlags = RPMVERIFY_ALL;
>             fl->def.specdFlags |= SPECD_VERIFY;

Yes, that fixes it. I added a testcase and submitted upstream:
http://lists.rpm.org/pipermail/rpm-maint/2017-May/005598.html

> Longer term, it might actually be easier to have generateBuildIDs() generate
> %files manifests which are fed into the spec parsing routines instead of
> doing this stuff manually. Because .. as you've witnessed, the internals are
> not very well suited to this, to put it mildly :)

Yeah, in hindsight. But I think I avoided that because I was afraid of quoting and glob escaping issues. Maybe there are none?

Comment 5 Mark Wielaard 2017-05-19 21:36:18 UTC
(In reply to Mattias Ellert from comment #3)
> If whatever "inherited" values these variables have should be cleared and
> replaced with the default values, why does it say "specdFlags |=
> SPECD_VERIFY" and not "specdFlags = SPECD_VERIFY"?

I must admit I don't actually know. It looks like specdFlags are always ORed. And you always want all verification done on the files. parseForAttr ORs in all the other flags. So probably the default is that all are set. But I don't really understand myself. Panu?

Comment 6 Mark Wielaard 2017-05-30 10:15:24 UTC
This is fixed in rpm-4.13.0.1-23.fc27 but for some reason I seem unable to add the fixed in version field or change the status.