Bug 57792 - mailcheck code is wrong in bash
Summary: mailcheck code is wrong in bash
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: bash
Version: 7.2
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Bernhard Rosenkraenzer
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
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:
Clone Of:
Environment:
Last Closed: 2001-12-27 17:02:11 UTC
Embargoed:


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


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