Bug 31629

Summary: Unable to assign custom compresscmd
Product: Sisyphus Reporter: Konstantin A Lepikhov (L.A. Kostis) <lakostis>
Component: logrotateAssignee: Alexey Gladkov <legion>
Status: CLOSED WORKSFORME QA Contact: qa-sisyphus
Severity: major    
Priority: P3 CC: evg, ldv, legion
Version: unstableKeywords: relnote
Hardware: all   
OS: Linux   
Attachments:
Description Flags
problematic logrotate.conf none

Description Konstantin A Lepikhov (L.A. Kostis) 2015-12-15 13:25:50 MSK
[lakostis@lks ~]$ sudo fgrep compress /etc/logrotate.conf
# comment this out if you want your log files uncompressed
compress
compresscmd /usr/bin/pxz
compressoptions '-9T4'
compressext .xz
uncompresscmd /usr/bin/unxz
[lakostis@lks ~]$ which pxz
/usr/bin/pxz
[lakostis@lks ~]$ which unxz
/usr/bin/unxz
[lakostis@lks ~]$

[lakostis@lks ~]$ sudo logrotate -d /etc/logrotate.conf
reading config file /etc/logrotate.conf
error: /etc/logrotate.conf:24 bad compress path /usr/bin/pxz
removing last 0 log configs

