public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Mark Wielaard <mjw@fedoraproject.org>
To: git-commits@fedoraproject.org
Subject: [rpms/rpm] pmatilai-v6: Fix resetting attr flags in buildid creation (#1449732)
Date: Mon, 23 Nov 2026 09:30:58 GMT	[thread overview]
Message-ID: <179542625822.1.17276977641276172733.rpms-rpm-117a783617f8@fedoraproject.org> (raw)

A new commit has been pushed.

Repo   : rpms/rpm
Branch : pmatilai-v6
Commit : 117a783617f87e7fa3c7a759704007e3bc5b90de
Author : Mark Wielaard <mjw@fedoraproject.org>
Date   : 2017-05-30T11:48:59+02:00
Stats  : +238/-1 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/rpm/c/117a783617f87e7fa3c7a759704007e3bc5b90de?branch=pmatilai-v6

Log:
Fix resetting attr flags in buildid creation (#1449732)

---
diff --git a/0025-buildid-reset-attrs.patch b/0025-buildid-reset-attrs.patch
new file mode 100644
index 0000000..5a9b3f3
--- /dev/null
+++ b/0025-buildid-reset-attrs.patch
@@ -0,0 +1,233 @@
+commit b91dc6106e360f13ff365dfac247191942039152
+Author: Mark Wielaard <mark@klomp.org>
+Date:   Wed Mar 15 20:07:29 2017 +0100
+
+    Make sure to reset file attributes for generated build-id directories.
+    
+    [Note this patch is currently being tested in Fedora. See bug below.]
+    
+    When creating the build-id directories we should reset the file attributes
+    to the defaults. Otherwise if the file list contained an %attr or %defattr
+    the directories would come out with the wrong mode.
+    
+    Includes a testcase based on a spec by Igor Gnatenko that fails before
+    and Check that build-id directories are created with the right permissions
+    even if the spec file sets attrs explicitly.
+    
+    https://bugzilla.redhat.com/show_bug.cgi?id=1432372
+    
+    Signed-off-by: Mark Wielaard <mark@klomp.org>
+
+[Just the testcase]
+
+diff --git a/tests/Makefile.am b/tests/Makefile.am
+index 815a390..ad41957 100644
+--- a/tests/Makefile.am
++++ b/tests/Makefile.am
+@@ -69,6 +69,8 @@ EXTRA_DIST += data/RPMS/hello-2.0-1.i686.rpm
+ EXTRA_DIST += data/RPMS/hello-2.0-1.x86_64.rpm
+ EXTRA_DIST += data/SRPMS/foo-1.0-1.src.rpm
+ EXTRA_DIST += data/SRPMS/hello-1.0-1.src.rpm
++EXTRA_DIST += data/SOURCES/hello.c
++EXTRA_DIST += data/SPECS/hello-attr-buildid.spec
+ 
+ # testsuite voodoo
+ AUTOTEST = $(AUTOM4TE) --language=autotest
+diff --git a/tests/data/SOURCES/hello.c b/tests/data/SOURCES/hello.c
+new file mode 100644
+index 0000000..020484e
+--- /dev/null
++++ b/tests/data/SOURCES/hello.c
+@@ -0,0 +1,8 @@
++#include <stdio.h>
++
++int
++main (void)
++{
++  printf ("Hello, world!\n");
++  return 0;
++}
+diff --git a/tests/data/SPECS/hello-attr-buildid.spec b/tests/data/SPECS/hello-attr-buildid.spec
+new file mode 100644
+index 0000000..cdab95f
+--- /dev/null
++++ b/tests/data/SPECS/hello-attr-buildid.spec
+@@ -0,0 +1,27 @@
++Name:           test
++Version:        1.0
++Release:        1
++Summary:        Test
++
++License:        Public Domain
++URL:            https://fedoraproject.org
++Source:         hello.c
++
++%description
++%{summary}.
++
++%prep
++%autosetup -c -D -T
++cp -a %{S:0} .
++
++%build
++gcc -g hello.c -o hello
++
++%install
++mkdir -p %{buildroot}%{_bindir}
++install -D -p -m 0755 -t %{buildroot}%{_bindir} hello
++
++%files
++%attr(644,root,root) %{_bindir}/hello
++
++%changelog
+diff --git a/tests/rpmbuildid.at b/tests/rpmbuildid.at
+index 15c0620..1cae26d 100644
+--- a/tests/rpmbuildid.at
++++ b/tests/rpmbuildid.at
+@@ -1166,3 +1166,39 @@ if test "$id1" == "$id2"; then echo "equal"; else echo "unequal $id1 $id2"; fi
+ ],
+ [ignore])
+ AT_CLEANUP
++
++# ------------------------------
++# Check that build-id directories are created with the right permissions
++# even if the spec file sets attrs explicitly.
++AT_SETUP([rpmbuild buildid attrs])
++AT_KEYWORDS([build] [debuginfo] [buildid])
++AT_CHECK([
++rm -rf ${TOPDIR}
++AS_MKDIR_P(${TOPDIR}/SOURCES)
++
++# Setup sources
++cp "${abs_srcdir}"/data/SOURCES/hello.c ${TOPDIR}/SOURCES
++
++# Build, contains one ELF which should have a buildid.
++run rpmbuild \
++  --macros=${abs_top_builddir}/macros:${abs_top_builddir}/tests/testing/usr/local/lib/rpm/platform/%{_target_cpu}-%{_target_os}/macros:${top_srcdir}/macros.debug \
++  --rcfile=${abs_top_builddir}/rpmrc \
++  --define="_build_id_links compat" \
++  --define "_unique_debug_names 1" \
++  --define "_unique_debug_srcs 1" \
++  --quiet -ba "${abs_srcdir}"/data/SPECS/hello-attr-buildid.spec
++
++run rpm -qp --qf "[[%{filenames} %{filemodes:perms}\n]]" \
++        ${abs_builddir}/testing/build/RPMS/*/test-1.0-1*rpm \
++	| grep "build-id d"
++
++run rpm -qp --qf "[[%{filenames} %{filemodes:perms}\n]]" \
++        ${abs_builddir}/testing/build/RPMS/*/test-debuginfo-1.0-1*rpm \
++	| grep "build-id d"
++],
++[0],
++[/usr/lib/.build-id drwxr-xr-x
++/usr/lib/debug/.build-id drwxr-xr-x
++],
++[ignore])
++AT_CLEANUP
+
+commit 9d942049cf929d5a053c239cdd64f5b97d182c14
+Author: Mark Wielaard <mark@klomp.org>
+Date:   Fri May 19 23:11:39 2017 +0200
+
+    rpmbuild: Reset attrFlags in generateBuildIDs.
+    
+    Debuginfo directories and files could be marked as configuration files
+    if the file list ended with a config file.
+    
+    Patch by Panu Matilainen. Testcase by me.
+    
+    https://bugzilla.redhat.com/show_bug.cgi?id=1449732
+    
+    Signed-off-by: Mark Wielaard <mark@klomp.org>
+
+diff --git a/build/files.c b/build/files.c
+index 791bbe2..86c601b 100644
+--- a/build/files.c
++++ b/build/files.c
+@@ -1860,6 +1860,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;
+ 
+diff --git a/tests/data/SPECS/hello-config-buildid.spec b/tests/data/SPECS/hello-config-buildid.spec
+new file mode 100644
+index 0000000..ca2d30d
+--- /dev/null
++++ b/tests/data/SPECS/hello-config-buildid.spec
+@@ -0,0 +1,30 @@
++Name:           test
++Version:        1.0
++Release:        1
++Summary:        Test
++
++License:        Public Domain
++URL:            https://fedoraproject.org
++Source:         hello.c
++
++%description
++%{summary}.
++
++%prep
++%autosetup -c -D -T
++cp -a %{S:0} .
++
++%build
++gcc -g hello.c -o hello
++
++%install
++mkdir -p %{buildroot}/bin
++install -D -p -m 0755 -t %{buildroot}/bin hello
++mkdir -p %{buildroot}/etc
++echo "settings" > %{buildroot}/etc/config.file
++
++%files
++%attr(644,root,root) /bin/hello
++%config(noreplace) /etc/config.file
++
++%changelog
+diff --git a/tests/rpmbuildid.at b/tests/rpmbuildid.at
+index 88ce226..4fab3d5 100644
+--- a/tests/rpmbuildid.at
++++ b/tests/rpmbuildid.at
+@@ -1324,3 +1324,35 @@ run rpm -qp --qf "[[%{filenames} %{filemodes:perms}\n]]" \
+ ],
+ [ignore])
+ AT_CLEANUP
++
++# ------------------------------
++# Check that build-id directories are created with the right attributes
++# even if the spec file sets config explicitly.
++AT_SETUP([rpmbuild buildid config attrs])
++AT_KEYWORDS([build] [debuginfo] [buildid])
++AT_CHECK([
++rm -rf ${TOPDIR}
++AS_MKDIR_P(${TOPDIR}/SOURCES)
++
++# Setup sources
++cp "${abs_srcdir}"/data/SOURCES/hello.c ${TOPDIR}/SOURCES
++
++# Build, contains one ELF which should have a buildid.
++run rpmbuild \
++  --macros=${abs_top_builddir}/macros:${abs_top_builddir}/tests/testing/usr/local/lib/rpm/platform/%{_target_cpu}-%{_target_os}/macros:${top_srcdir}/macros.debug \
++  --rcfile=${abs_top_builddir}/rpmrc \
++  --define="_build_id_links compat" \
++  --define "_unique_debug_names 1" \
++  --define "_unique_debug_srcs 1" \
++  --quiet -ba "${abs_srcdir}"/data/SPECS/hello-config-buildid.spec
++
++# Should contain one config file.
++run rpm -c -qp ${abs_builddir}/testing/build/RPMS/*/test-1.0-1*rpm
++# Should not contain config files.
++run rpm -c -qp ${abs_builddir}/testing/build/RPMS/*/test-debuginfo-1.0-1*rpm
++],
++[0],
++[/etc/config.file
++],
++[ignore])
++AT_CLEANUP
+

