RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1172119 - packagekit-background.cron sends empty body emails causing anacron to send error message from mail program.
Summary: packagekit-background.cron sends empty body emails causing anacron to send er...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: PackageKit
Version: 6.7
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Richard Hughes
QA Contact: Desktop QE
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-12-09 12:37 UTC by Eskil Brun
Modified: 2015-07-22 06:59 UTC (History)
3 users (show)

Fixed In Version: PackageKit-0.5.8-25.el6
Doc Type: Bug Fix
Doc Text:
Previously, when MAILTO recipients were set in the /etc/sysconfig/packagekit-background file, the /etc/cron.daily/packagekit-background.cron script only checked for the return value from the pkcon command before trying to send email reports. As a consequence, two unnecessary empty emails were sent under certain circumstances. With this update, the $PKTMP file is not attempted to be sent by email if the files is empty, and only emails with useful information are now sent in the described scenario.
Clone Of:
Environment:
Last Closed: 2015-07-22 06:59:32 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
patch to ensure that the $PKTMP file is not attempted to be sent by mail if the files is empty (702 bytes, patch)
2014-12-09 12:37 UTC, Eskil Brun
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:1352 0 normal SHIPPED_LIVE PackageKit bug fix update 2015-07-20 17:59:39 UTC

Description Eskil Brun 2014-12-09 12:37:32 UTC
Created attachment 966217 [details]
patch to ensure that the $PKTMP file is not attempted to be sent by mail if the files is empty

Description of problem:

When setting MAILTO recipients in /etc/sysconfig/packagekit-background /etc/cron.daily/packagekit-background will only check for the return value from the pkcon command before trying to send email reports. In the case that the pkcon has not output any message(s) to the temporary file named by $PKTMP in the script, the mail command is invoked trying to send a null message body as a report. Anacron will also send a mail with the warning from the mail command, " 
Null message body; hope that's ok".

In short, if MAILTO is set in /etc/sysconfig/packagekit-background and if pkcon returns anything else but return value 5 (nothing useful done) and at the same time does not output any warnings or error messages, two unneccessary emails are sent. 

Version-Release number of selected component (if applicable):

PackageKit-cron-0.5.8-23.el6.x86_64

How reproducible:
Daily.

Steps to Reproduce:
1. Set MAILTO in /etc/sysconfig/packagekit-background
2. Wait
3. Two emails are sent, from /etc/cron.daily/packagekit-background and anacron. None of these carry any useful information.

Actual results:
Useless unneccessary emails are sent

Expected results:
Only email with useful info should be sent from /etc/cron.daily/packagekit-background.cron

Additional info:

patch to use bash built-in test -s to check if $PKTMP actually contains information:

--- /etc/cron.daily/packagekit-background.cron	2014-05-20 15:31:02.000000000 +0200
+++ /etc/cron.daily/packagekit-background.cron.fix	2014-12-09 13:13:48.067878542 +0100
@@ -36,13 +36,16 @@
 
 # this is when seomthing useful was done
 if [ $PKCON_RETVAL -ne 5 ]; then
+    # Do we actually have something to report? Is $PKTMP non-empty?
+    if [ -s $PKTMP ]; then 
 	# send email
 	if [ -n "$MAILTO" ]; then
-		mail -s "System updates available: $SYSTEMNAME" $MAILTO < $PKTMP
+	    mail -s "System updates available: $SYSTEMNAME" $MAILTO < $PKTMP
 	else
 		# default behavior is to use cron's internal mailing of output from cron-script
-		cat $PKTMP
+	    cat $PKTMP
 	fi
+    fi
 fi

Comment 2 Richard Hughes 2014-12-09 13:39:38 UTC
Seems logical enough to me.

Comment 5 Ladislav Kolacek 2015-04-07 17:10:04 UTC
I found and filled new similar bug: https://bugzilla.redhat.com/show_bug.cgi?id=1206196

Comment 7 errata-xmlrpc 2015-07-22 06:59:32 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-1352.html


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