В предыдущей версии все работало.
Comment 1 Dmitry V. Levin 2015-12-16 06:03:54 MSK
(In reply to comment #0)
> [lakostis@lks ~]$ sudo fgrep compress /etc/logrotate.conf
> # comment this out if you want your log files uncompressed
> compress
> compresscmd /usr/bin/pxz
> compressoptions '-9T4'
> compressext .xz
> uncompresscmd /usr/bin/unxz
> [lakostis@lks ~]$ which pxz
> /usr/bin/pxz
> [lakostis@lks ~]$ which unxz
> /usr/bin/unxz
> [lakostis@lks ~]$
> 
> [lakostis@lks ~]$ sudo logrotate -d /etc/logrotate.conf
> reading config file /etc/logrotate.conf
> error: /etc/logrotate.conf:24 bad compress path /usr/bin/pxz
> removing last 0 log configs
> 
> В предыдущей версии все работало.

Этот logrotate такой странный, он поддерживает многобайтные кодировки в конфигах.

Хорошо бы проверить, нет ли жалоб от
sudo iconv -tascii < /etc/logrotate.conf > /dev/null
Comment 2 Konstantin A Lepikhov (L.A. Kostis) 2015-12-16 14:20:32 MSK
(In reply to comment #1)
> (In reply to comment #0)
> > [lakostis@lks ~]$ sudo fgrep compress /etc/logrotate.conf
> > # comment this out if you want your log files uncompressed
> > compress
> > compresscmd /usr/bin/pxz
> > compressoptions '-9T4'
> > compressext .xz
> > uncompresscmd /usr/bin/unxz
> > [lakostis@lks ~]$ which pxz
> > /usr/bin/pxz
> > [lakostis@lks ~]$ which unxz
> > /usr/bin/unxz
> > [lakostis@lks ~]$
> > 
> > [lakostis@lks ~]$ sudo logrotate -d /etc/logrotate.conf
> > reading config file /etc/logrotate.conf
> > error: /etc/logrotate.conf:24 bad compress path /usr/bin/pxz
> > removing last 0 log configs
> > 
> > В предыдущей версии все работало.
> 
> Этот logrotate такой странный, он поддерживает многобайтные кодировки в
> конфигах.
> 
> Хорошо бы проверить, нет ли жалоб от
> sudo iconv -tascii < /etc/logrotate.conf > /dev/null

[lakostis@lks ~]$ sudo iconv -tascii < /etc/logrotate.conf > /dev/null
bash: /etc/logrotate.conf: Permission denied
You have mail in /var/mail/lakostis
[lakostis@lks ~]$ sudo su -
[sudo] password for lakostis:
[root@lks ~]# iconv -tascii < /etc/logrotate.conf > /dev/null
[root@lks ~]#
Comment 3 Dmitry V. Levin 2015-12-16 16:46:30 MSK
Может, там в конце строки какой-нибудь пробельный символ?
Comment 4 Konstantin A Lepikhov (L.A. Kostis) 2015-12-16 17:18:02 MSK
(In reply to comment #3)
> Может, там в конце строки какой-нибудь пробельный символ?

22798 munmap(0x7f27e910c000, 4096)      = 0
22798 open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
22798 open("/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
22798 open("/usr/lib/locale/en_US.utf8/LC_CTYPE", O_RDONLY|O_CLOEXEC) = 3
22798 fstat(3, {st_mode=S_IFREG|0644, st_size=278308, ...}) = 0
22798 mmap(NULL, 278308, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f27e90c8000
22798 close(3)                          = 0
22798 open("/usr/lib64/gconv/gconv-modules.cache", O_RDONLY) = 3
22798 fstat(3, {st_mode=S_IFREG|0644, st_size=26254, ...}) = 0
22798 mmap(NULL, 26254, PROT_READ, MAP_SHARED, 3, 0) = 0x7f27e90c0000
22798 close(3)                          = 0
22798 open("/etc/popt", O_RDONLY)       = -1 ENOENT (No such file or directory)
22798 stat("/etc/popt.d", 0x7ffc09337dd0) = -1 ENOENT (No such file or directory)
22798 open("/root/.popt", O_RDONLY)     = -1 ENOENT (No such file or directory)
22798 stat("/etc/logrotate.conf", {st_mode=S_IFREG|0640, st_size=901, ...}) = 0
22798 open("/etc/logrotate.conf", O_RDONLY|O_CLOEXEC) = 3
22798 fcntl(3, F_SETLK, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
22798 fstat(3, {st_mode=S_IFREG|0640, st_size=901, ...}) = 0
22798 mmap(NULL, 903, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_POPULATE, 3, 0) = 0x7f27e90b8000
22798 madvise(0x7f27e90b8000, 903, MADV_DOFORK) = 0
22798 write(2, "reading config file /etc/logrotate.conf\n", 40) = 40
22798 write(2, "error: ", 7)            = 7
22798 write(2, "/etc/logrotate.conf:24 bad compress path /usr/bin/pxz\n", 54) = 54
22798 munmap(0x7f27e90b8000, 903)       = 0
22798 close(3)                          = 0
22798 write(2, "removing last 0 log configs\n", 28) = 28
22798 exit_group(1)                     = ?
22798 +++ exited with 1 +++

нету там никакого доп. символа. А что, это не воспроизводится?
Comment 5 Dmitry V. Levin 2015-12-16 17:26:55 MSK
(In reply to comment #4)
> (In reply to comment #3)
> > Может, там в конце строки какой-нибудь пробельный символ?
> 
> 22798 write(2, "/etc/logrotate.conf:24 bad compress path /usr/bin/pxz\n", 54) = 54
> 
> нету там никакого доп. символа. А что, это не воспроизводится?

Стал бы я спрашивать, если бы это воспроизводилось. У меня пишет ожидаемое
compress_prog is now /usr/bin/pxz
Comment 6 Konstantin A Lepikhov (L.A. Kostis) 2015-12-16 17:42:49 MSK
(In reply to comment #5)
> (In reply to comment #4)
> > (In reply to comment #3)
> > > Может, там в конце строки какой-нибудь пробельный символ?
> > 
> > 22798 write(2, "/etc/logrotate.conf:24 bad compress path /usr/bin/pxz\n", 54) = 54
> > 
> > нету там никакого доп. символа. А что, это не воспроизводится?
> 
> Стал бы я спрашивать, если бы это воспроизводилось. У меня пишет ожидаемое
> compress_prog is now /usr/bin/pxz

Прилагаю сам logrotate.conf для сравнения.
Comment 7 Konstantin A Lepikhov (L.A. Kostis) 2015-12-16 17:43:41 MSK
Created attachment 6458 [details]
problematic logrotate.conf
Comment 8 Dmitry V. Levin 2015-12-16 17:54:19 MSK
(In reply to comment #7)
> Created an attachment (id=6458) [details]
> problematic logrotate.conf

У меня всё нормально с этим конфигом:

$ env -i LANG=en_US.utf8 /usr/sbin/logrotate -d ./logrotate.conf 
reading config file ./logrotate.conf
compress_prog is now /usr/bin/pxz
compress_options is now  '-9T4'
compress_ext is now .xz
uncompress_prog is now /usr/bin/unxz
including /etc/logrotate.d
error: cannot open directory /etc/logrotate.d: Permission denied
removing last 0 log configs
Comment 9 Konstantin A Lepikhov (L.A. Kostis) 2015-12-16 19:06:18 MSK
[lakostis@lks ~]$ hsh-install /opt/builds/tmp pxz
<13>Dec 16 16:04:52 rpmi: libgomp1-5.2.1-alt1 1440730975 installed
<13>Dec 16 16:04:52 rpmi: pxz-4.999.9beta-alt3 1422319848 installed
[lakostis@lks ~]$ cp /tmp/logrotate.conf /opt/builds/tmp/chroot/.in
[lakostis@lks ~]$ hsh-shell --rooter /opt/builds/tmp
[root@localhost .in]# logrotate -d logrotate.conf 
reading config file logrotate.conf
compress_prog is now /usr/bin/pxz
compress_options is now  '-9T4'
compress_ext is now .xz
uncompress_prog is now /usr/bin/unxz
including /etc/logrotate.d

Handling 2 logs

rotating pattern: /var/log/wtmp  monthly (4 rotations)
empty log files are not rotated, only log files >= 1048576 bytes are rotated, old logs are removed
considering log /var/log/wtmp
error: stat of /var/log/wtmp failed: No such file or directory

rotating pattern: /var/log/btmp  monthly (4 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/btmp
  log /var/log/btmp does not exist -- skipping

мистика какая-то (
Comment 10 Konstantin A Lepikhov (L.A. Kostis) 2015-12-16 19:09:31 MSK
Похоже, это был какой-то промежуточный баг, после обновления до 3.9.1 все заработало:

[root@lks /]# logrotate -d /etc/logrotate.conf
reading config file /etc/logrotate.conf
compress_prog is now /usr/bin/pxz
compress_options is now  '-9T4'
compress_ext is now .xz
uncompress_prog is now /usr/bin/unxz
including /etc/logrotate.d

А поломано было в logrotate-3.7.9-alt3
Comment 11 Dmitry V. Levin 2015-12-16 20:00:48 MSK
(In reply to comment #10)
> Похоже, это был какой-то промежуточный баг, после обновления до 3.9.1 все
> заработало:
> А поломано было в logrotate-3.7.9-alt3

Ссылка на фикс, для истории:
https://github.com/logrotate/logrotate/commit/e1c2065c0f9cacafb9506f0c85e95c26ad5be1f4