Subject: Ignoring HUP at close

From: Joe Brennan <[email-masked]>
Date: Wed, 15 May 96 17:37:33 EDT

With the installation of 3.93 here, we find several stuck pine
processes per day.  We have finally reproduced the problem, and found
a puzzling section of code that causes it.

To reproduce it, I open a telnet session to our SunOS host and run
pine.  I mark a message deleted.  I use Q to quit and when pine asks
whether I want to quit I type Y.  Then I close the telnet session
*giving no answer to the next prompt* which is the one about whether to
expunge the deleted messages, and not logging out either.

This leaves pine doing goodnight_gracey and waiting for the answer to
the expunge question.  We notice that pine ignores HUP at this point,
which is why the pine session does not close :

pine.c

    /* committed to exiting so become unreceptive to HUP */
    end_sighup();

    /* clean up open streams */
    if(pine_state->mail_stream)
      expunge_and_close(pine_state->mail_stream, pine_state->context_current,
                        pine_state->cur_folder,
                        (!pine_state->inbox_stream || cur_is_inbox)
                          ? &final_msg : NULL);

so it looks like this with gdb :

#0  0xef789010 in select ()
#1  0xe012c in check_for_timeout (time_out=600) at ttyin.c:708
#2  0xe0574 in read_char (time_out=600) at ttyin.c:835
#3  0xd910c in radio_buttons (
    prompt=0x22bb98 "Expunge the 2 deleted messages from \"INBOX\"? ",
    line=-3, esc_list=0x1f5960, dflt=121, on_ctrl_C=0, help_text=0x0, flags=0)
    at status.c:1082
#4  0xd87e4 in want_to (
    question=0xeffff238 "Expunge the 2 deleted messages from \"INBOX\"",
    dflt=121, on_ctrl_C=0, help=0x0, display_help=0, flush=0) at status.c:864
#5  0x7666c in expunge_and_close (stream=0x214b70, context=0x214088,
    folder=0x21281c "INBOX", final_msg=0xeffff404) at mailcmd.c:3880
#6  0xb5b3c in goodnight_gracey (pine_state=0x212790, exit_val=0)
    at pine.c:2146
#7  0xb5a70 in quit_screen (pine_state=0x212790) at pine.c:2112
#8  0xb2968 in main (argc=1, argv=0xeffffb64) at pine.c:866

Ultimately it starts checking for new mail again because it is idle,
but it never quits.

We suggest that expunge_and_close needs to see HUP and do a safe
default action (save without expunging for example) and close up.

Can we get an official fix for this?  Isn't this a problem everywhere?

Note, our version is 3.93L as suggested for locally modified versions,
but none of the functions called here have been changed.

Joseph Brennan     Academic Information Systems
                   Columbia University in the City of New York
                   [email-masked]