* [gentoo-dev] keepdir /var/run/package/?
@ 2010-08-12 18:29 Eray Aslan
2010-08-12 18:36 ` Michael Sterrett
2010-08-12 18:37 ` "Paweł Hajdan, Jr."
0 siblings, 2 replies; 15+ messages in thread
From: Eray Aslan @ 2010-08-12 18:29 UTC (permalink / raw
To: gentoo-dev
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
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [gentoo-dev] keepdir /var/run/package/?
2010-08-12 18:29 [gentoo-dev] keepdir /var/run/package/? Eray Aslan
@ 2010-08-12 18:36 ` Michael Sterrett
2010-08-12 18:42 ` Eray Aslan
2010-08-12 18:37 ` "Paweł Hajdan, Jr."
1 sibling, 1 reply; 15+ messages in thread
From: Michael Sterrett @ 2010-08-12 18:36 UTC (permalink / raw
To: gentoo-dev
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:
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [gentoo-dev] keepdir /var/run/package/?
2010-08-12 18:29 [gentoo-dev] keepdir /var/run/package/? Eray Aslan
2010-08-12 18:36 ` Michael Sterrett
@ 2010-08-12 18:37 ` "Paweł Hajdan, Jr."
1 sibling, 0 replies; 15+ messages in thread
From: "Paweł Hajdan, Jr." @ 2010-08-12 18:37 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 281 bytes --]
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?
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [gentoo-dev] keepdir /var/run/package/?
2010-08-12 18:36 ` Michael Sterrett
@ 2010-08-12 18:42 ` Eray Aslan
2010-08-12 18:48 ` Samuli Suominen
0 siblings, 1 reply; 15+ messages in thread
From: Eray Aslan @ 2010-08-12 18:42 UTC (permalink / raw
To: gentoo-dev
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
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [gentoo-dev] keepdir /var/run/package/?
2010-08-12 18:42 ` Eray Aslan
@ 2010-08-12 18:48 ` Samuli Suominen
2010-08-12 19:02 ` Jeremy Olexa
2010-08-12 19:33 ` Eray Aslan
0 siblings, 2 replies; 15+ messages in thread
From: Samuli Suominen @ 2010-08-12 18:48 UTC (permalink / raw
To: gentoo-dev
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...
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [gentoo-dev] keepdir /var/run/package/?
2010-08-12 18:48 ` Samuli Suominen
@ 2010-08-12 19:02 ` Jeremy Olexa
2010-08-12 19:33 ` Eray Aslan
1 sibling, 0 replies; 15+ messages in thread
From: Jeremy Olexa @ 2010-08-12 19:02 UTC (permalink / raw
To: gentoo-dev
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
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [gentoo-dev] keepdir /var/run/package/?
2010-08-12 18:48 ` Samuli Suominen
2010-08-12 19:02 ` Jeremy Olexa
@ 2010-08-12 19:33 ` Eray Aslan
2010-08-12 19:40 ` Mike Frysinger
1 sibling, 1 reply; 15+ messages in thread
From: Eray Aslan @ 2010-08-12 19:33 UTC (permalink / raw
To: gentoo-dev
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
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [gentoo-dev] keepdir /var/run/package/?
2010-08-12 19:33 ` Eray Aslan
@ 2010-08-12 19:40 ` Mike Frysinger
2010-08-13 16:17 ` Mike Frysinger
2010-08-13 16:20 ` Jeroen Roovers
0 siblings, 2 replies; 15+ messages in thread
From: Mike Frysinger @ 2010-08-12 19:40 UTC (permalink / raw
To: gentoo-dev
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
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [gentoo-dev] keepdir /var/run/package/?
2010-08-12 19:40 ` Mike Frysinger
@ 2010-08-13 16:17 ` Mike Frysinger
2010-08-13 16:19 ` Mike Frysinger
2010-08-13 17:04 ` Ulrich Mueller
2010-08-13 16:20 ` Jeroen Roovers
1 sibling, 2 replies; 15+ messages in thread
From: Mike Frysinger @ 2010-08-13 16:17 UTC (permalink / raw
To: gentoo-dev
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
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [gentoo-dev] keepdir /var/run/package/?
2010-08-13 16:17 ` Mike Frysinger
@ 2010-08-13 16:19 ` Mike Frysinger
2010-08-13 17:04 ` Ulrich Mueller
1 sibling, 0 replies; 15+ messages in thread
From: Mike Frysinger @ 2010-08-13 16:19 UTC (permalink / raw
To: gentoo-dev
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
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [gentoo-dev] keepdir /var/run/package/?
2010-08-12 19:40 ` Mike Frysinger
2010-08-13 16:17 ` Mike Frysinger
@ 2010-08-13 16:20 ` Jeroen Roovers
1 sibling, 0 replies; 15+ messages in thread
From: Jeroen Roovers @ 2010-08-13 16:20 UTC (permalink / raw
To: gentoo-dev
On Thu, 12 Aug 2010 15:40:31 -0400
Mike Frysinger <vapier@gentoo.org> wrote:
> 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.
Bug #332633 tracks ebuilds (284) and eclasses (currently none) that
run "keepdir /var/run*".
https://bugs.gentoo.org/show_bug.cgi?id=332633
jer
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [gentoo-dev] keepdir /var/run/package/?
2010-08-13 16:17 ` Mike Frysinger
2010-08-13 16:19 ` Mike Frysinger
@ 2010-08-13 17:04 ` Ulrich Mueller
2010-08-13 19:07 ` Mike Frysinger
1 sibling, 1 reply; 15+ messages in thread
From: Ulrich Mueller @ 2010-08-13 17:04 UTC (permalink / raw
To: gentoo-dev
>>>>> On Fri, 13 Aug 2010, 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
Why not "checkpath -d -o fowner:fgroup -m 0755 /var/run/foo"?
This also corrects wrong owner and permissions for an existing dir.
Ulrich
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [gentoo-dev] keepdir /var/run/package/?
2010-08-13 17:04 ` Ulrich Mueller
@ 2010-08-13 19:07 ` Mike Frysinger
2010-08-14 19:39 ` Ulrich Mueller
0 siblings, 1 reply; 15+ messages in thread
From: Mike Frysinger @ 2010-08-13 19:07 UTC (permalink / raw
To: gentoo-dev
On Fri, Aug 13, 2010 at 1:04 PM, Ulrich Mueller wrote:
> On Fri, 13 Aug 2010, 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
>
> Why not "checkpath -d -o fowner:fgroup -m 0755 /var/run/foo"?
i thought there was something. that was the whole point of Bug
192682. if we dont get openrc out the door, i'll have to add to
baselayout-1.
-mike
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [gentoo-dev] keepdir /var/run/package/?
2010-08-13 19:07 ` Mike Frysinger
@ 2010-08-14 19:39 ` Ulrich Mueller
2010-08-14 20:46 ` Mike Frysinger
0 siblings, 1 reply; 15+ messages in thread
From: Ulrich Mueller @ 2010-08-14 19:39 UTC (permalink / raw
To: gentoo-dev
>>>>> On Fri, 13 Aug 2010, Mike Frysinger wrote:
>> Why not "checkpath -d -o fowner:fgroup -m 0755 /var/run/foo"?
> i thought there was something. that was the whole point of Bug
> 192682. if we dont get openrc out the door, i'll have to add to
> baselayout-1.
I thought you already had backported checkpath?
<http://sources.gentoo.org/cgi-bin/viewvc.cgi/baselayout/branches/baselayout-1_12/bin/checkpath?view=log>
Ulrich
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [gentoo-dev] keepdir /var/run/package/?
2010-08-14 19:39 ` Ulrich Mueller
@ 2010-08-14 20:46 ` Mike Frysinger
0 siblings, 0 replies; 15+ messages in thread
From: Mike Frysinger @ 2010-08-14 20:46 UTC (permalink / raw
To: gentoo-dev
On Sat, Aug 14, 2010 at 3:39 PM, Ulrich Mueller wrote:
> On Fri, 13 Aug 2010, Mike Frysinger wrote:
>>> Why not "checkpath -d -o fowner:fgroup -m 0755 /var/run/foo"?
>>
>> i thought there was something. that was the whole point of Bug
>> 192682. if we dont get openrc out the door, i'll have to add to
>> baselayout-1.
>
> I thought you already had backported checkpath?
> <http://sources.gentoo.org/cgi-bin/viewvc.cgi/baselayout/branches/baselayout-1_12/bin/checkpath?view=log>
clearly i cant remember anything anymore. checkpath is indeed in
stable baselayout.
-mike
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2010-08-14 20:46 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-12 18:29 [gentoo-dev] keepdir /var/run/package/? Eray Aslan
2010-08-12 18:36 ` Michael Sterrett
2010-08-12 18:42 ` Eray Aslan
2010-08-12 18:48 ` Samuli Suominen
2010-08-12 19:02 ` Jeremy Olexa
2010-08-12 19:33 ` Eray Aslan
2010-08-12 19:40 ` Mike Frysinger
2010-08-13 16:17 ` Mike Frysinger
2010-08-13 16:19 ` Mike Frysinger
2010-08-13 17:04 ` Ulrich Mueller
2010-08-13 19:07 ` Mike Frysinger
2010-08-14 19:39 ` Ulrich Mueller
2010-08-14 20:46 ` Mike Frysinger
2010-08-13 16:20 ` Jeroen Roovers
2010-08-12 18:37 ` "Paweł Hajdan, Jr."
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox