Bug 70076

Summary: freopen/fseek/fgets problem in mutt for checking new mail
Product: [Retired] Red Hat Raw Hide Reporter: Olivier Baudron <olivier.baudron>
Component: glibcAssignee: Jakub Jelinek <jakub>
Status: CLOSED RAWHIDE QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 1.0CC: fweimer
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2002-07-30 17:14:13 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 67217    

Description Olivier Baudron 2002-07-30 01:30:30 UTC
When mutt checks for new mail, it sometimes fails with error message:
"Mailbox was externally modified.  Flags may be wrong."
This happens about 10% of the times, but is deterministic for a given mailbox.
My config is quite simple: sendmail puts mail in /var/spool/mail/$USER (a mbox
mailbox) and mutt deals with this unique mailbox.

Downgrading to glibc-2.2.5-37 fixes the bug, which is present with
glibc-2.2.90-14 and -15 (I could not test any intermediate version).

In mutt-1.4i the problem occurs at:
mbox.c:
           /*
            * check to see if the content-length looks valid.  we expect to
            * to see a valid message separator at this point in the stream
            */
           if (fseek (ctx->fp, tmploc, SEEK_SET) != 0 ||
               fgets (buf, sizeof (buf), ctx->fp) == NULL ||
               mutt_strncmp ("From ", buf, 5) != 0)
           {

In this boolean expression, fseek works, but fgets fails with errno==2 (no such
file or directory). Also note, that there is freopen calls on this file. So in
fact, this is very similar to bug 67552 which caused another problem in mutt.

I could not extract a testcase to reproduce this bug outside mutt, so please ssh
on my rawhide box:

$ ssh -l rhguest baud.truffe.org
password: rhguest
$ cp foomail /var/spool/mail/rhguest
$ mutt
compose a new message to rhguest@localhost
send the message
10 sec later, mutt checks for new mail and ...error!

Comment 1 Olivier Baudron 2002-07-30 17:14:08 UTC
Bug still present in glibc-2.2.90-17 (limbo release).

Comment 2 Olivier Baudron 2002-08-15 13:50:03 UTC
Fixed in -21.