Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 310511 - sys-apps/preload: init.d script is not POSIX shell compliant
Summary: sys-apps/preload: init.d script is not POSIX shell compliant
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Pacho Ramos
URL:
Whiteboard:
Keywords:
Depends on: 299140
Blocks:
  Show dependency tree
 
Reported: 2010-03-21 10:31 UTC by Michał Górny
Modified: 2010-09-07 12:11 UTC (History)
3 users (show)

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


Attachments
patch for preload-0.64.init.in (preload-0.6.4.init.in.patch,701 bytes, patch)
2010-08-25 10:49 UTC, Mu Qiao (RETIRED)
Details | Diff
New init.d script (preload,1.47 KB, text/plain)
2010-09-06 16:41 UTC, Michał Górny
Details
Diff against the original script (0001-Fix-the-issues-with-the-init.d-script.patch,2.92 KB, patch)
2010-09-06 16:41 UTC, Michał Górny
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2010-03-21 10:31:01 UTC
The init.d script installed by sys-apps/preload is not compliant with POSIX shell and thus fails to run with OpenRC and non-bash default system shell.

This is because of using $(<...) to read files which (probably) has to be replaced by standard 'cat' call.

Moreover, the script lacks proper handling of exit codes. The start() function should save $? after calling ssd, and return it afterwards instead of returning ionice result, and the dump() one should either check exit codes of both 'kill' calls or neither.
Comment 1 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2010-03-28 04:08:45 UTC
I no longer use this application and have dropped maintainer-ship.
Comment 2 Mu Qiao (RETIRED) gentoo-dev 2010-08-25 10:49:28 UTC
Created attachment 244507 [details, diff]
patch for preload-0.64.init.in

I guess this could solve the problem. But for kill function, someone suggest use kill -[0-9] or -[A-Z] instead of the signal name. I'm not sure if this is true.
Comment 3 Pacho Ramos gentoo-dev 2010-09-06 15:29:55 UTC
Will look at it as soon as I have time to, thanks :-)

As a side note, if you have any idea about how to solve bug #299140 I will really appreciate it (if you don't know, no problem of course ;-))

Thanks a lot
Comment 4 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2010-09-06 15:56:38 UTC
(In reply to comment #3)
> As a side note, if you have any idea about how to solve bug #299140 I will
> really appreciate it (if you don't know, no problem of course ;-))

I'll try to prepare a combined patch in a while.
Comment 5 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2010-09-06 16:41:11 UTC
Created attachment 246276 [details]
New init.d script

The script has been made POSIX compliant. The race condition related to ionice use has been fixed. Additional error handling has been added. Script and command definitions for OpenRC have been added.
Comment 6 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2010-09-06 16:41:56 UTC
Created attachment 246277 [details, diff]
Diff against the original script
Comment 7 William Hubbs gentoo-dev 2010-09-06 20:42:59 UTC
Packages with non-posix init scripts need to be fixed; however, this is not a blocker for openrc stabilization.
Comment 8 Pacho Ramos gentoo-dev 2010-09-07 12:11:27 UTC
+*preload-0.6.4-r2 (07 Sep 2010)
+
+  07 Sep 2010; Pacho Ramos <pacho@gentoo.org> +preload-0.6.4-r2.ebuild,
+  +files/preload-0.6.4.init.in-r1:
+  Revision bump to fix race condition (bug #299140 by Ambroz Bizjak) and
+  make it POSIX compliant (bug #310511 by Michał Górny), thanks a lot to
+  Michał for providing the new init.d script.