Bug 847338 - logrotate ignores create mode
logrotate ignores create mode
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: logrotate (Show other bugs)
All Linux
unspecified Severity low
: rc
: ---
Assigned To: Jan Kaluža
Tomas Dolezal
Depends On:
  Show dependency treegraph
Reported: 2012-08-10 11:25 EDT by Daniel Crisman
Modified: 2014-01-30 04:21 EST (History)
4 users (show)

See Also:
Fixed In Version: logrotate-3.7.8-17.el6
Doc Type: Bug Fix
Doc Text:
Cause: Setting the ACL on rotated log overwrote the previously set mode of the log file. Consequence: "create" directive was ignored. Fix: When "create" directive is used, ACL are not copied from old log file and mode defined using "create" directive is used instead. Result: "create" mode works like before and is not ignored.
Story Points: ---
Clone Of:
Last Closed: 2013-07-18 05:35:05 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Daniel Crisman 2012-08-10 11:25:33 EDT
Description of problem:
The mode in the directive 'create mode owner group' is ignored when
built with WITH_ACL.

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

How reproducible:

Steps to Reproduce:
echo -e 'weekly\nrotate 4\ncreate\ndateext\n\n"./a.log" {\n    create 0600\n}' > conf
echo -e 'logrotate state -- version 2\n"./a.log" 2000-8-9n' > state
rm -f a.log*
touch a.log
chmod 644 a.log
logrotate -v -s state conf
ls -l a.log*
Actual results:
# on RHEL Server 6.3
new a.log is mode 0644

Expected results:
# as it worked on RHEL Server 6.2 and before
new a.log is mode 0600

Additional info:
Caused by the ACL change from bug 683622

acl_set_fd on line 1266 overwrites the mode set in createOutputFile() on line 1259.

acl_set_fd really should be an alternate to fchmod on line 251 inside createOutputFile():
    #ifdef WITH_ACL
        # do acl_set_fd stuff
        # do fchmod
but that probably break other uses of createOutputFile().

Alternate solution to ACL issue would be to allow the mode in the create directive to be a mode (octal number) or acl text (see SHORT TEXT FORM in acl(5) to process with acl_from_text()).
Comment 2 Jan Kaluža 2012-08-13 08:06:32 EDT
Thanks for the report. I think patch I've just committed into logrotate repository should fix this issue. I have also added two tests to test the fix.

Comment 3 RHEL Product and Program Management 2012-09-07 01:12:06 EDT
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unable to address this
request at this time.

Red Hat invites you to ask your support representative to
propose this request, if appropriate, in the next release of
Red Hat Enterprise Linux.
Comment 4 Tim Mooney 2012-09-20 11:51:17 EDT
We are being impacted by this issue too and would like to see the fix included in a logrotate release before RHEL 6.4.
Comment 12 errata-xmlrpc 2013-07-18 05:35:05 EDT
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.


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