At 02:20 +0200 13 Apr 2002, Rocco Rutte <[EMAIL PROTECTED]> wrote:
> > > The situation so far is that sending mail doesn't work because mutt
> > > does not show up again after returning from the editor (saving works).

> I've done that. Using 'strace' just give me:
> 
> [...]
> stat("/tmp/mutt-ganymed-9155-1", {st_mode=S_IFREG|0600, st_size=115, ...}) = 0
> open("/tmp/mutt-ganymed-9155-1", O_RDWR) = 4
> old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
>0x2aad2000
> unlink("/tmp/mutt-ganymed-9155-1")      = 0
> write(4, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 2047) = 2047
> 
> The last line is printed about 50.000 times within a couple of
> seconds.  Before this exerpt, to me it seems that  the  editor
> command was sucessful (mutt reports that the child has  quit).
> 
> Could  someone  explain/interpret  the  last  line?   I   have
> absolutely no idea what this could be and  how  to  solve  it.

Mutt is trying to overwrite the temporary file to provide some
protection against someone trying to recover the private data.  But in
your case it is looping over that.  This is happening in the mutt_unlink
function in lib.c:

      while (sb.st_size > 0)
      {
        fwrite (buf, 1, sizeof (buf), f);
        sb.st_size -= sizeof (buf);
      }

I don't know why this would happen with glibc, but with dietlibc the
st_size element of struct stat is unsigned, so unless it hits 0 exactly
the test will always succeed.

I think the attached patch should fix this problem.

-- 
Aaron Schrab     [EMAIL PROTECTED]      http://www.schrab.com/aaron/
 When we write programs that "learn", it turns out we do and they don't.
--- lib.c.dist  Sat Apr 13 11:39:40 2002
+++ lib.c       Sat Apr 13 11:46:51 2002
@@ -184,6 +184,8 @@
       while (sb.st_size > 0)
       {
        fwrite (buf, 1, sizeof (buf), f);
+       if (sb.st_size < sizeof (buf))
+         break;
        sb.st_size -= sizeof (buf);
       }
       fclose (f);

Reply via email to