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

Re: [Issue 1789] large 'svn diff' fails on win32

From: Lieven Govaerts <svnlgo_at_mobsol.be>
Date: 2007-03-17 14:35:24 CET

dionisos@tigris.org wrote:
> http://subversion.tigris.org/issues/show_bug.cgi?id=1789
>
> ------- Additional comments from dionisos@tigris.org Thu Mar 15 15:56:14 -0700 2007 -------
> Created an attachment (id=629)
> Patch for Win32 to chunk large writes to console handles
>
>
Erik,

attached is an updated version of your patch. I tested with a 400kb hunk
and that worked ok.

One thing I'm not sure of is on what error messages we'll have to check.
When I run the test the error is ERROR_NOT_ENOUGH_MEMORY, which is one
of the two error messages MSDN lists as possible outcome of WriteFile,
the other being ERROR_INVALID_USER_BUFFER. I don't know where you got
the error message from that you used in your patch? I didn't find more
details about those error messages, maybe we should just check for all
of the three?

Lieven

Index: subversion/libsvn_subr/io.c
===================================================================
--- subversion/libsvn_subr/io.c (revision 23881)
+++ subversion/libsvn_subr/io.c (working copy)
@@ -2,7 +2,7 @@
  * io.c: shared file reading, writing, and probing code.
  *
  * ====================================================================
- * Copyright (c) 2000-2006 CollabNet. All rights reserved.
+ * Copyright (c) 2000-2007 CollabNet. All rights reserved.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -2700,8 +2700,29 @@
                        apr_size_t nbytes, apr_size_t *bytes_written,
                        apr_pool_t *pool)
 {
+ apr_status_t rv = apr_file_write_full(file, buf, nbytes, bytes_written);
+
+#ifdef WIN32
+#define MAXBUFSIZE 30*1024
+ if (rv == APR_FROM_OS_ERROR(ERROR_NOT_ENOUGH_MEMORY)
+ && nbytes > MAXBUFSIZE)
+ {
+ apr_size_t bw = 0;
+ *bytes_written = 0;
+
+ do {
+ rv = apr_file_write_full(file, buf,
+ nbytes > MAXBUFSIZE ? MAXBUFSIZE : nbytes, &bw);
+ *bytes_written += bw;
+ buf = (char *)buf + bw;
+ nbytes -= bw;
+ } while (rv == APR_SUCCESS && nbytes > 0);
+ }
+#undef MAXBUFSIZE
+#endif
+
   return do_io_file_wrapper_cleanup
- (file, apr_file_write_full(file, buf, nbytes, bytes_written),
+ (file, rv,
      N_("Can't write to file '%s'"),
      N_("Can't write to stream"),
      pool);

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Mar 17 14:35:44 2007

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