diff --git a/rpm.spec b/rpm.spec
index 3ef91c1..b413bf7 100644
--- a/rpm.spec
+++ b/rpm.spec
@@ -33,7 +33,7 @@
 Summary: The RPM package management system
 Name: rpm
 Version: %{rpmver}
-Release: %{?snapver:0.%{snapver}.}22%{?dist}
+Release: %{?snapver:0.%{snapver}.}23%{?dist}
 Group: System Environment/Base
 Url: http://www.rpm.org/
 Source0: http://ftp.rpm.org/releases/%{srcdir}/%{name}-%{srcver}.tar.bz2
@@ -88,6 +88,7 @@ Patch270: 0021-debugedit-Fix-off-by-one-adding-DW_FORM_string-repla.patch
 Patch271: 0022-unbreak-short-circuit.patch
 Patch272: 0023-minisymtab-exe-sh.patch
 Patch273: 0024-no-recompute-build-id.patch
+Patch274: 0025-buildid-reset-attrs.patch
 
 # World writable empty (tmp) dirs in debuginfo packages (#641022)
 Patch280: rpm-4.13.x-writable-tmp-dir.patch
@@ -593,6 +594,9 @@ exit 0
 %doc doc/librpm/html/*
 
 %changelog
+* Tue May 30 2017 Mark Wielaard <mjw@fedoraproject.org> - 4.13.0.1-23
+- Fix resetting attr flags in buildid creation (#1449732)
+
 * Tue May 23 2017 Panu Matilainen <pmatilai@redhat.com> - 4.13.0.1-22
 - Python dependency generators live in python-rpm-generators now (#1444925)
 

                 reply	other threads:[~2026-11-23  9:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179542625822.1.17276977641276172733.rpms-rpm-117a783617f8@fedoraproject.org \
    --to=mjw@fedoraproject.org \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox