[ 
https://issues.apache.org/jira/browse/HADOOP-10926?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14211502#comment-14211502
 ] 

Colin Patrick McCabe commented on HADOOP-10926:
-----------------------------------------------

Hi [~ajisakaa],

This patch was reverted, so it actually is not in effect right now.  So this 
patch is not the source of your CR+LF problems.

It does look like {{GNU patch}} sometimes transforms CR+LF to LF, unless the 
{{\-\-binary}} flag is passed.  From the documentation:
{code}
cmccabe@keter:~/hadoop1> patch --version
GNU patch 2.7.1

cmccabe@keter:~/hadoop1> man patch
...
       --binary
          Write  all  files  in binary mode, except for standard output and 
/dev/tty.  When reading, disable the heuristic for transforming CRLF line 
endings into LF line endings.  This option is needed on POSIX systems when 
applying patches
          generated on non-POSIX systems to non-POSIX files.  (On POSIX 
systems, file reads and writes never transform line endings. On Windows, reads 
and writes do transform line endings by  default,  and  patches  should  be  
generated  by
          diff --binary when line endings are significant.)
...
{code}

We have never used the --binary option for GNU patch, so we get the 
tranformation behavior described here.  It seems like when you are working with 
Windows files, this CR+LF -> LF behavior is actually undesirable.  So this is 
another reason to use {{git apply}} rather than {{patch}}.  It seems like the 
change in this JIRA would have actually fixed your problem, not caused it.


I am curious, though, why this wasn't an issue before.  Perhaps upgrading the 
version of GNU patch changed the behavior?

> Improve test-patch.sh to apply binary diffs
> -------------------------------------------
>
>                 Key: HADOOP-10926
>                 URL: https://issues.apache.org/jira/browse/HADOOP-10926
>             Project: Hadoop Common
>          Issue Type: Improvement
>    Affects Versions: 3.0.0
>            Reporter: Andrew Wang
>            Assignee: Colin Patrick McCabe
>         Attachments: HADOOP-10926.001.patch, HADOOP-10926.002.patch, 
> HADOOP-10926.003.patch
>
>
> The Unix {{patch}} command cannot apply binary diffs as generated via {{git 
> diff --binary}}. This means we cannot get effective test-patch.sh runs when 
> the patch requires adding a binary file.
> We should consider using a different patch method.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to