Bug 57792 - mailcheck code is wrong in bash
mailcheck code is wrong in bash
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: bash (Show other bugs)
7.2
All Linux
medium Severity medium
: ---
: ---
Assigned To: Bernhard Rosenkraenzer
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-12-22 20:48 EST by Rick Richardson
Modified: 2008-05-01 11:38 EDT (History)
0 users

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


Attachments (Terms of Use)

  None (edit)
Description Rick Richardson 2001-12-22 20:48:29 EST
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-22 20:55:58 EST
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 08:29:20 EST
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.