FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo Development

 
 
LinkBack Thread Tools
 
Old 08-12-2010, 06:29 PM
Eray Aslan
 
Default keepdir /var/run/package/?

It is perfectly legal to clear /var/run across reboots. Below is a bug
from a user that ran into some trouble because an init script assumes that
/var/run/package/ exists for its PID file:

http://bugs.gentoo.org/show_bug.cgi?id=332397

A quick grep through the tree shows 73 packages that keepdirs
/var/run/package/. Perhaps not all of them are bugs but they are
certainly redundant.

A mass bug-filing is probably not the correct thing to do but perhaps we
should document somewhere (devmanual?) that keepdir'ing a temp location
should be avoided. Suggestion:

--- a/ebuild-writing/common-mistakes/text.xml
+++ b/ebuild-writing/common-mistakes/text.xml
@@ -41,6 +41,18 @@ elog "They are listed in the INSTALL file in /usr/share/doc/${PF}"
</body>
</section>

+<section>
+<title>Invalid use of <c>keepdir</c>in src_install</title>
+<body>
+The <c>keepdir</c> function should only be used to prevent directory removal
+during uninstallation. In particular, using <c>keepdir</c> for a temporary
+location - such as /var/run/package/ for a PID file - should be avoided. In
+such a case, init script either should make sure that /var/run/package/ exists
+or the package should use /var/run directly. Please note that /var/run can and
+will be cleaned across reboots.
+</body>
+</section>
+
</chapter>

</guide>

--
Eray
 
Old 08-12-2010, 06:36 PM
Michael Sterrett
 
Default keepdir /var/run/package/?

What you're saying doesn't agree with
http://www.pathname.com/fhs/pub/fhs-2.3.html#VARRUNRUNTIMEVARIABLEDATA



On Thu, Aug 12, 2010 at 2:29 PM, Eray Aslan <eray.aslan@caf.com.tr> wrote:
> It is perfectly legal to clear /var/run across reboots. *Below is a bug
> from a user that ran into some trouble because an init script assumes that
> /var/run/package/ exists for its PID file:
 
Old 08-12-2010, 06:37 PM
"Paweł Hajdan, Jr."
 
Default keepdir /var/run/package/?

On 8/12/10 11:29 AM, Eray Aslan wrote:
> It is perfectly legal to clear /var/run across reboots. Below is a bug
> from a user that ran into some trouble because an init script assumes that
> /var/run/package/ exists for its PID file:

Can we add a repoman check for that?
 
Old 08-12-2010, 06:42 PM
Eray Aslan
 
Default keepdir /var/run/package/?

On Thu, Aug 12, 2010 at 02:36:40PM -0400, Michael Sterrett wrote:
> What you're saying doesn't agree with
> http://www.pathname.com/fhs/pub/fhs-2.3.html#VARRUNRUNTIMEVARIABLEDATA

I do not understand. In the above link, it says:

"/var/run:
[...]Files under this directory must be cleared (removed or truncated as
appropriate) at the beginning of the boot process."

So we cannot assume that a directory exists under /var/run during boot.
Hence, keepdiring a dir that will most probably be cleared during boot
is pointless.

Am I missing something?

--
Eray
 
Old 08-12-2010, 06:48 PM
Samuli Suominen
 
Default keepdir /var/run/package/?

On 08/12/2010 09:42 PM, Eray Aslan wrote:
> On Thu, Aug 12, 2010 at 02:36:40PM -0400, Michael Sterrett wrote:
>> What you're saying doesn't agree with
>> http://www.pathname.com/fhs/pub/fhs-2.3.html#VARRUNRUNTIMEVARIABLEDATA
>
> I do not understand. In the above link, it says:
>
> "/var/run:
> [...]Files under this directory must be cleared (removed or truncated as
> appropriate) at the beginning of the boot process."
>
> So we cannot assume that a directory exists under /var/run during boot.
> Hence, keepdiring a dir that will most probably be cleared during boot
> is pointless.
>
> Am I missing something?
>

It says "Files under this directory", not "Files and directories under
this directory."

Futhermore is continues with,

"Programs may have a subdirectory of /var/run; this is encouraged for
programs that use more than one run-time file."

So I'd say keepdir is legal here...
 
Old 08-12-2010, 07:02 PM
Jeremy Olexa
 
