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 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: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , 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