Hello Stephen.

Stephen Isard wrote in
 <[email protected]>:
 |Here is a complete session where I
 |
 |1. Began a message with the word "Before"
 |2. Entered ed as an external editor and added the line "During"
 |3. Waited a long time
 |4. Did a date stamp from within the editor, then saved and exited
 |5. Got an IMAP write error
 |6. Did ~p to see that the message only contained the "Before" line

Cannot reproduce this.

 |7. Still within the message, did an external shell command to see that
 |  there was a file /tmp/s-nailblahblah with the same date stamp as
 |  when I left the editor.
 |8. Still within the message, did an external cat command to see that the
 |  file in /tmp contained      the "Before" and "During" lines.
 |9. Abandoned the message with `x
 |10. Tried to repeat the cat command on the /tmp file and found that
 |  it had been removed.
 |
 |So I am not accusing you of leaving files lying around in /tmp.  But it 
 |appears that they aren't immediately deleted on return to the s-nail 
 |command line after an IMAP write error, when the content of the /tmp 
 |file hasn't been read back into the message buffer.  Finishing the 
 |message appears to get the file cleaned away.

The compose mode is still active.

  ...
 |s-nail: IMAP write error: error:00000000:lib(0):func(0):reason(0)

May i mention that it likely should not look like this for the
[master] branch that includes the patch for the error you
reported?  Or where those errors washed away by terminal redraws?

  ...
 |
 |Before
 |~!ls -gG /tmp/s-nail*
 |-rw------- 1 14 Aug 30 16:12 /tmp/s-nail-edbaseUjFRoCne
 |!
 |(continue)
 |~!cat /tmp/s-nail-edbaseUjFRoCne
 |Before
 |During
 |!
 |(continue)
 |~x
 |s-nail: IMAP write error: Bad file descriptor

That all appears strange, Stephen.  We may have two files active
once you edit, but if the editor returns with a successful exit
status we replace the old with the new one, throwing away the old
one; otherwise we throw away the new one.  That is all the code
there is.

 |ERROR# & !cat /tmp/s-nail-edbaseUjFRoCne
 |cat: /tmp/s-nail-edbaseUjFRoCne: No such file or directory

So you could apply the patch below to the [master] branch.
My only idea would ... is that i do not have one.  Even if the
file system does not update the modification time, the file size
surely failed.

diff --git a/src/mx/cmd-edit.c b/src/mx/cmd-edit.c
index acd9d4e3ed..f7d1ead002 100644
--- a/src/mx/cmd-edit.c
+++ b/src/mx/cmd-edit.c
@@ -242,20 +242,32 @@ jetempo:
       cc.cc_args[0] = fstcp->fstc_filename;
    }

+fprintf(stderr, "PRE CHILD RUN cmd <%s>\n", cc.cc_cmd);
    if(!mx_child_run(&cc) || cc.cc_exit_status != 0)
+{
+fprintf(stderr, "BAD CHILD EXIT status %d err %d\n", 
cc.cc_exit_status,cc.cc_error);
       goto jleave;
+}
+fprintf(stderr, "GOOD CHILD EXIT\n");

    /* If in read only mode or file unchanged, just remove the editor temporary
     * and return.  Otherwise switch to new file */
    if(viored != '|'){
       if(readonly)
+{
+fprintf(stderr, "DISCARD EDIT, readonly\n");
          goto jleave;
+}
       if(stat(fstcp->fstc_filename, &statb) == -1){
+fprintf(stderr, "DISCARD EDIT, stat error\n");
          n_perr(fstcp->fstc_filename, 0);
          goto jleave;
       }
       if(modtime == statb.st_mtime && modsize == statb.st_size)
+{
+fprintf(stderr, "DISCARD EDIT, time unchanged\n");
          goto jleave;
+}
    }

    if((nf = mx_fs_open(fstcp->fstc_filename, "r+")) == NIL)


--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)

Reply via email to