Bug 1417106 - Logrotate Errors on Username/Groups with Spaces
Summary: Logrotate Errors on Username/Groups with Spaces
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: logrotate
Version: 7.2
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: rc
: ---
Assignee: Kamil Dudka
QA Contact: qe-baseos-daemons
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-01-27 09:13 UTC by MarkS
Modified: 2017-01-30 11:46 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-01-30 11:46:31 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description MarkS 2017-01-27 09:13:36 UTC
Description of problem:
If you use a space in a user/group name then logrotate will error out indicating that the usage was wrong.

Version-Release number of selected component (if applicable):
I do not believe this is version related but in my test it was: logrotate-3.8.6-7.el7_2.x86_64

How reproducible:
Every time

Steps to Reproduce:
1. Create a logrotate configuration and use a group name with spaces in the "su" or "create" directives.
2. Run: logrotate -d config
3. Error outputted

Actual results:
# cat /etc/logrotate.d/test
/var/log/test/*.log {
    su Test "Test Group"
    weekly
    rotate 10
    copytruncate
    delaycompress
    compress
    notifempty
    missingok
}

# logrotate -d /etc/logrotate.d/test
reading config file /etc/logrotate.d/test
error: /etc/logrotate.d/test:2 extra arguments for su
error: found error in /var/log/test/*.log , skipping
removing last 1 log configs
Allocating hash table for state file, size 64 entries

Handling 0 logs

Expected results:
Whilst spaces are not traditionally used in groups and users and indeed I am certain a lot of tools wouldn't accept it in the username. We have integration with Active Directory where it is acceptable. As such I would expect logrotate to handle the group name with spaces at least but preferably user and group.

Additional info:
I did experiment with other possible styles of inputting the group.

su Test Test\ Group
error: /etc/logrotate.d/test:2 extra arguments for su

su Test "Test\ Group"
error: /etc/logrotate.d/test:2 extra arguments for su

su Test Test\040Group
error: /etc/logrotate.d/test:2 unknown group 'Test\040Group'

(1024 is the GID of "Test Group")
su Test 1024
error: /etc/logrotate.d/test:2 unknown group '1024'

Comment 2 Kamil Dudka 2017-01-30 11:46:31 UTC
This needs to be implemented upstream first.  Please submit a patch including a test-case at https://github.com/logrotate/logrotate/pulls and get it reviewed by the upstream community.  For RHEL-7, closing WONTFIX.  If you are a customer of Red Hat, please contact Product Support.


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