delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/07/23/06:08:55

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Fri, 23 Jul 2010 12:08:39 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: 1.7.5+: Bug in write() handling of 'disk full' condition? (XP)
Message-ID: <20100723100839.GI8324@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <AANLkTinoCTcs_bndrSDZ-ixE1PTCIp6_lwA5mvI7k1Be AT mail DOT gmail DOT com>
MIME-Version: 1.0
In-Reply-To: <AANLkTinoCTcs_bndrSDZ-ixE1PTCIp6_lwA5mvI7k1Be@mail.gmail.com>
User-Agent: Mutt/1.5.20 (2009-06-14)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On Jul 22 17:42, Catalin Patulea wrote:
> Hi,
> 
> I'm running a Windows XP SP3 with NTFS drives and woefully little disk
> space.. I have ~200MB free on my D:\ drive. When I use write() with a
> buffer larger than my available disk space, the return value is bogus
> and sometimes larger than the buffer size I pass in (!). errno is not
> set. I believe this is due to incorrect STATUS_DISK_FULL handling in
> winsup/cygwin/fhandler.cc:
> 
>   if (!NT_SUCCESS (status))
>     {
>       if (status == STATUS_DISK_FULL && io.Information > 0)
>         goto written;
> [...]
> written:
>   return io.Information;
> }

I just examined the mailing list archives.  The code to handle
ERROR_DISK_FULL specially is > 11 years old.  Originally, if this error
occured, the function always returned with success.  My patch in 1999 to
return the written bytes only if they are > 0 was not overly helpful
either, apparently, nor was the translation into native NT literally.

I have no idea why this erroneous special handling of ERROR_DISK_FULL
has been added in the first place.

I *assume* there was some really good reason, but, hey, who on earth
needs *comments* in the code to explain what this code was supposed
to fix.  Not even the mailing list archives contain a hint.  Maybe
that was working around some Windows 9x bug, but since we're NT-only
now, I don't see a reason to keep this code in.

I applied a patch which simply removes the STATUS_DISK_FULL handling.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019