Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 342049 - app-laptop/laptop-mode-tools and /var/run on tmpfs issue
Summary: app-laptop/laptop-mode-tools and /var/run on tmpfs issue
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High QA (vote)
Assignee: Mobile Herd (OBSOLETE)
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks: keepdir-var-run_lock
  Show dependency tree
 
Reported: 2010-10-21 17:58 UTC by i.Dark_Templar
Modified: 2012-01-01 14:45 UTC (History)
2 users (show)

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


Attachments
Fixed init script (full version) (laptop_full,1.07 KB, text/plain)
2010-10-21 18:04 UTC, i.Dark_Templar
Details
init script patch (laptop,325 bytes, patch)
2010-10-21 18:05 UTC, i.Dark_Templar
Details | Diff
check before dir creation - full script (laptop_check_full,1.17 KB, text/plain)
2010-10-22 13:36 UTC, i.Dark_Templar
Details
laptop_mode init script patch which checks dir before creation (laptop_check_diff,430 bytes, patch)
2010-10-22 13:37 UTC, i.Dark_Templar
Details | Diff
script which uses builtin "checkpath" function (laptop_checkpath_full,1.15 KB, text/plain)
2010-10-22 14:14 UTC, i.Dark_Templar
Details
script patch which uses builtin "checkpath" function (laptop_checkpath_diff,131 bytes, patch)
2010-10-22 14:15 UTC, i.Dark_Templar
Details | Diff
More readable version of previous patch, uses builtin "checkpath" function (laptop_checkpath_diff,406 bytes, patch)
2010-10-22 14:18 UTC, i.Dark_Templar
Details | Diff
laptop mode full init script (laptop_mode,1.15 KB, text/plain)
2010-10-22 15:48 UTC, i.Dark_Templar
Details
init script patch (laptop_mode_diff,411 bytes, patch)
2010-10-22 15:53 UTC, i.Dark_Templar
Details | Diff
modified laptop-mode-tools ebuild. Removed keepdir line (laptop-mode-tools-1.55-r1.ebuild,1.80 KB, text/plain)
2011-03-26 18:00 UTC, i.Dark_Templar
Details

Note You need to log in before you can comment on or make changes to this bug.
Description i.Dark_Templar 2010-10-21 17:58:36 UTC
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
Comment 1 i.Dark_Templar 2010-10-21 18:04:34 UTC
Created attachment 251469 [details]
Fixed init script (full version)
Comment 2 i.Dark_Templar 2010-10-21 18:05:23 UTC
Created attachment 251471 [details, diff]
init script patch
Comment 3 Eray Aslan gentoo-dev 2010-10-22 06:12:42 UTC
@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.
Comment 4 i.Dark_Templar 2010-10-22 13:35:45 UTC
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.
Comment 5 i.Dark_Templar 2010-10-22 13:36:50 UTC
Created attachment 251569 [details]
check before dir creation - full script
Comment 6 i.Dark_Templar 2010-10-22 13:37:40 UTC
Created attachment 251571 [details, diff]
laptop_mode init script patch which checks dir before creation
Comment 7 i.Dark_Templar 2010-10-22 14:14:32 UTC
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.
Comment 8 i.Dark_Templar 2010-10-22 14:15:15 UTC
Created attachment 251587 [details, diff]
script patch which uses builtin "checkpath" function
Comment 9 i.Dark_Templar 2010-10-22 14:18:28 UTC
Created attachment 251589 [details, diff]
More readable version of previous patch, uses builtin "checkpath" function
Comment 10 Eray Aslan gentoo-dev 2010-10-22 14:44:25 UTC
(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
Comment 11 i.Dark_Templar 2010-10-22 15:48:47 UTC
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
Comment 12 i.Dark_Templar 2010-10-22 15:53:31 UTC
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.
Comment 13 i.Dark_Templar 2011-03-26 17:21:59 UTC
Bug is still there and fix is in attachment. Maybe someone merge it into portage tree?
Comment 14 i.Dark_Templar 2011-03-26 18:00:56 UTC
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() {
Comment 15 i.Dark_Templar 2011-10-20 14:25:21 UTC
This bug is long time ago marked as "in progress", but I didn't notice any progress...
Comment 16 Markos Chandras (RETIRED) gentoo-dev 2011-10-20 18:30:57 UTC
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
Comment 17 i.Dark_Templar 2012-01-01 14:33:26 UTC
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.
Comment 18 Markos Chandras (RETIRED) gentoo-dev 2012-01-01 14:45:25 UTC
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>
+