Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 454914 - sys-apps/openrc: Feature Request: Open logfile before chuid option
Summary: sys-apps/openrc: Feature Request: Open logfile before chuid option
Status: UNCONFIRMED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: OpenRC (show other bugs)
Hardware: All Linux
: Normal enhancement with 1 vote (vote)
Assignee: OpenRC Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-31 23:56 UTC by Cameron Tacklind
Modified: 2013-01-31 23:56 UTC (History)
0 users

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


Attachments
Patch allowing opening of stdout/stderr files before chuid (file_454914.txt,4.20 KB, text/plain)
2013-01-31 23:56 UTC, Cameron Tacklind
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Cameron Tacklind 2013-01-31 23:56:37 UTC
Created attachment 337528 [details]
Patch allowing opening of stdout/stderr files before chuid

When using --user (and --group) options, start-stop-daemon opens the specified --pidfile (and creates it) BEFORE changing to specified user. This means the pidfile is owned by root, which is fine.

However, --stdout and --stderr get opened (and created) AFTER changing to the specified user. This means that extra commands are needed in init.d scripts (or done manually) to create and chown the log files.

Of course some users like this as log files are then owned by the same user as the daemon so we need to continue to support this.

I'm proposing a new start-stop-daemon flag called --rootlog (and associated --userlog which is the default so unnecessary) which opens the log files before the chuid.

I've written a quick patch attempting to kept the changes as minor as possible.

Putting the patch file in /etc/portage/patches/sys-apps/openrc/ works flawlessly.

Needed improvements:
 - Indenting of original section
 - Moving original section to a function so code is not repeated
 - Adding input sanity checks
   - Useless without --user
 - Other issues I forgot