Bug 178580 - /etc/sysconfig/spamassasin loses file context and timestamp
/etc/sysconfig/spamassasin loses file context and timestamp
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: spamassassin (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Warren Togami
Depends On:
Blocks: 171491
  Show dependency treegraph
Reported: 2006-01-21 17:53 EST by Warren Togami
Modified: 2007-11-30 17:07 EST (History)
6 users (show)

See Also:
Fixed In Version: RHSA-2006-0543
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2006-06-06 13:54:36 EDT
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-2006:0543 normal SHIPPED_LIVE Moderate: spamassassin security update 2006-06-06 00:00:00 EDT

  None (edit)
Description Warren Togami 2006-01-21 17:53:37 EST
QA discovered that /etc/sysconfig/spamassasin is being replaced during every
package intallation or upgrade.

# -a and --auto-whitelist options were removed from 3.0.0
# prevent service startup failure
perl -p -i -e 's/(["\s]-\w+)a/$1/ ; s/(["\s]-)a(\w+)/$1$2/ ; s/(["\s])-a\b/$1/'
perl -p -i -e 's/ --auto-whitelist//' /etc/sysconfig/spamassassin

Since FC3 spamassassin.spec %post contained this to remove user added options
during an upgrade from pre-3.0 SA that caused the new version to fail.  QA
discovered that this perl syntax actually creates another file and deletes the
original file.  This means that even if no change happens, the file has a
different timestamp and selinux security context.

Not much, but it should be fixed some time in the future.

This probably involves testing before doing the modification in order to avoid
an unnecessary replacement.  In the replacement case chcon is needed in order to
maintain the correct selinux context.
Comment 2 Warren Togami 2006-05-09 18:02:58 EDT
Proposed fix to spamassassin.spec:

@@ -127,8 +129,13 @@

 # -a and --auto-whitelist options were removed from 3.0.0
 # prevent service startup failure
-perl -p -i -e 's/(["\s]-\w+)a/$1/ ; s/(["\s]-)a(\w+)/$1$2/ ; s/(["\s])-a\b/$1/'
-perl -p -i -e 's/ --auto-whitelist//' /etc/sysconfig/spamassassin
+TMPFILE=$(/bin/mktemp /etc/sysconfig/spamassassin.XXXXXX) || exit 1
+cp /etc/sysconfig/spamassassin $TMPFILE
+perl -p -i -e 's/(["\s]-\w+)a/$1/ ; s/(["\s]-)a(\w+)/$1$2/ ; s/(["\s])-a\b/$1/'
+perl -p -i -e 's/ --auto-whitelist//' $TMPFILE
+# replace /etc/sysconfig/spamassassin only if it actually changed
+cmp /etc/sysconfig/spamassassin $TMPFILE || cp $TMPFILE /etc/sysconfig/spamassassin

 if [ -f /etc/spamassassin.cf ]; then
        %{__mv} /etc/spamassassin.cf /etc/mail/spamassassin/migrated.cf
Comment 6 Red Hat Bugzilla 2006-06-06 13:54:36 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.


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