Red Hat Bugzilla – Bug 57792
mailcheck code is wrong in bash
Last modified: 2008-05-01 11:38:01 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.2.1) Gecko/20010901
Description of problem:
The code to check to see if you have new mail is wrong.
There is a logic error. The operator && was used when ||
should have been used. This error causes all shells to tell
you that you have new email, even after you have read the email.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Send yourself email. Wait 60 seconds.
2. On one xterm, press enter. You should see "you have mail"
3. Now, read your email (if mutt is running, hit any key)
4. On a second xterm, press enter. You will see "you have mail",
even though you have already read the email.
Actual Results: All shells report you have mail
Expected Results: You should only see the message until you read the
that, other shells should be silent.
Here is a patch to fix the problem
$ diff -u mailcheck.c.org mailcheck.c
--- mailcheck.c.org Sat Dec 22 19:33:35 2001
+++ mailcheck.c Sat Dec 22 19:33:47 2001
@@ -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)
/* If the mod time is later than the access time and the file
BTW, I reported this on the bash-bugs mailing list, but was met with resounding
silence. No replies either with or against me. Therefore, as a paying
I look to Redhat to make a local fix for this problem.
You're right, the patch surely looks correct. Added in 2.05a-4. Thanks!