You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Erik Huelsmann <eh...@gmail.com> on 2005/08/19 22:41:22 UTC

[PATCH] Fix loop termination in apr_file_write

Sometimes Subversion ends in an unterminated loop when checking out to
a full device. Looking at the Windows and OS/2 code, the unix code
seems to be missing a line which changes the loop termination variable
rv.

I promissed Karl Fogel a reproduction recipe, but didn't succeed in
creating one. OTOH, I think it's clear the line needs changing...


bye,


Erik.

PS: it's a patch against trunk. I can supply one for all branches,
because I would very much like it to be backported to 0.9.x, but the
change is so trivial I think using merge is faster....

Index: file_io/unix/readwrite.c
===================================================================
--- file_io/unix/readwrite.c    (revision 233542)
+++ file_io/unix/readwrite.c    (working copy)
@@ -170,7 +170,7 @@
         rv = 0;
         while (rv == 0 && size > 0) {
             if (thefile->bufpos == APR_FILE_BUFSIZE)   /* write
buffer is full*/
-                apr_file_flush(thefile);
+                rv = apr_file_flush(thefile);
  
             blocksize = size > APR_FILE_BUFSIZE - thefile->bufpos ?
                         APR_FILE_BUFSIZE - thefile->bufpos : size;

Re: [PATCH] Fix loop termination in apr_file_write

Posted by Joe Orton <jo...@redhat.com>.
On Sun, Aug 21, 2005 at 04:36:51PM +0200, Erik Huelsmann wrote:
> On 8/20/05, Joe Orton <jo...@redhat.com> wrote:
> 
> > > I promissed Karl Fogel a reproduction recipe, but didn't succeed in
> > > creating one. OTOH, I think it's clear the line needs changing...
> > 
> > I've committed this with a test case (trying to write to a file which
> > was opened read-only), thanks Erik.
> 
> Welcome.
> 
> Given that this is not only a problem for Subversion clients, but also
> for mod_dav_svn and svnserve servers [which are short on /tmp disc
> space for example], I'd like to ask for a backport to 0.9.x and a

Yes, sure - there are a couple of other places where the 
apr_file_flush() return value is ignored in the same file - I'd like to 
fix those too, just need to write some more test cases first.

joe

Re: [PATCH] Fix loop termination in apr_file_write

Posted by Erik Huelsmann <eh...@gmail.com>.
On 8/20/05, Joe Orton <jo...@redhat.com> wrote:

> > I promissed Karl Fogel a reproduction recipe, but didn't succeed in
> > creating one. OTOH, I think it's clear the line needs changing...
> 
> I've committed this with a test case (trying to write to a file which
> was opened read-only), thanks Erik.

Welcome.

Given that this is not only a problem for Subversion clients, but also
for mod_dav_svn and svnserve servers [which are short on /tmp disc
space for example], I'd like to ask for a backport to 0.9.x and a
0.9.7 release (somewhere in the not-too-far-off future).

bye,


Erik.

Re: [PATCH] Fix loop termination in apr_file_write

Posted by Joe Orton <jo...@redhat.com>.
On Fri, Aug 19, 2005 at 10:41:22PM +0200, Erik Huelsmann wrote:
> Sometimes Subversion ends in an unterminated loop when checking out to
> a full device. Looking at the Windows and OS/2 code, the unix code
> seems to be missing a line which changes the loop termination variable
> rv.
> 
> I promissed Karl Fogel a reproduction recipe, but didn't succeed in
> creating one. OTOH, I think it's clear the line needs changing...

I've committed this with a test case (trying to write to a file which 
was opened read-only), thanks Erik.

joe