I'm using tmpfs for /var/run and laptop-mode-tools at default runlevel. Each time i boot i get message: laptop_mode |touch: cannot touch «/var/run/laptop-mode-tools/enabled»: No such file or directory Looks like it doesn't check if directory «/var/run/laptop-mode-tools» exists. Later, it gets created and just restarting this service makes it start without any warnings. Reproducible: Always Steps to Reproduce: 1. Install laptop-mode-tools and add it's service to any used at boot time runlevel (i.e. boot or default for example) 2. Make /var/run on tmpfs 3. Reboot Actual Results: Getting warning from laptop_mode service, probably incorrect behavior Expected Results: Warningless boot of laptop_mode service To fix this bug laptop-mode-tools should check if directory «/var/run/laptop-mode-tools» exists at startup
Created attachment 251469 [details] Fixed init script (full version)
Created attachment 251471 [details, diff] init script patch
@i.Dark_Templar: Using checkpath in the init script is the preferred solution instead of calling mkdir. You might also want to check the init scripts in bug #332633 for examples.
I've used "mkdir -p" because it does nothing if dir already exists and creates dir if it not exists. But in case maintainers prefer check before creation, i'll now attach this version too. I've used dbus init script as example.
Created attachment 251569 [details] check before dir creation - full script
Created attachment 251571 [details, diff] laptop_mode init script patch which checks dir before creation
Created attachment 251585 [details] script which uses builtin "checkpath" function I've made script that uses builtin "checkpath" function. But this fuction is unpreferrable for me - it gives extra warnings each time it starts at boot. Previous scripts fix problem silently.
Created attachment 251587 [details, diff] script patch which uses builtin "checkpath" function
Created attachment 251589 [details, diff] More readable version of previous patch, uses builtin "checkpath" function
(In reply to comment #7) > it gives extra warnings each time it starts at boot. Use the --quiet option Also make sure you check the exit codes of the commands you run. Something similar to the following perhaps? if [ ! -d "${PIDDIR}" ] ; then checkpath -q -d -o someuser:somegroup -m 0755 "${PIDDIR}" || return 1 fi
Created attachment 251601 [details] laptop mode full init script There is no need to additionally check dir before running checkpath, because checkpass both checks and creates or modifies directory (or file, directory in this case) if necessary
Created attachment 251603 [details, diff] init script patch There is no word about exit codes of "checkpath" in manual. So, i suppose it always works fine with correct arguments.
Bug is still there and fix is in attachment. Maybe someone merge it into portage tree?
Created attachment 267307 [details] modified laptop-mode-tools ebuild. Removed keepdir line diff with current ebuild: --- /usr/portage/app-laptop/laptop-mode-tools/laptop-mode-tools-1.55-r1.ebuild 2010-09-28 09:23:31.000000000 +0400 +++ ./laptop-mode-tools-1.55-r1.ebuild 2011-03-26 20:57:22.000000000 +0300 @@ -48,8 +48,6 @@ # Commented out to avoid !sys-power/pm-utils depend wrt #327443 # exeinto /etc/pm/power.d # newexe "${FILESDIR}"/laptop_mode_tools.pmutils laptop_mode_tools - - keepdir /var/run/laptop-mode-tools } pkg_postinst() {
This bug is long time ago marked as "in progress", but I didn't notice any progress...
The mobile herd is pretty much dead. If you want to become maintainer for this package please contact us at proxy-maint@gentoo.org[1] [1]: http://www.gentoo.org/proj/en/qa/proxy-maintainers/index.xml
Bug is still there, at laptop-mode-tools-1.55-r3 and r4. While other laptop-mode-tools bugs get fixed, I guess there are people to look at this bug.
I fixed it. Thanks for reporting. +*laptop-mode-tools-1.55-r5 (01 Jan 2012) + + 01 Jan 2012; Markos Chandras <hwoarang@gentoo.org> + +laptop-mode-tools-1.55-r5.ebuild, files/laptop_mode.init-1.4: + Check if directory exists in /var/run. Non maintainer commit. Bug #342049. + Thanks to i.Dark_Templar <dark_templar@hotbox.ru> +