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 1905282 - filterdiff not removing the header from excluded files in a git patch
Summary: filterdiff not removing the header from excluded files in a git patch
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: patchutils
Version: 7.9
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: Than Ngo
QA Contact: Jakub Haruda
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-12-07 23:04 UTC by Brian J. Murrell
Modified: 2021-02-02 12:03 UTC (History)
2 users (show)

Fixed In Version: patchutils-0.3.3-5.el7_9
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-02-02 12:03:54 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github twaugh patchutils issues 46 0 None closed filterdiff not removing the header from excluded files in a git patch 2021-02-03 07:59:57 UTC

Description Brian J. Murrell 2020-12-07 23:04:09 UTC
Description of problem:
If I have a patch produced from git such as:

diff --git a/selftests/functional/test_basic.py b/selftests/functional/test_basic.py
index 468b7d57..ed494733 100644
--- a/selftests/functional/test_basic.py
+++ b/selftests/functional/test_basic.py
@@ -184,6 +184,13 @@ class RunnerOperationTest(unittest.TestCase):
         self.assertIn('    data     ' + mapping['data_dir'], result.stdout)
         self.assertIn('    logs     ' + mapping['logs_dir'], result.stdout)
 
+    def test_runner_phases(self):
+        cmd_line = ('%s run --sysinfo=off --job-results-dir %s '
+                    'phases.py' % (AVOCADO, self.tmpdir))
+        result = process.run(cmd_line)
+        expected_rc = exit_codes.AVOCADO_ALL_OK
+        self.assertEqual(result.exit_status, expected_rc,
+                         "Avocado did not return rc %d:\n%s" % (expected_rc, result))
     def test_runner_all_ok(self):
         os.chdir(basedir)
         cmd_line = ('%s run --sysinfo=off --job-results-dir %s '

and run it through filterdiff -p1 -x selftests/\*, the header of the file being excluded from the patch is still included:

$ filterdiff -p1 -x selftests/\* < foo.patch
diff --git a/selftests/functional/test_basic.py b/selftests/functional/test_basic.py
index 468b7d57..ed494733 100644
Which causes patch to barf:

$ filterdiff -p1 -x selftests/\* < foo.patch | patch -p1 --dry-run
can't find file to patch at input line 2
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/selftests/functional/test_basic.py b/selftests/functional/test_basic.py
|index 468b7d57..ed494733 100644
--------------------------
File to patch: 

Version-Release number of selected component (if applicable):
patchutils-0.3.3-4.el7.x86_64.rpm

How reproducible:
100%

Steps to Reproduce:
1. See description.  It's quite detailed.

Actual results:
Patch fails on filterdiff output

Expected results:
Patch should not fail

Comment 2 Brian J. Murrell 2020-12-07 23:04:55 UTC
Per the Linked upstream ticket, this is fixed in a newer version of patchutils.

Comment 3 Than Ngo 2020-12-16 11:15:34 UTC
Hi, i backported the upstream fix and uploaded new build on
https://than.fedorapeople.org/rhel7/patchutils/

Could you please test and give me feedbacks?

Thanks

Comment 4 Brian J. Murrell 2020-12-16 13:38:48 UTC
Yeah, seems to work.

Thanks for the fix!

How long will this take to get into EL7?

Comment 16 errata-xmlrpc 2021-02-02 12:03:54 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 (patchutils bug fix and enhancement update), 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/RHBA-2021:0342


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