You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@subversion.apache.org by "Philip Martin (JIRA)" <ji...@apache.org> on 2015/12/02 16:15:11 UTC

[jira] [Comment Edited] (SVN-4607) patch file missing a trailing newline removes a newline when applied

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

Philip Martin edited comment on SVN-4607 at 12/2/15 3:15 PM:
-------------------------------------------------------------

This was fixed on trunk by r1705038. We should consider backporting this to 1.9. Not sure how many other revisions should be backported, perhaps r1705080 for the tests and r1705102 for performance and to match trunk.


was (Author: philipm):
This was fixed on trunk by r1705038. We should consider backporting this to 1.9. Not sure how many other revisions should be backported, perhaps r1705080 for the tests and r1705102 for performance and to matc trunk.

> patch file missing a trailing newline removes a newline when applied
> --------------------------------------------------------------------
>
>                 Key: SVN-4607
>                 URL: https://issues.apache.org/jira/browse/SVN-4607
>             Project: Subversion
>          Issue Type: Bug
>          Components: libsvn_client
>            Reporter: Philip Martin
>
> This problem is present in the 1.8 and 1.9 releases but has already been fixed in 1.10.
> A patch file that is missing a trailing newline can remove a newline elsewhere in the file:
> svnadmin create repo
> svnmucc -mm -U file://`pwd`/repo \
>   put <(printf "a\nb\nc\nd\ne\nf\n") f
> svn co file://`pwd`/repo wc
> printf "x\na\nb\nc\nd\ne\nf\n" > wc/f
> (cd wc && svn diff) > patch.txt
> svn revert wc/f
> The patch inserts one line:
> $ cat patch.txt
> Index: f
> ===================================================================
> --- f	(revision 1)
> +++ f	(working copy)
> @@ -1,3 +1,4 @@
> +x
>  a
>  b
>  c
> Strip the final newline from the patch:
> $ dd bs=1 count=144 if=patch.txt of=patch-noeol.txt
> When applied this patch still adds a line but is also removes a newline in a different location:
> $ svn patch patch-noeol.txt wc
> U         wc/f
> $ svn diff wc
> Index: wc/f
> ===================================================================
> --- wc/f	(revision 1)
> +++ wc/f	(working copy)
> @@ -1,6 +1,6 @@
> +x
>  a
>  b
> -c
> -d
> +cd
>  e
>  f



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