From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 21732 invoked from network); 20 Aug 1998 07:33:39 -0000 Received: from dot.cygnus.com (205.180.230.224) by mail2.redhat.com with SMTP; 20 Aug 1998 07:33:39 -0000 Received: (from rth@localhost) by dot.cygnus.com (8.8.7/8.8.7) id AAA11481; Thu, 20 Aug 1998 00:33:24 -0700 Message-ID: <19980820003324.G11405@dot.cygnus.com> Date: Thu, 20 Aug 1998 00:33:24 -0700 From: Richard Henderson To: axp-list@redhat.com, Quant-X Alpha Linux Support Cc: redhat-devel-list@redhat.com Subject: Re: fclose() - still broken? Reply-To: Richard Henderson References: <35D95C14.8EAE66D6@voicenet.com> <19980819140059.A32620@caffeine.ix.net.nz> <199808190250.EAA04909@stefan.sime.com> <19980820121206.A418@caffeine.ix.net.nz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.91.1 In-Reply-To: <19980820121206.A418@caffeine.ix.net.nz>; from Chris Wedgwood on Thu, Aug 20, 1998 at 12:12:06PM +1200 On Thu, Aug 20, 1998 at 12:12:06PM +1200, Chris Wedgwood wrote: > > rc = read(0, NULL, 10); > > > > returns 6 here (Linux 2.1.113 i586) (no errno, no core) > > when entering "hello" > > > > Is this valid, or not ? ;-0 Yes, but... > A stickier question is what happens you you try to read a 10 byte > file using read(fd,&buffer,8192) when the buffer is only 4k is size. > > 2.0.x will return EFAULT because it knows the entire range is not > valid (the high 4k is bad), but 2.1.x will succeed because it can > read 10 bytes without failing. > > Which is correct? (Btw, different OSs take one or other approach). Both are correct, as you are walking in areas that are officially undefined. As surprising as it might be, it is not required that a system detect and return EFAULT. I personally feel that it is a quality of implementation detail that we do so. It would also be interesting to send SIGSEGV instead and find out how many programs are buggy. Unfortunately, not all of the code rearrangements that are necessary to propogate back EFAULT were done, and so will now have to be delayed until 2.3. r~