Cannot handle spaces in compressoptions

Bug #662312 reported by Bela Lubkin
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
logrotate (Debian)
Fix Released
Unknown
logrotate (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Binary package hint: logrotate

I set these options in /etc/logrotate.conf:

   compress
   compresscmd /usr/bin/xz
   uncompresscmd /usr/bin/unxz
   compressoptions -7 -e -T 1
   compressext xz

Compression fails with:

   /etc/cron.daily/logrotate:
   error: /etc/logrotate.conf:23 bad compressoptions path -7 -e -T 1
   run-parts: /etc/cron.daily/logrotate exited with return code 1

logrotate fails if the compressoptions setting has any spaces. This is also upstream Debian bug #159797 <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=159797> -- reported in 2002!

Like the original report, this one has a workaround:

   compressoptions -7eT1

Eventually someone will need options which cannot be jammed into a single space-free string.

Changed in logrotate (Debian):
status: Unknown → Confirmed
Changed in logrotate (Debian):
status: Confirmed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in logrotate (Ubuntu):
status: New → Confirmed
Revision history for this message
Jouni "rautamiekka" Järvinen (rautamiekka) wrote :

Ubuntu Server 12.04.4 LTS x64, no desktop
§uname -a§=Linux rautamiekka.org 3.10.23-xxxx-std-ipv6-64 #1 SMP Mon Dec 9 18:53:52 CET 2013 x86_64 x86_64 x86_64 GNU/Linux
logrotate 3.7.8

This still exists although it's old as something !

Revision history for this message
Jouni "rautamiekka" Järvinen (rautamiekka) wrote :

For what it's worth, the lines from §/etc/logrotate.d/apache2§:

/var/log/apache2/*.log {
    weekly
    missingok
    rotate 52
    compress
    compresscmd /usr/bin/xz
    compressoptions "-vvz9e --lzma2=dict=64MiB,mf=bt4,nice=273 --threads=3"
    delaycompress
    notifempty
    create 640 root adm
    sharedscripts
    postrotate
                if /etc/init.d/apache2 status > /dev/null ; then \
                    /etc/init.d/apache2 reload > /dev/null; \
                fi;
    endscript
    prerotate
        if [ -d /etc/logrotate.d/httpd-prerotate ]; then \
            run-parts /etc/logrotate.d/httpd-prerotate; \
        fi; \
    endscript
}

Revision history for this message
Bela Lubkin (filbo) wrote :

Testing on saucy, problem no longer exists. This makes sense as it contains logrotate 3.8.3; ability to have spaces in compressoptions was patched in as of debian package version 3.8.1-5.

I tried installing the trusty build of logrotate on precise and it failed wanting a slightly newer libacl1. You could go down a rathole of trying to install that (warning, it's likely to want a newer glibc, then you're in a real mess...) Or build newer logrotate from source.

Or just temporarily kludge around it, e.g.:

   compresscmd /usr/local/bin/xz-for-apache-logrotate
   compressoptions --

# cat > /usr/local/bin/xz-for-apache-logrotate << _EOF_
#!/bin/sh
exec xz -vvz9e --lzma2=dict=64MiB,mf=bt4,nice=273 --threads=3
_EOF_
# chmod 755 /usr/local/bin/xz-for-apache-logrotate

*IF* those compressoptions were delivered by an apache package that's part of the standard repositories for precise, that's a bug in the apache package. It shouldn't be trying to use options that cannot be parsed by the logrotate of the associated release. If you pulled the package from a forward Ubuntu release, you caused the problem; if it's from a PPA or similar, and you are using it on an Ubuntu release it's documented to be used with, it's a bug in the PPA...

Revision history for this message
Jouni "rautamiekka" Järvinen (rautamiekka) wrote :

I modified each config to use xz with the options.

Revision history for this message
Jouni "rautamiekka" Järvinen (rautamiekka) wrote :

Be warned that @filbo's method sort of requires §compressext xz§ cuz otherwise the XZ-compressed files end in gz but still are xz files. Or at least on 12.04 it does.

As an semi-offtopic, I added §nomail§ to not get that uselessness into mail files on the computer, and §notifempty§ is also worth the trouble. The latter is already added to most logrotate configs, and you can find each file which doesn't have, with §grep -L 'notifempty' /etc/logrotate.d/*§.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.