Default keepdir /var/run/package/?

On Thu, 12 Aug 2010 21:48:04 +0300, Samuli Suominen
<ssuominen@gentoo.org> wrote:

> It says "Files under this directory", not "Files and directories under
> this directory."

Oh, cmon. If you are going to selectively quote, then I'll give you
this: "This directory contains system information data describing the
system since it was booted." So in my opinion, it is fine to "rm -rf
/var/run/*" on system shutdown...

>
> Futhermore is continues with,
>
> "Programs may have a subdirectory of /var/run; this is encouraged for
> programs that use more than one run-time file."
>
> So I'd say keepdir is legal here...

Then the app in question can (and should) make the directory, not the
ebuild.

-Jeremy
 
Old 08-12-2010, 07:33 PM
Eray Aslan
 
Default keepdir /var/run/package/?

On 08/12/2010 09:48 PM, Samuli Suominen wrote:

It says "Files under this directory", not "Files and directories under
this directory."


Fair enough.

So our policy basically is "tmpfs is not supported for /var/run" (and
also for /var/lock I suppose).


It will be somewhat more work but instead of the above, we can say
"tmpfs might be used for /var/run and /var/lock and the init scripts
should handle this correctly". It feels (for want of a better word) better.


--
Eray
 
Old 08-12-2010, 07:40 PM
Mike Frysinger
 
Default keepdir /var/run/package/?

On Thu, Aug 12, 2010 at 3:33 PM, Eray Aslan wrote:
> On 08/12/2010 09:48 PM, Samuli Suominen wrote:
>> It says "Files under this directory", not "Files and directories under
>> this directory."
>
> Fair enough.
>
> So our policy basically is "tmpfs is not supported for /var/run" (and also
> for /var/lock I suppose).

it may have been in the past, but it's best to move forward and not
sit in the past

> It will be somewhat more work but instead of the above, we can say "tmpfs
> might be used for /var/run and /var/lock and the init scripts should handle
> this correctly". *It feels (for want of a better word) better.

i certainly use a tmpfs on /var/run to minimize disk writes. packages
that break i file bugs for and/or fix myself. it isnt that hard.

plus, it's just good behavior. if /var/run gets removed for whatever
reason, people have to re-emerge a bunch of packages to simply create
a subdir ? that's silly.
-mike
 
Old 08-13-2010, 04:17 PM
Mike Frysinger
 
Default keepdir /var/run/package/?

On Thu, Aug 12, 2010 at 3:40 PM, Mike Frysinger wrote:
> On Thu, Aug 12, 2010 at 3:33 PM, Eray Aslan wrote:
>> It will be somewhat more work but instead of the above, we can say "tmpfs
>> might be used for /var/run and /var/lock and the init scripts should handle
>> this correctly". *It feels (for want of a better word) better.
>
> i certainly use a tmpfs on /var/run to minimize disk writes. *packages
> that break i file bugs for and/or fix myself. *it isnt that hard.
>
> plus, it's just good behavior. *if /var/run gets removed for whatever
> reason, people have to re-emerge a bunch of packages to simply create
> a subdir ? *that's silly.

for people who do wish to improve their init.d scripts, recreating a
dir is easy if your init.d runs after localmount:
[ ! -d /var/run/foo ] && install -d -m 755 -o fowner -g fgroup /var/run/foo

if your init.d runs before localmount, you'll have to resort to normal
mkdir/chown/chmod, but i dont think there are many (any?) scripts
that'll hit this set of requirements
-mike
 
Old 08-13-2010, 04:19 PM
Mike Frysinger
 
Default keepdir /var/run/package/?

On Fri, Aug 13, 2010 at 12:17 PM, Mike Frysinger wrote:
> for people who do wish to improve their init.d scripts, recreating a
> dir is easy if your init.d runs after localmount:
> [ ! -d /var/run/foo ] && install -d -m 755 -o fowner -g fgroup /var/run/foo

oh, and for the very few cases that need to create a file with
specific ownership ahead of time (because their daemon sucks and
doesnt drop root properly), then you can do:
install -m 644 -o fowner -g fgroup /dev/null /var/run/foo-file
-mike
 

Thread Tools




All times are GMT. The time now is 12:54 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ę2007 - 2008, www.linux-archive.org