jimb@dopey.AMD.COM (Jim Budler) (05/23/87)
These fixes are for an attempted unlink of a non existant system mailbox. (repeat by: enter elm when mailbox is non-existant, then change mailboxes. Core dump). Then after that fix, it just exits with an error message ENOENT, fixed with a check to see if the file is there. In screen.c removed unnecessary storage of start_highlight string. The fprint statement takes care of the arrow with xx? "->" : start_highlight instead. In utils/Makefile added check for $MAIL. Many csh users here only had $mail defined, so messages didn't work. $mail couldn't be used since it is often a multi-string variable, i.e.: set mail = (120 /usr/spool/mail/jimb /usr/spool/mail/root) ###################### BUG ALERT #################### SOMEWHERE weedlist[weedcount] is getting munged SOMETIMES!! I believe this is what is causing random segment core dumps on BSD systems. I haven't found that one yet. Yesterday I tracked it to that fprint statement in screen.c. Today it doesn't happen! AAAARGH! Repeat by: (yesterday, not today. maybe odd numbered days?) no $MAIL box # gone, not just empty. elm -f =file # an existing folder, with more than one message. <cr> first message (read it) COREDUMP dbx shows weedlist[] garbaged: weedlist[0] = "^B" weedlist[1] = "^A" weedlist[2] = "^A" or weedlist = 037703770377.... forever Happy tracking... *** /tmp/,RCSt1028534 Fri May 22 09:57:49 1987 --- src/leavembox.c Thu May 21 13:24:46 1987 *************** *** 243,248 error("New mail has just arrived - resyncing..."); return(-1); } unlink(infile); /* and BLAMO! */ if (to_save && (mbox_specified || pending)) { --- 243,249 ----- error("New mail has just arrived - resyncing..."); return(-1); } + if( infile != NULL) /* Only if there */ unlink(infile); /* and BLAMO! */ if (to_save && (mbox_specified || pending)) { *** /tmp/,RCSt1028534 Fri May 22 09:57:55 1987 --- src/newmbox.c Thu May 21 13:24:51 1987 *************** *** 166,177 if (switching_from_default) { /* we need to remove the tmp file */ sprintf(buff, "%s%s", temp_mbox, username); ! if (unlink(buff) != 0) { ! error1( ! "Sorry, but I can't seem to unlink your temp mail file [%s]\n\r", ! error_name(errno)); ! silently_exit(); ! } } clear_error(); --- 166,178 ----- if (switching_from_default) { /* we need to remove the tmp file */ sprintf(buff, "%s%s", temp_mbox, username); ! if (access(buff, ACCESS_EXISTS) != -1) /* not there if null mailbox */ ! if (unlink(buff) != 0) { ! error1( ! "Sorry, but I can't seem to unlink your temp mail file [%s]\n\r", ! error_name(errno)); ! silently_exit(); ! } } clear_error(); *** /tmp/,RCSt1028534 Fri May 22 09:58:00 1987 --- src/screen.c Fri May 22 09:49:15 1987 *************** *** 304,311 The key is that 'strncpy' returns a 'char *' to the string that it is handing to the dummy variable! Neat, eh? **/ ! char subj[LONG_SLEN], /* to output subject */ ! buff[NLEN]; /* keep start_highlight value */ if (strcmp(start_highlight,"->") != 0 && arrow_cursor) { strcpy(buff, start_highlight); --- 304,310 ----- The key is that 'strncpy' returns a 'char *' to the string that it is handing to the dummy variable! Neat, eh? **/ ! char subj[LONG_SLEN]; /* to output subject */ strncpy(subj, entry->subject, COLUMNS-45); *************** *** 307,317 char subj[LONG_SLEN], /* to output subject */ buff[NLEN]; /* keep start_highlight value */ - if (strcmp(start_highlight,"->") != 0 && arrow_cursor) { - strcpy(buff, start_highlight); - strcpy(start_highlight, "->"); - } - strncpy(subj, entry->subject, COLUMNS-45); subj[COLUMNS-45] = '\0'; /* insurance, eh? */ --- 306,311 ----- char subj[LONG_SLEN]; /* to output subject */ strncpy(subj, entry->subject, COLUMNS-45); subj[COLUMNS-45] = '\0'; /* insurance, eh? */ *************** *** 344,352 THIS rigorous either!!!) (to be honest, though, just looking at this statement makes me chuckle...) **/ - - if (arrow_cursor) /* restore! */ - strcpy(start_highlight, buff); } --- 338,343 ----- THIS rigorous either!!!) (to be honest, though, just looking at this statement makes me chuckle...) **/ } *** /tmp/,RCSt1028534 Fri May 22 09:58:05 1987 --- utils/Makefile Fri May 22 09:54:31 1987 *************** *** 83,88 @echo 'fi' >> ../bin/messages @echo ' ' >> ../bin/messages @echo 'if [ "$$1" = "" ]; then' >> ../bin/messages @echo ' fname=$$MAIL' >> ../bin/messages @echo ' optional="in your mailbox"' >> ../bin/messages @echo 'else' >> ../bin/messages --- 83,95 ----- @echo 'fi' >> ../bin/messages @echo ' ' >> ../bin/messages @echo 'if [ "$$1" = "" ]; then' >> ../bin/messages + @echo 'if [ "$$MAIL" = "" ]; then' >> ../bin/messages + @echo ' cat << EOGRIPE' >> ../bin/messages + @echo ' You have no MAIL environment variable defined!' >> ../bin/messages + @echo ' Make sure one is properly defined in your .cshrc or .login.' >> ../bin/messages + @echo 'EOGRIPE' >> ../bin/messages + @echo ' exit 2' >> ../bin/messages + @echo 'fi' >> ../bin/messages @echo ' fname=$$MAIL' >> ../bin/messages @echo ' optional="in your mailbox"' >> ../bin/messages @echo 'else' >> ../bin/messages -- I hate mud. I like blue clean flowing water. LA sucks water. That doesn't mean I like LA. (Actually, I like a lot of things in LA) + Jim Budler Advanced Micro Devices, Inc. (408) 749-5806 + + Compuserve: 72415,1200; Delphi: JIMBUDLER; Usenet: jimb@amdcad.AMD.COM +