You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2015/10/01 12:38:37 UTC

svn commit: r1706213 - in /subversion/trunk/subversion: libsvn_client/patch.c libsvn_diff/parse-diff.c

Author: rhuijben
Date: Thu Oct  1 10:38:37 2015
New Revision: 1706213

URL: http://svn.apache.org/viewvc?rev=1706213&view=rev
Log:
Following up on r1705080, fix a few more final-eol edge cases where different
read operations reported EOF at different times, resulting in content
mismatches.

* subversion/libsvn_client/patch.c
  (readline_prop,
   readline_symlink): Report EOF after the last line, not at the last line.

* subversion/libsvn_diff/parse-diff.c
  (hunk_readline_original_or_modified): Always report EOF after the last line,
    not only in final-eol mode.

Modified:
    subversion/trunk/subversion/libsvn_client/patch.c
    subversion/trunk/subversion/libsvn_diff/parse-diff.c

Modified: subversion/trunk/subversion/libsvn_client/patch.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/patch.c?rev=1706213&r1=1706212&r2=1706213&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/patch.c (original)
+++ subversion/trunk/subversion/libsvn_client/patch.c Thu Oct  1 10:38:37 2015
@@ -612,7 +612,7 @@ readline_prop(void *baton, svn_stringbuf
   while (c < b->value->data + b->value->len);
 
   if (eof)
-    *eof = found_eof;
+    *eof = found_eof && !(str && str->len > 0);
   *line = str;
 
   return SVN_NO_ERROR;
@@ -831,6 +831,7 @@ readline_symlink(void *baton, svn_string
       SVN_ERR(svn_subst_read_specialfile(&stream, sb->local_abspath,
                                          scratch_pool, scratch_pool));
       SVN_ERR(svn_stringbuf_from_stream(line, stream, len_hint, result_pool));
+      *eof = FALSE;
       sb->at_eof = TRUE;
     }
 
@@ -1686,8 +1687,6 @@ get_hunk_info(hunk_info_t **hi, patch_ta
                 {
                   svn_boolean_t file_matches;
 
-                  /* ### I can't reproduce anything but a no-match here.
-                         The content is already at eof, so any hunk fails */
                   SVN_ERR(match_existing_target(&file_matches, content, hunk,
                                             scratch_pool));
                   if (file_matches)

Modified: subversion/trunk/subversion/libsvn_diff/parse-diff.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_diff/parse-diff.c?rev=1706213&r1=1706212&r2=1706213&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_diff/parse-diff.c (original)
+++ subversion/trunk/subversion/libsvn_diff/parse-diff.c Thu Oct  1 10:38:37 2015
@@ -706,7 +706,7 @@ hunk_readline_original_or_modified(apr_f
       *stringbuf = svn_stringbuf_dup(str, result_pool);
     }
 
-  if (!filtered && *eof && !*eol && !no_final_eol && *str->data)
+  if (!filtered && *eof && !*eol && *str->data)
     {
       /* Ok, we miss a final EOL in the patch file, but didn't see a
          no eol marker line.
@@ -714,7 +714,7 @@ hunk_readline_original_or_modified(apr_f
          We should report that we had an EOL or the patch code will
          misbehave (and it knows nothing about no eol markers) */
 
-      if (eol != &eol_p)
+      if (!no_final_eol && eol != &eol_p)
         {
           apr_off_t start = 0;