Bug 57792

Summary: mailcheck code is wrong in bash
Product: [Retired] Red Hat Linux Reporter: Rick Richardson <rickrich>
Component: bashAssignee: Bernhard Rosenkraenzer <bero>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 7.2   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-12-27 17:02:11 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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: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):


How reproducible:
Always

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)
            continue;
 
          /* 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
customer,
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!