From xemacs-m  Mon Dec 16 17:09:19 1996
Received: from altair.xemacs.org (steve@xemacs.miranova.com [206.190.83.19]) by xemacs.cs.uiuc.edu (8.8.3/8.8.3) with ESMTP id RAA27698 for <xemacs-beta@xemacs.org>; Mon, 16 Dec 1996 17:09:17 -0600 (CST)
Received: (from steve@localhost)
          by altair.xemacs.org (8.8.4/8.8.4)
	  id PAA32641; Mon, 16 Dec 1996 15:19:17 -0800
Sender: steve@xemacs.org
To: xemacs-beta@xemacs.org
Subject: Re: 0 length files on full disk (I'm glad this isn't a stupid question)
References: <199612161431.JAA21057@plg.uwaterloo.ca> 	<Pine.LNX.3.95.961216225608.2312C-100000@icemark.thenet.ch> 	<199612162129.QAA25599@plg.uwaterloo.ca> 	<199612162132.NAA08243@newman> <199612162148.QAA25846@plg.uwaterloo.ca>
X-Url: http://www.miranova.com/%7Esteve/
Mail-Copies-To: never
X-Face: #!T9!#9s-3o8)*uHlX{Ug[xW7E7Wr!*L46-OxqMu\xz23v|R9q}lH?cRS{rCNe^'[`^sr5"
 f8*@r4ipO6Jl!:Ccq<xoV[Qz2u8<8-+Vwf2gzJ44lf_/y9OaQ`@#Q65{U4/TC)i2`~/M&QI$X>p:9I
 OSS'2{-)-4wBnVeg0S\O4Al@)uC[pD|+
X-Attribution: sb
From: Steven L Baur <steve@miranova.com>
In-Reply-To: Dave Mason's message of Mon, 16 Dec 1996 16:48:19 -0500 (EST)
Mime-Version: 1.0 (generated by tm-edit 7.96)
Content-Type: text/plain; charset=US-ASCII
Date: 16 Dec 1996 15:19:16 -0800
Message-ID: <m2u3pm3wnf.fsf@altair.xemacs.org>
Lines: 57
X-Mailer: Red Gnus v0.72/XEmacs 19.15

>>>>> "Dave" == Dave Mason <dmason@plg.uwaterloo.ca> writes:

> William Perry writes:
>> Dave Mason writes:
Dave> >64K isn't a disk allocation unit, either.  If I fill up the disk so
Dave> there's only 32K left, I get the same behaviour: 64K works (and writes
Dave> 32K!!!), 64K+1 fails.  But cat sees the error.  Here's an example
Dave> (with the rc shell):
Dave> Sorry, I don't have FSF emacs installed, and 19.13 is gzipped up
Dave> because we're short of disk space (can you guess how I discovered this
Dave> problem in the first case? :-) so I can't easily try other versions.
Dave> 
William> Stallman recently mailed out a request to see if anybody else
William> was seein this problem to the emacs beta testers, so it seems
William> to be a bug we all have.

We use totally different code than Emacs 19.34.  If it's the same bug,
then we probably ported it.

Dave> Are we all using mmap for files?  64K does sound like a possible
Dave> MMU boundary.

64k is the default (and hardcoded) buffer size of an lstream (what we
do all fileio through), so it make perfect sense to me.

Dave> (The wily people just finished flirting with mmap, but have backed
Dave> away (I haven't the slightest idea why (no irony intended)).)

I've taken a look through the code, and both Lstream_write and
Lstream_write_1 look like they may contain problems.  This code in
Lstream_write looks particularly suspect:

int
Lstream_write (Lstream *lstr, CONST void *data, int size)
{
  int i;
  CONST unsigned char *p = data;

  assert (size >= 0);
  if (size == 0)
    return size;
  if (lstr->buffering != LSTREAM_LINE_BUFFERED)
    return Lstream_write_1 (lstr, data, size);
  for (i = 0; i < size; i++)
    {
      if (Lstream_putc (lstr, p[i]) < 0)
        break;                              <=================
    }
  return i == 0 ? -1 : 0;                   <=================
}

This appears not to return error if up to 64k bytes could be buffered.
-- 
steve@miranova.com baur
Unsolicited commercial e-mail will be billed at $250/message.
"That Bill Clinton.  He probably doesn't know how to log on to the
Internet."  -- Rush Limbaugh, noted Computer Expert

