Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 21901 - diskcheck sends empty email if filesystem where tmp file is created fills up
diskcheck sends empty email if filesystem where tmp file is created fills up
Product: Red Hat Powertools
Classification: Retired
Component: diskcheck (Show other bugs)
All Linux
low Severity medium
: ---
: ---
Assigned To: Tim Powers
Depends On:
  Show dependency treegraph
Reported: 2000-12-07 13:57 EST by scot
Modified: 2008-05-01 11:37 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2000-12-08 13:56:34 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2000:122 normal SHIPPED_LIVE : race condition exists in diskcheck 2000-12-01 00:00:00 EST

  None (edit)
Description scot 2000-12-07 13:57:03 EST
Because of the way the perl script /etc/cron.hourly/diskcheck.pl is
written, by first creating a temp file and then emailing it, it will send
an empty email if the filesystem where the $tempfile is to be created fills
up.  In rpm versions prior to diskcheck-3.1.1-10.6x, the $tempfile was
created in /tmp.  If /tmp filled up, root received an empty email.

In the current rpm diskcheck-3.1.1-10.6x version, if /var were to fill up,
you'd also get an empty email.  

This is from /etc/diskcheck.conf:
# Location and name for a temp file
$tempfile = '/var/spool/cron/diskusagealert.txt';

Suggest instead of creating the $tempfile and then mailing it, create the
mail message in a local variable and then pipe that to the mail program. 
You'd do something like this in a shell bash script:

# existing code to determine what filesystem is what percent full.
#   ....
$msg = "The $filesystem is $percentage % full"
echo $msg | /bin/mail root

This should avoid the prior security issues with the $tempfile and allow
you get an informative email when a filesystem is nearing capacity or is

I'm not a perl programmer but if I have time, I might attempt to rewrite
diskcheck and post it here. 
Comment 1 Tim Powers 2000-12-07 16:57:32 EST
I just put a package in http://people.redhat.com/timp/RPMS which fixes the
problem. Let me know if this works or not.

Comment 2 scot 2000-12-07 17:10:59 EST
I installed your package, ran the following to fill up /var:

	# dd if=/dev/zero of=/var/bigfile

df now shows /var now at 100%

	# /etc/cron.hourly/diskcheck.pl
	No recipient addresses found in header

Comment 3 Tim Powers 2000-12-07 17:26:14 EST
What is your $mailto set to in /etc/diskchek.conf? I'm able to send the mail
just fine when doing a quick test as a regular user who doesn't have permission
to write to /var/spool.


PS- the reason I haven't tested with a full var is because it's taking a while
to fill it up for me. It will get tested though.
Comment 4 scot 2000-12-07 17:42:06 EST
the default...

# Who to mail to...
$mailto = "root";

Comment 5 scot 2000-12-07 17:48:19 EST
Might also mention I'm on a i386 RedHat 5.2 box with all the official RH
updates.  And if it makes any difference:

I build the sendmail pkgs from RH rawhide SRPMS via 'rpm --rebuild'

[root@rhwsa036 ~]# rpm -qa | grep sendmail

I built the perl 5.005 pkgs from RH 6.2 SRPMS via 'rpm --rebuild'
[root@rhwsa036 ~]# rpm -qa | grep perl

Comment 6 Tim Powers 2000-12-07 17:50:13 EST
Shouldn't matter. Change the mailto to this: "root\@localhost"

That should do it.

Comment 7 Tim Powers 2000-12-07 17:52:50 EST
Please let me know if the change in mailto makes it work and I'll change it in
the package.

Comment 8 scot 2000-12-08 13:56:31 EST
The problem is that when /var fills up completely (100%), sendmail has no room
to write to /var/spool/mail and it produces the "No recipient addresses found in
header" message.  You also don't get the email message either, obviously.  If
/var does not fill to 100%, diskcheck.pl functions correctly and you do get an
email when /var approaches capacity.

I'd suggest shipping the updated RPM (the one from
http://people.redhat.com/timp/RPMS/diskcheck-3.1.1-12.noarch.rpm ) with the
following in /etc/diskcheck.pl:

# Who to mail to...

Thanks alot for the speedy response on this low priority issue.   You guys Rock!
Have a great day Tim!

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