diff mbox

[RCF,1/2] support: enforce '--binary' when applying patches

Message ID 20160929145701.27116-1-james.knight@rockwellcollins.com
State Rejected
Headers show

Commit Message

James Knight Sept. 29, 2016, 2:57 p.m. UTC
The following commit enforces the patch operation to "disable the
heuristic for transforming CRLF line endings into LF line endings" [1].
This is to help packages, which source files have been generated on non-
POSIX systems, to apply compatible non-POSIX generated patches. The
addition of this option should have no effect on existing patches [2].

[1]: http://git.savannah.gnu.org/cgit/patch.git/tree/patch.man#n306
[2]: https://www.gnu.org/software/diffutils/manual/html_node/Binary.html

Signed-off-by: James Knight <james.knight@rockwellcollins.com>
---
 support/scripts/apply-patches.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Ricardo Martincoski Sept. 29, 2016, 4:11 p.m. UTC | #1
James,

This change can have issues with old distros, see below.
Currently buildroot does not enforce a minimal version of 'patch'.

----- Original Message -----
> From: "James Knight" <james.knight@rockwellcollins.com>
> To: buildroot@busybox.net
> Cc: "James Knight" <james.knight@rockwellcollins.com>
> Sent: Thursday, September 29, 2016 11:57:00 AM
> Subject: [Buildroot] [RCF 1/2] support: enforce '--binary' when applying	patches

> The following commit enforces the patch operation to "disable the
> heuristic for transforming CRLF line endings into LF line endings" [1].
[snip]

So I think you need a version of the tool 'patch' that contains [3]
that was merged in patch v2.6
RHEL5 and RHEL4 use patch v2.5.4.

> [1]: http://git.savannah.gnu.org/cgit/patch.git/tree/patch.man#n306
> [2]: https://www.gnu.org/software/diffutils/manual/html_node/Binary.html
[snip]

[3] http://git.savannah.gnu.org/cgit/patch.git/commit/?id=b7687446d1e7673a39fd66bc6043f4a78961f675

Regards,
Ricardo Martincoski
James Knight Sept. 29, 2016, 5:22 p.m. UTC | #2
Ricardo,

On Thu, Sep 29, 2016 at 12:11 PM, Ricardo Martincoski
<ricardo.martincoski@datacom.ind.br> wrote:
>
> This change can have issues with old distros, see below.
> Currently buildroot does not enforce a minimal version of 'patch'.

Good to know; thanks for the information. I'll try an alternative
solution for my current situation [1].

[1]: https://patchwork.ozlabs.org/patch/676644/
diff mbox

Patch

diff --git a/support/scripts/apply-patches.sh b/support/scripts/apply-patches.sh
index 7ccb39d..a71a51a 100755
--- a/support/scripts/apply-patches.sh
+++ b/support/scripts/apply-patches.sh
@@ -114,7 +114,8 @@  function apply_patch {
         exit 1
     fi
     echo "${path}/${patch}" >> ${builddir}/.applied_patches_list
-    ${uncomp} "${path}/$patch" | patch -g0 -p1 -E -d "${builddir}" -t -N $silent
+    ${uncomp} "${path}/$patch" | \
+            patch --binary -g0 -p1 -E -d "${builddir}" -t -N $silent
     if [ $? != 0 ] ; then
         echo "Patch failed!  Please fix ${patch}!"
         exit 1