[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Strange patch application (Was: RE: problems with mimetype of and empty utf8 files in svn 1.7)

From: Bert Huijben <bert_at_qqmail.nl>
Date: Fri, 21 Oct 2011 13:35:34 +0200

> -----Original Message-----
> From: Stefan Sperling [mailto:stsp_at_elego.de]
> Sent: vrijdag 21 oktober 2011 13:27
> To: Bert Huijben
> Cc: 'Daniel Shahaf'; 'Tomáš Bihary'; dev_at_subversion.apache.org
> Subject: Re: problems with mimetype of and empty utf8 files in svn 1.7

> Can someone run this through the windows test suite, please? Thanks.
> I don't expect any test failures from this to arise on *nix.
> Manual testing on BSD with files that contain just the UTF-8 BOM
> suggests that the patch works fine.

I tried to apply this patch and found an issue in 'svn patch'

$ svn patch f:\bom-block.patch
U subversion\libsvn_subr\io.c

$ svn st
M subversion\libsvn_subr\io.c

$ svn diff
Index: subversion/libsvn_subr/io.c
===================================================================
--- subversion/libsvn_subr/io.c (revision 1186797)
+++ subversion/libsvn_subr/io.c (working copy)
@@ -2968,9 +2968,15 @@
   /* Now close the file. No use keeping it open any more. */
   SVN_ERR(svn_io_file_close(fh, pool));

+ if (amt_read == 3 && block[0] == 0xEF && block[1] == 0xBB && block[2] == 0xBF
)
+ {
+ /* This is an empty UTF-8 file which only contains the UTF-8 BOM.
+ * Treat it as plain text. */
+ return SVN_NO_ERROR;
+ }
+
   if (svn_io_is_binary_data(block, amt_read))
     *mimetype = generic_binary;
-
   return SVN_NO_ERROR;
 }

^^^ why is that blank line removed.

For the reproduction I added the exact patch file (with windows line endings) as text and zip attachment.

        Bert

Received on 2011-10-21 13:36:11 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.