subversion-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ivan Zhakov (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (SVN-4533) patch confused by offset reordered hunks
Date Fri, 29 Apr 2016 08:20:12 GMT

     [ https://issues.apache.org/jira/browse/SVN-4533?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Ivan Zhakov updated SVN-4533:
-----------------------------
    Fix Version/s:     (was: 1.8.12)
                   1.8.13

> patch confused by offset reordered hunks
> ----------------------------------------
>
>                 Key: SVN-4533
>                 URL: https://issues.apache.org/jira/browse/SVN-4533
>             Project: Subversion
>          Issue Type: Bug
>          Components: libsvn_client
>    Affects Versions: trunk
>            Reporter: Philip Martin
>             Fix For: 1.8.13, 1.9.0, 1.7.20
>
>
> {noformat:nopanel=true}
> Consider a patch with two hunks.  Apply this to a file where the hunks do not
> match at the original offset but do match at a positive offset, there is a
> second match for the second hunk at a negative offset.
> The first hunk matches at the positive offset, the second hunk fails to match at
> the original offset and the match at the negative offset is found.  This
> effectively reorders the hunks and the result is output that spuriously applies
> the second hunk at the wrong location.  This affects 1.8 and trunk.
> Here is the patch:
> Index: wc/f
> ===================================================================
> --- wc/f	(revision 1)
> +++ wc/f	(revision 2)
> @@ -899,6 +899,7 @@
>  1898
>  1899
>  1900
> +XXXX
>  1901
>  1902
>  1903
> @@ -919,6 +920,7 @@
>  1918
>  1919
>  1920
> +YYYY
>  1921
>  1922
>  1923
> This is the result of applying, note the second hunk YYYY has not been output at
> either the first or second match and arbitrary lines are deleted.
> Index: wc/f
> ===================================================================
> --- wc/f	(revision 3)
> +++ wc/f	(working copy)
> @@ -1211,15 +1211,17 @@
>  1898
>  1899
>  1900
> +XXXX
>  1901
>  1902
>  1903
> -1904
> -1905
> -1906
> -1907
> -1908
> -1909
> +1918
> +1919
> +1920
> +YYYY
> +1921
> +1922
> +1923
>  1910
>  1911
>  1912
> Here is the script to reproduce:
> #!/bin/bash -e
> svnadmin create repo
> svn co file://`pwd`/repo wc
> for i in `seq 1000 2000`; do echo $i >> wc/f ; done
> svn add wc/f
> svn ci -mm wc
> > wc/f
> for i in `seq 1000 1900`; do echo $i >> wc/f ; done
> echo XXXX >> wc/f
> for i in `seq 1901 1920`; do echo $i >> wc/f ; done
> echo YYYY >> wc/f
> for i in `seq 1921 2000`; do echo $i >> wc/f ; done
> svn ci -mm wc
> > wc/f
> for i in `seq 1000 1100`; do echo $i >> wc/f ; done
> for i in `seq 1915 1925`; do echo $i >> wc/f ; done
> for i in `seq 1101 1400`; do echo $i >> wc/f ; done
> for i in `seq 0 300`; do echo ZZZZ  >> wc/f ; done
> for i in `seq 1401 2000`; do echo $i >> wc/f ; done
> svn ci -mm wc
> svn diff -c2 wc > y.y
> svn patch y.y wc --strip 1
> {noformat}



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

Mime
View raw message