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
Status: CLOSED CURRENTRELEASE
Product: Red Hat Powertools
Classification: Retired
Component: diskcheck (Show other bugs)
6.2
All Linux
low Severity medium
: ---
: ---
Assigned To: Tim Powers
:
Depends On:
Blocks:
  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:
Environment:
Last Closed: 2000-12-08 13:56:34 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 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
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 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.

Tim
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.

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 17:42:06 EST
the default...

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

-scot
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
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 17:50:13 EST
Shouldn't matter. Change the mailto to this: "root\@localhost"

That should do it.

Tim
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.

Tim
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...
$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.