You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Vladimir Prus <gh...@cs.msu.su> on 2002/01/28 15:46:32 UTC
Re: svn diff segfault [PATCH]
cmpilato@collab.net wrote:
> > Patch:
> > ...
> This looks basically okay (some grammatical/spelling nits, but
> whatever). What's missing is some comment in the definition of the
> file baton's path_end_revision member that explains that
> path_end_revision is expected to be NULL for all files whose textual
> contents did not change over the span of the diff'ed revisions.
Changed.
Log message:
The 'diff' command no longer crashes when two revisions of a file differ in
properties but not in text.
* subversion/libsvn_client/repos_diff.c
(close_file): Check for presence of any change to report was added.
* subversion/tests/clients/cmdline/diff_tests.py
(diff_only_property_change): New function.
Patch:
Index: ./subversion/libsvn_client/repos_diff.c
===================================================================
--- ./subversion/libsvn_client/repos_diff.c
+++ ./subversion/libsvn_client/repos_diff.c Mon Jan 28 18:36:42 2002
@@ -99,7 +99,8 @@
apr_file_t *file_start_revision;
/* The path and APR file handle to the temporary file that contains the
- second repository version */
+ second repository version. These fields are set when processing textdelta and
+ file deletion, and will be NULL if there's no textual difference to the file. */
svn_stringbuf_t *path_end_revision;
apr_file_t *file_end_revision;
@@ -571,7 +572,10 @@
{
struct file_baton *b = file_baton;
- SVN_ERR (run_diff_cmd (b));
+ /* It is possible to have only change to properties, without textdelta
+ In this case no difference should be reported and no need to run diff. */
+ if (b->path_end_revision)
+ SVN_ERR (run_diff_cmd (b));
svn_pool_destroy (b->pool);
Index: ./subversion/tests/clients/cmdline/diff_tests.py
===================================================================
--- ./subversion/tests/clients/cmdline/diff_tests.py
+++ ./subversion/tests/clients/cmdline/diff_tests.py Mon Jan 28 18:38:43 2002
@@ -621,6 +621,33 @@
return 0
+# test 10
+def diff_only_property_change(sbox):
+ "diff when property was changed but text was not"
+
+ if sbox.build():
+ return 1
+
+ wc_dir = sbox.wc_dir
+
+ current_dir = os.getcwd();
+ os.chdir(sbox.wc_dir);
+
+ svntest.main.run_svn(None, 'propset', 'svn:eol-style', 'none', "iota")
+ svntest.main.run_svn(None, 'ci')
+
+ result = 0
+
+ if os.system(svntest.main.svn_binary + " diff -r1:2"):
+ result = 1
+
+ if not result and os.system(svntest.main.svn_binary + " diff -r2:1"):
+ result = 1
+
+ os.chdir(current_dir)
+ return result
+
+
########################################################################
# Run the tests
@@ -636,8 +663,9 @@
diff_non_recursive,
diff_repo_subset,
diff_non_version_controlled_file,
- diff_pure_repository_update_a_file
- ]
+ diff_pure_repository_update_a_file,
+ diff_only_property_change
+ ]
if __name__ == '__main__':
svntest.main.run_tests(test_list)
Regards,
Vladimir
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn diff segfault [PATCH]
Posted by Karl Fogel <kf...@newton.ch.collab.net>.
Applied the patch, Vladimir; looked good, & the regression test
properly failed before the fix and passed afterwards :-). Thanks!
Is `msu.ru' Moscow State University? I stayed at your campus in early
September, it was beautiful...
-Karl
Vladimir Prus <gh...@cs.msu.su> writes:
> Changed.
>
> Log message:
> The 'diff' command no longer crashes when two revisions of a file differ in
> properties but not in text.
>
> * subversion/libsvn_client/repos_diff.c
>
> (close_file): Check for presence of any change to report was added.
>
> * subversion/tests/clients/cmdline/diff_tests.py
>
> (diff_only_property_change): New function.
>
> Patch:
> Index: ./subversion/libsvn_client/repos_diff.c
> ===================================================================
> --- ./subversion/libsvn_client/repos_diff.c
> +++ ./subversion/libsvn_client/repos_diff.c Mon Jan 28 18:36:42 2002
> @@ -99,7 +99,8 @@
> apr_file_t *file_start_revision;
>
> /* The path and APR file handle to the temporary file that contains the
> - second repository version */
> + second repository version. These fields are set when processing textdelta and
> + file deletion, and will be NULL if there's no textual difference to the file. */
> svn_stringbuf_t *path_end_revision;
> apr_file_t *file_end_revision;
>
> @@ -571,7 +572,10 @@
> {
> struct file_baton *b = file_baton;
>
> - SVN_ERR (run_diff_cmd (b));
> + /* It is possible to have only change to properties, without textdelta
> + In this case no difference should be reported and no need to run diff. */
> + if (b->path_end_revision)
> + SVN_ERR (run_diff_cmd (b));
>
> svn_pool_destroy (b->pool);
>
> Index: ./subversion/tests/clients/cmdline/diff_tests.py
> ===================================================================
> --- ./subversion/tests/clients/cmdline/diff_tests.py
> +++ ./subversion/tests/clients/cmdline/diff_tests.py Mon Jan 28 18:38:43 2002
> @@ -621,6 +621,33 @@
>
> return 0
>
> +# test 10
> +def diff_only_property_change(sbox):
> + "diff when property was changed but text was not"
> +
> + if sbox.build():
> + return 1
> +
> + wc_dir = sbox.wc_dir
> +
> + current_dir = os.getcwd();
> + os.chdir(sbox.wc_dir);
> +
> + svntest.main.run_svn(None, 'propset', 'svn:eol-style', 'none', "iota")
> + svntest.main.run_svn(None, 'ci')
> +
> + result = 0
> +
> + if os.system(svntest.main.svn_binary + " diff -r1:2"):
> + result = 1
> +
> + if not result and os.system(svntest.main.svn_binary + " diff -r2:1"):
> + result = 1
> +
> + os.chdir(current_dir)
> + return result
> +
> +
>
> ########################################################################
> # Run the tests
> @@ -636,8 +663,9 @@
> diff_non_recursive,
> diff_repo_subset,
> diff_non_version_controlled_file,
> - diff_pure_repository_update_a_file
> - ]
> + diff_pure_repository_update_a_file,
> + diff_only_property_change
> + ]
>
> if __name__ == '__main__':
> svntest.main.run_tests(test_list)
>
>
> Regards,
> Vladimir
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: dev-help@subversion.tigris.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org