Red Hat Bugzilla – Bug 431887
Cannot handle file names with integrated spaces
Last modified: 2013-04-12 15:31:59 EDT
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):
create a patch of a file with spaces in path
try to apply the patch
patch asks for the file name to patch
Just the patched file
Note that this bug is fixed upstream on 2003-05-18!
The most recent release of patch is 2.5.4, released in 1999. Which upstream fix
are you referring to?
The most recent release I find ist 2.5.9 (ftp://alpha.gnu.org/gnu/diffutils/)
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.
Created attachment 294351 [details]
Patch is simple and non-invasive.
Klaus: thanks for pointing out this fix.
Proposing for RHEL-5.3 and granting Devel ACK.
Read ya, Phil
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 "?".
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.
Patches for files whose names contain spaces could not be applied. A change has been backported to allow filenames with spaces.
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 @@
# 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 @@
# patch f\ i\ r\ s\ t patch
patching file 'f i r s t'
Could you please provide more specific reproducer?
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
Ah, great... thanks.
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.