RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1626473 - rpmbuild doesn't honor "new file mode 100755" when applying patches
Summary: rpmbuild doesn't honor "new file mode 100755" when applying patches
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: patch
Version: 7.6
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Than Ngo
QA Contact: Jan Houska
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-09-07 12:25 UTC by Jaroslav Škarvada
Modified: 2019-08-06 12:33 UTC (History)
4 users (show)

Fixed In Version: 2.7.1-11
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-08-06 12:33:37 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2019:2033 0 None None None 2019-08-06 12:33:45 UTC

Description Jaroslav Škarvada 2018-09-07 12:25:23 UTC
Description of problem:

Version-Release number of selected component (if applicable):
rpm-4.11.3-32.el7.src.rpm

How reproducible:
Always

Steps to Reproduce:
1. Create patch having 'new file mode' e.g.

diff --git a/a.txt b/a.txt
new file mode 100755
index 0000000..33cb730
--- /dev/null
+++ b/a.txt

2. Try to apply it from the spec

Actual results:
a.txt is created with mode 644 (and later packaged to the RPM with this mode if mentioned in the %files section of the spec)

Expected results:
a.txt is created with mode 755 (i.e. mode specified in the patch)

Additional info:
It seems rpm-build-4.14.1-9.fc28.x86_64 handles it correctly.

We had to workaround it in the spec file by an explicit:
 chmod 0755 FILE
after the patch application.

Comment 2 Panu Matilainen 2018-09-07 13:19:58 UTC
rpm-build doesn't apply patches, patch does. Or git, or one of the other %autosetup backends, and your results will depend on that. Depending on which one you use, this bug belongs to that component. If it's plain old %patch you're using, then that component is "patch".

Comment 3 Jaroslav Škarvada 2018-09-07 13:49:55 UTC
Yep, it seems it's patch, reproducer:
$ patch -p1 < ./test.patch

Non working version:
patch-2.7.1-10.el7_4.x86_64

Working version:
patch-2.7.6-4.fc28.x86_64

Reassigning to patch.

Comment 4 Than Ngo 2018-09-10 08:17:19 UTC
i will have a look at this. Thank for the report

Comment 13 Jan Houska 2019-06-07 14:40:52 UTC
VERIFIED:

NEW PASS:
patch-2.7.1-11.el7

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::   Test
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: [ 10:38:32 ] :: [  BEGIN   ] :: Running 'patch -p1 < test.patch'
patching file a.txt
:: [ 10:38:32 ] :: [   PASS   ] :: Command 'patch -p1 < test.patch' (Expected 0, got 0)
:: [ 10:38:32 ] :: [  BEGIN   ] :: Running 'stat -c '%a %n' ./a.txt > a.txt.mode'
:: [ 10:38:32 ] :: [   PASS   ] :: Command 'stat -c '%a %n' ./a.txt > a.txt.mode' (Expected 0, got 0)
:: [ 10:38:32 ] :: [   PASS   ] :: File 'a.txt.mode' should contain '755 ./a.txt' 
:: [ 10:38:32 ] :: [   PASS   ] :: File 'a.txt.mode' should not contain '644 ./a.txt' 
--cat a.txt.mode--------------------
755 ./a.txt
--/cat a.txt.mode-------------------
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::   Duration: 0s
::   Assertions: 4 good, 0 bad
::   RESULT: PASS (Test)



OLD  FAIL:
patch-2.7.1-10.el7_5


::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::   Test
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: [ 10:38:29 ] :: [  BEGIN   ] :: Running 'patch -p1 < test.patch'
patching file a.txt
:: [ 10:38:29 ] :: [   PASS   ] :: Command 'patch -p1 < test.patch' (Expected 0, got 0)
:: [ 10:38:29 ] :: [  BEGIN   ] :: Running 'stat -c '%a %n' ./a.txt > a.txt.mode'
:: [ 10:38:29 ] :: [   PASS   ] :: Command 'stat -c '%a %n' ./a.txt > a.txt.mode' (Expected 0, got 0)
:: [ 10:38:29 ] :: [   FAIL   ] :: File 'a.txt.mode' should contain '755 ./a.txt' 
:: [ 10:38:29 ] :: [   FAIL   ] :: File 'a.txt.mode' should not contain '644 ./a.txt' 
--cat a.txt.mode--------------------
644 ./a.txt
--/cat a.txt.mode-------------------
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::   Duration: 0s
::   Assertions: 2 good, 2 bad
::   RESULT: FAIL

Comment 16 errata-xmlrpc 2019-08-06 12:33:37 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2019:2033


Note You need to log in before you can comment on or make changes to this bug.