Bug 21901 - diskcheck sends empty email if filesystem where tmp file is created fills up
Summary: diskcheck sends empty email if filesystem where tmp file is created fills up
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Powertools
Classification: Retired
Component: diskcheck
Version: 6.2
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Tim Powers
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2000-12-07 18:57 UTC by scot
Modified: 2008-05-01 15:37 UTC (History)
0 users

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2000-12-08 18:56:34 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2000:122 0 normal SHIPPED_LIVE : race condition exists in diskcheck 2000-12-01 05:00:00 UTC

Description scot 2000-12-07 18:57:03 UTC
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
full.

I'm not a perl programmer but if I have time, I might attempt to rewrite
diskcheck and post it here. 
-scot

Comment 1 Tim Powers 2000-12-07 21:57:32 UTC
I just put a package in http://people.redhat.com/timp/RPMS which fixes the
problem. Let me know if this works or not.

Tim

Comment 2 scot 2000-12-07 22:10:59 UTC
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 22:26:14 UTC
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.

Tim

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 22:42:06 UTC
the default...

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

-scot

Comment 5 scot 2000-12-07 22:48:19 UTC
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
sendmail-doc-8.10.1-3
sendmail-8.10.1-3
sendmail-cf-8.10.1-3

I built the perl 5.005 pkgs from RH 6.2 SRPMS via 'rpm --rebuild'
[root@rhwsa036 ~]# rpm -qa | grep perl
groff-perl-1.15-8
perl-DBI-1.07-2
perl-5.00503-11

-scot

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

That should do it.

Tim

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

Tim

Comment 8 scot 2000-12-08 18:56:31 UTC
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...
$mailto="root";

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



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