Bug 1417106

Summary: Logrotate Errors on Username/Groups with Spaces
Product: Red Hat Enterprise Linux 7 Reporter: MarkS <mark>
Component: logrotateAssignee: Kamil Dudka <kdudka>
Status: CLOSED WONTFIX QA Contact: qe-baseos-daemons
Severity: low Docs Contact:
Priority: unspecified    
Version: 7.2CC: kdudka
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-01-30 11:46:31 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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.