[Buildroot] [PATCH v2 0/2] fix build using old versions of patch

Ricardo Martincoski ricardo.martincoski at gmail.com
Sat Jan 23 23:53:41 UTC 2016


This patch series makes libsoil (currently the only package that
patches a file with spaces in the name) to build fine even in very old
distros. I tested using patch 2.5 (from 1997) compiled from its tarball
in a Ubuntu 14.04 host system.
The patch series also updates the manual to describe the workaround
needed in such cases (when a patch need to be applied to a file with
spaces in the name).

Anyone willing to help by testing on a RHEL4 or RHEL5 after the
code-review? See
http://autobuild.buildroot.net/results/ea7/ea77d6b23aca0cb1cf527e6c16ddf5eba957a69c/

Some background:

patch version 2.7 or later is required to apply patches (generated by
 diff v3.3) that change a file with space in the name

The output of "diff -purN" when there are spaces in the name of a
changed file depends on the tool version:
 diff <= v3.2 does not add double quotes to filenames with spaces
 diff >= v3.3 adds double quotes to filenames with spaces
Tests were performed using the versions 3.2 and 3.3 from
http://ftp.gnu.org/gnu/diffutils/

The tool 'patch' can handle patches with spaces in the name of a
changed file depending on the tool version:
 patch <= 2.5.4 cannot handle spaces in filenames
 patch >= 2.5.9 can handle unquoted filenames with spaces
 patch >= 2.7 can handle both quoted and unquoted filenames
Tests were performed using all versions with tarball available at
http://ftp.gnu.org/gnu/patch/

If the patch file is just edited to remove the quote (added by
 diff >= v3.3) around the filename, it would become applicable by
patch >= 2.5.9

RHEL5 and RHEL4 use patch 2.5.4. (Thomas P)
There are still users that build using these distros. (Thomas DS)

Symlink and hard link cannot be used because patch unlinks them.
But the file can be renamed by a hook before patched.
And the patched file can be renamed back by another hook, if needed.

Ricardo Martincoski (2):
  package/libsoil: fix build using old versions of patch
  docs/manual: patches that change files with spaces in the name

 docs/manual/patch-policy.txt            | 17 +++++++++++++++++
 package/libsoil/0001-fix-makefile.patch |  6 +++---
 package/libsoil/libsoil.mk              |  8 +++++++-
 3 files changed, 27 insertions(+), 4 deletions(-)

--- 
v1 -> v2:
 - remove prerequisite patch >= 2.5.9 (added by v1)
 - use 1 or 2 hooks to rename the file that contains spaces
   (based on the suggestion to use a symlink from Thomas DS)
 - change the patch file to be applied on the renamed file
 - update the manual entry
 - do not use the 2nd rename hook for libsoil (Thomas P)
-- 
1.9.1



More information about the buildroot mailing list