bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Mail checking semantics broken between 2.05 and 2.05b


From: jim
Subject: Mail checking semantics broken between 2.05 and 2.05b
Date: Mon, 28 Oct 2002 13:46:50 -0500

Configuration Information [Automatically generated, do not change]:
Machine: i686
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' 
-DCONF_VENDOR='pc' -DSHELL -DHAVE_CONFIG_H  -I.  -I. -I./include -I./lib  -O3 
-fomit-frame-pointer -march=i686
uname output: Linux neurosis 2.4.18 #16 Sun Mar 17 02:34:39 EST 2002 i686 
unknown
Machine Type: i686-pc-linux-gnu

Bash Version: 2.05b
Patch Level: 0
Release Status: release

Description: 

        There was an undocumented logic flip in mailcheck.c
        between bash 2.05 and bash 2.05b which breaks mail checking.
        I'm guessing the change was made by someone who didn't fully
        understand its purpose and naïvely thought it was wrong.

        The old method said "Don't report new mail if the access time
        is greater than the modification time, AND the file hasn't
        grown."

        The new method says "Don't report new mail if the access time
        is greater than the modification time, OR the file hasn't
        grown."

        The reason why the latter is wrong: As the comments in
        mailcheck.c clearly state, there are some mail clients (such
        as Mutt) which merely update the access time, not the
        modification time, even when changing a mailbox.

        Now consider that I have a mailbox with 10 1kB messages.  I
        use Mutt to delete nine of them.  The modification time does
        not change, so the file_mod_date_changed() function returns
        zero, and so check_mail() skips over the file.  Therefore,
        mailfiles[i]->size is still 10k, because nothing changes it.
        When I _do_ get a new 1kB mail, then mailfiles[i]->size is
        2kB, and file_is_bigger is false -- and the new logic means
        the new mail is not reported.

Repeat-By:
        Set MAILCHECK=0 and put a mailbox in your MAILPATH.
        Send yourself lots of mail. 
        --> 2.05b will report new mail, just like 2.05.
        Delete most of them with Mutt.  
        --> 2.05b will not say anything, just like 2.05.
        Send yourself one new mail.
        --> 2.05b will not say anything.  2.05 will report new mail.

Fix:
--- mailcheck.c.orig    Thu Jan 10 14:23:15 2002
+++ mailcheck.c Mon Oct 28 13:27:44 2002
@@ -390,7 +390,7 @@
             the access time to be equal to the modification time when
             the mail in the file is manipulated, check the size also.  If
             the file has not grown, continue. */
-         if ((atime >= mtime) || !file_is_bigger)
+         if ((atime >= mtime) && !file_is_bigger)
            continue;
 
          /* If the mod time is later than the access time and the file




reply via email to

[Prev in Thread] Current Thread [Next in Thread]