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

Re: Unsure as to what an error message is really telling me

From: James Van Artsdalen <james_at_jrv.org>
Date: 2003-10-19 22:41:40 CEST

The two changes at the end are sufficient to fix my sighting of the
same bug Richard saw. My case also involved a write to stdout.

The WriteFile () call in Windows is documented to fail in some cases
if more than 32 KB is written. This appear to be another such case,
either undocumented or a simple bug (I'm running Windows XP SP1).

The SVN change shown at the end is needed in any case.

The APR change is an example not intended as a solution. It probably
ought to be reworked into a small-chunk loop if the initial WriteFile ()
call fails with ERROR_NOT_ENOUGH_MEMORY.

From: James Van Artsdalen <james@bigtex.jrv.org>
To: Ben Collins-Sussman <sussman@collab.net>
Subject: Re: Unsure as to what an error message is really telling me

I think that apr_file_write () is a bug: it should be
apr_file_write_full (), and hunk_len should be checked after the call
to see if it all got written.

I can reproduce this error in Windows but don't know what causes it yet.

From: Ben Collins-Sussman <sussman@collab.net>
Date: 09 Oct 2003 21:50:18 -0500
Subject: Unsure as to what an error message is really telling me

"Hensley, Richard" <Richard.Hensley@McKesson.com> writes:

> I get the following message when I execute a diff command:
>
> wc $svn diff -r 127:128 Staff.java
> Index: Staff.java
> ===================================================================
> --- Staff.java (revision 127)
> +++ Staff.java (revision 128)
> @@ -36,1724 +36,1731 @@
> svn: Not enough storage is available to process this command.
> svn: svn_diff_file_output_unified: error writing hunk

Never seen this before. The error is happening in the internal
libsvn_diff library, line 571:

  /* Output the hunk content */
  hunk_len = baton->hunk->len;
  rv = apr_file_write(baton->output_file, baton->hunk->data, &hunk_len);
  if (rv != APR_SUCCESS)
    {
      return svn_error_create(rv, NULL,
               "svn_diff_file_output_unified: error writing hunk.");
    }

So it looks like the first error line is a message from the operating
system itself; it's coming from the apr_file_write() call.

Do you have any idea why your OS would say there's "not enough
storage" to write data to a temporary file?

Index: apr/file_io/win32/readwrite.c
===================================================================
*** apr/file_io/win32/Backup/readwrite.c Wed Apr 30 20:16:30 2003
--- apr/file_io/win32/readwrite.c Sat Oct 18 08:07:54 2003
***************
*** 325,330 ****
--- 325,332 ----
                  thefile->pOverlapped->Offset = (DWORD)thefile->filePtr;
                  thefile->pOverlapped->OffsetHigh = (DWORD)(thefile->filePtr >> 32);
              }
+ if (*nbytes > 32768)
+ *nbytes = 32768;
              rv = WriteFile(thefile->filehand, buf, *nbytes, &bwrote,
                             thefile->pOverlapped);
              if (thefile->append) {

Index: subversion/libsvn_diff/diff_file.c
===================================================================
*** subversion/libsvn_diff/diff_file.c (revision 7373)
--- subversion/libsvn_diff/diff_file.c (working copy)
***************
*** 564,571 ****

    /* Output the hunk content */
    hunk_len = baton->hunk->len;
! rv = apr_file_write(baton->output_file, baton->hunk->data, &hunk_len);
! if (rv != APR_SUCCESS)
      {
        return svn_error_create(rv, NULL,
                 "svn_diff_file_output_unified: error writing hunk.");
--- 564,571 ----

    /* Output the hunk content */
    hunk_len = baton->hunk->len;
! rv = apr_file_write_full(baton->output_file, baton->hunk->data, baton->hunk->len, &hunk_len);
! if (rv != APR_SUCCESS || hunk_len != baton->hunk->len)
      {
        return svn_error_create(rv, NULL,
                 "svn_diff_file_output_unified: error writing hunk.");

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Oct 19 22:52:46 2003

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.