Bug 57792 - mailcheck code is wrong in bash
Summary: mailcheck code is wrong in bash
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: bash   
(Show other bugs)
Version: 7.2
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Bernhard Rosenkraenzer
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2001-12-23 01:48 UTC by Rick Richardson
Modified: 2008-05-01 15:38 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2001-12-27 17:02:11 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

Description Rick Richardson 2001-12-23 01:48:29 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: 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):

How reproducible:

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
email.  After
that, other shells should be silent.

Additional info:

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

Comment 1 Rick Richardson 2001-12-23 01:55:58 UTC
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.

Comment 2 Bernhard Rosenkraenzer 2002-01-17 13:29:20 UTC
You're right, the patch surely looks correct. Added in 2.05a-4. Thanks!

Note You need to log in before you can comment on or make changes to this bug.