You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@subversion.apache.org by "Julian Foad (JIRA)" <ji...@apache.org> on 2017/10/31 10:22:00 UTC

[jira] [Commented] (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=16226563#comment-16226563 ] 

Julian Foad commented on SVN-4607:
----------------------------------

In the 1.9.x backport nomination, Bert commented, "while I agree that this patch fixes a problem, I don't think this is the right backport. This patch changes the behavior of a public api (with no known users except libsvn_client) in a specific way for this issue. On trunk this behavior change was reverted when a better fix was implemented".

> 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.4.14#64029)