Configuration Information [Automatically generated, do not change]: Machine: i686 OS: linux-gnu Compiler: i686-pc-linux-gnu-gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib -DDEFAULT_PATH_VALUE='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' -DSTANDARD_UTILS_PATH='/bin:/usr/bin:/sbin:/usr/sbin' -DSYS_BASHRC='/etc/bash/bashrc' -DSYS_BASH_LOGOUT='/etc/bash/bash_logout' -DNON_INTERACTIVE_LOGIN_SHELLS -DSSH_SOURCE_BASHRC -O2 -march=prescott -pipe -fomit-frame-pointer -fno-ident uname output: Linux limbic 2.6.27-gentoo-r10 #1 SMP Sat Jul 18 20:29:28 CDT 2009 i686 Intel(R) Core(TM)2 Quad CPU Q9550 @ 2.83GHz GenuineIntel GNU/Linux Machine Type: i686-pc-linux-gnu
Bash Version: 4.0 Patch Level: 35 Release Status: release Description: There is a regression in the mail checking behavior where bash now unconditionally reports that there is mail in a checked mailbox $MAILCHECK seconds after bash is initially started. Repeat-By: Start an interactive shell setting the MAIL environment variable to an existing, non-empty mail file in .bashrc. For example: MAIL=/var/mail/foo After $MAILCHECK seconds (default: 60) after the shell is started, do any short command (a good one would be 'sleep $MAILCHECK' and the message: You have mail in /var/mail/foo Will appear. While this is technically correct (there is mail in /var/mail/foo), I am not sure that the shell really should be reporting this fact shortly after startup. This behavior also differs from the shell's previous behavior. Fix: This appears to be a regression in mailcheck.c resulting from the following issue (from CHANGES): u. Fixed the initialization of mailboxes to not cause maildirs to be read (and stat(2) called for every message file) at shell startup. While the maildirs are no longer stat(2)'d upon startup, the struct containing the mail file information is not valid...so as soon as $MAILCHECK seconds lapse, and stat *is* called for all of the mail files with valid file date/size information (that differs from the valid information that was just read), the shell interprets this as a change in the mail file, and the mail status message is displayed. I believe that the flag MBOX_INITIALIZED was intended to be used to detect this situation, and therefore the fix (patch below) uses that flag as I understand its definition. While the flag was set, there is nothing checking it. The patch below simply adds this check, and calls the update_mail_file() function (that does the stat, initializes the struct, and sets MBOX_INITIALIZED). --- mailcheck.c.ORIG 2009-01-04 13:32:37.000000000 -0600 +++ mailcheck.c 2009-12-22 16:48:08.000000000 -0600 @@ -429,6 +429,11 @@ { int file_is_bigger; + if (!(mailfiles[i]->flags & MBOX_INITIALIZED)) { + update_mail_file (i); + continue; + } + use_user_notification = mailfiles[i]->msg != (char *)NULL; message = mailfiles[i]->msg ? mailfiles[i]->msg : _("You have mail in $_");