Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
For bugs related to Red Hat Enterprise Linux 5 product line. The current stable release is 5.10. For Red Hat Enterprise Linux 6 and above, please visit Red Hat JIRA https://issues.redhat.com/secure/CreateIssue!default.jspa?pid=12332745 to report new issues.

Bug 431887

Summary: Cannot handle file names with integrated spaces
Product: Red Hat Enterprise Linux 5 Reporter: Klaus Ethgen <Klaus+rhbz>
Component: patchAssignee: Tim Waugh <twaugh>
Status: CLOSED ERRATA QA Contact: Ondrej Moriš <omoris>
Severity: medium Docs Contact:
Priority: low    
Version: 5.1CC: omoris, pknirsch
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: patch-2.5.4-30.el5 Doc Type: Bug Fix
Doc Text:
Patches for files whose names contain spaces could not be applied. A change has been backported to allow filenames with spaces.
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-08-25 14:18:39 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
patch-allow-spaces.patch none

Description Klaus Ethgen 2008-02-07 17:16:31 UTC
Description of problem:
If the file name for the file to be patched in a patch file has spaces, it
cannot be handled by patch.

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

How reproducible:
create a patch of a file with spaces in path
try to apply the patch

Actual results:
patch asks for the file name to patch

Expected results:
Just the patched file

Additional info:
Note that this bug is fixed upstream on 2003-05-18!

Comment 1 Tim Waugh 2008-02-07 17:40:55 UTC
The most recent release of patch is 2.5.4, released in 1999.  Which upstream fix
are you referring to?

Comment 2 Klaus Ethgen 2008-02-07 18:06:03 UTC
The most recent release I find ist 2.5.9 (ftp://alpha.gnu.org/gnu/diffutils/) 
from 2004-06-01.

Comment 3 Tim Waugh 2008-02-07 23:05:28 UTC
We don't generally ship pre-release software, and 2.5.9 is not a "stable"
release (hence it being hosted on alpha.gnu.org not ftp.gnu.org).

I'll take a look at the file names change there.

Comment 4 Tim Waugh 2008-02-08 13:40:27 UTC
Created attachment 294351 [details]
patch-allow-spaces.patch

Patch is simple and non-invasive.

Comment 5 Tim Waugh 2008-02-08 13:41:23 UTC
Klaus: thanks for pointing out this fix.

Comment 7 Phil Knirsch 2008-04-30 15:55:26 UTC
Proposing for RHEL-5.3 and granting Devel ACK.

Read ya, Phil


Comment 9 RHEL Program Management 2009-03-26 16:47:46 UTC
This request was evaluated by Red Hat Product Management for
inclusion, but this component is not scheduled to be updated in
the current Red Hat Enterprise Linux release. If you would like
this request to be reviewed for the next minor release, ask your
support representative to set the next rhel-x.y flag to "?".

Comment 10 RHEL Program Management 2009-11-06 18:42:48 UTC
This request was evaluated by Red Hat Product Management for
inclusion, but this component is not scheduled to be updated in
the current Red Hat Enterprise Linux release. If you would like
this request to be reviewed for the next minor release, ask your
support representative to set the next rhel-x.y flag to "?".

Comment 12 Tim Waugh 2010-08-06 16:50:30 UTC
Technical note added. If any revisions are required, please edit the "Technical Notes" field
accordingly. All revisions will be proofread by the Engineering Content Services team.

New Contents:
Patches for files whose names contain spaces could not be applied.  A change has been backported to allow filenames with spaces.

Comment 14 Ondrej Moriš 2010-08-24 09:37:13 UTC
I can reproduce this bug on patch-2.5.4-29.2.3.el5:

# cat patch1 
--- second 2010-08-24 05:17:56.000000000 -0400
+++ f i r s t 2010-08-24 05:17:44.000000000 -0400
@@ -1 +1 @@
-2nd
+1st

# patch second patch1
patching file second

# cat patch2
--- f i r s t 2010-08-24 05:17:44.000000000 -0400
+++ second 2010-08-24 05:17:56.000000000 -0400
@@ -1 +1 @@
-1st
+2nd

# patch f\ i\ r\ s\ t patch 
patching file 'f i r s t'

Could you please provide more specific reproducer?

Comment 15 Tim Waugh 2010-08-24 09:54:14 UTC
echo a > "file name.orig"
echo b > "file name"
diff -u "file name.orig" "file name" > fn.patch
rm "file name"*
echo a > "file name"
patch -i fn.patch

Comment 16 Ondrej Moriš 2010-08-24 10:27:47 UTC
Ah, great... thanks.

Comment 19 errata-xmlrpc 2010-08-25 14:18:39 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2010-0656.html