Red Hat Bugzilla – Bug 70076
freopen/fseek/fgets problem in mutt for checking new mail
Last modified: 2016-11-24 10:08:08 EST
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:
* 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
$ cp foomail /var/spool/mail/rhguest
compose a new message to rhguest@localhost
send the message
10 sec later, mutt checks for new mail and ...error!
Bug still present in glibc-2.2.90-17 (limbo release).
Fixed in -21.