Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 497854 - media-sound/mpd - logrotate script complains when mpd is run as non-standard user
Summary: media-sound/mpd - logrotate script complains when mpd is run as non-standard ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Christoph Mende (RETIRED)
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2014-01-12 03:58 UTC by dtr
Modified: 2014-03-22 16:00 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description dtr 2014-01-12 03:58:53 UTC
The problem is in /etc/logrotate.d/mpd file.

It contains the following lines:

/var/lib/mpd/log {
        missingok
        postrotate
        [ -f /var/run/mpd.pid ] && /bin/kill -HUP `cat /var/run/mpd.pid`
        endscript
}

I run MPD as an ordinary user, hence there is no file /var/run/mpd.pid on my system. The problem is that /bin/bash, which is the shell that all the cron jobs run in, evaluates the subshell call BEFORE the test command, i.e. from the beginning it outputs the error I get on email from my cron daemon about nonexisted file /var/run/mpd.pid:

error: error running non-shared postrotate script for /var/lib/mpd/log of '/var/lib/mpd/log '

and only then the command proceedes (as it should be). 
Since any output produced by a script running as a cron job is treated as failure, I get these messages, which is annoying.

I’d recommend to change the script to

        [ -f /var/run/mpd.pid ] && cat /var/run/mpd.pid | xargs /bin/kill -HUP 

I tested it with ‘/bin/bash -c’ and it doesn’t produce unnecessary output unlike the command that is in logrotate script now.

If somebody doubts about whether xargs is installed on the end-user system, default busybox which comes with stage3 archive has a version of xargs.
Comment 1 Christoph Mende (RETIRED) gentoo-dev 2014-03-22 16:00:26 UTC
Thanks, fixed in CVS