Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: Ian Stakenvicius <axs@g.o>
Cc: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] tmpfiles virtual
Date: Thu, 17 Nov 2016 20:51:24
Message-Id: 20161117215021.70b5ac48.mgorny@gentoo.org
In Reply to: Re: [gentoo-dev] tmpfiles virtual by Ian Stakenvicius
1 On Thu, 17 Nov 2016 15:07:32 -0500
2 Ian Stakenvicius <axs@g.o> wrote:
3
4 > On 17/11/16 02:42 PM, Michał Górny wrote:
5 > > The package does not depend on functionality provided by tmpfiles.d.
6 > > The package does depend on directory being created. Which was normally
7 > > done via keepdir.
8 > >
9 >
10 > Last I checked, tmpfiles.d *.conf filed did a whole lot more than just
11 > ensure missing directories are created. Has the functionality been
12 > stripped down to just that, now?
13
14 The basic and most common functionality is creating files/dirs,
15 and ensuring permissions. The additional functionality includes writing
16 data to existing files (like procfs) and cleanups. However, the latter
17 can only be safely done at boot, so we're more focused on the former.
18
19 > > However, then William changed /var/run to a symlink to /run. Now all
20 > > packages that relied on keepdir need tmpfiles.d or some other magic to
21 > > recreate the directories.
22 >
23 > OpenRC's init scripts all do that already, more or less. tmpfiles.d
24 > *.conf files are not used for this purpose -- definitely not by
25 > OpenRC, and most likely also not by upstream packages.
26
27 So do you expect all eix users to have to run an init script for eix to
28 be able to use it?
29
30 > > The whole point of the eclass is to provide a reasonable way to combine
31 > > both without having to do the same thing twice. That is, create
32 > > the directory in postinst and install a tmpfiles.d entry to make it
33 > > possible to recreate it on boot.
34 >
35 > I thought the reason for the eclass was so that when a package is
36 > installed, you don't need to reboot or otherwise trigger manually your
37 > system's tmpfiles.d processing to have it do the first-run process
38 > with the new *.conf file?
39
40 Yes. That is, to have the temporary directories/files created and/or
41 permissions set without having to reboot your system. Or to do that
42 manually in the ebuild, when you're already installing a well-defined
43 file that explains how to do that.
44
45 > > If someone is not using OpenRC or systemd, he doesn't need tmpfiles.d
46 > > implementation more than to run postinst.
47 >
48 > Sure he does. eix needs it to ensure files exist in /var/cache/ , for
49 > instance. dhcpd needs it to ensure /var/lib/dhcpd/dhcpd.leases exists
50 > and has the correct permissions. Neither of those has got anything to
51 > do with openrc's needs at boot time. Whether it's openrc or a fork of
52 > upstart or some strange busybox-only script or whatever init/rc system
53 > that's used, opentmpfiles provides the capability of processing these
54 > tmpfiles.d *.conf files and can be triggered at boot time to do it (or
55 > via cron, or with it being started as a daemon maybe later I presume)
56
57 You're missing the point. A purely minimal OpenRC-free system with no
58 volatile filesystems doesn't require any specific action at boot. It's
59 perfectly happy with the directories created by ebuild. Why would you
60 require the user of that system to install a tool he won't be using
61 anyway?
62
63 > > After postinst, the directory
64 > > is created and the user is happy. However, if he uses OpenRC, then
65 > > OpenRC will make sure the directory disappears on next boot.
66 > >
67 > > So why should ebuild add dependencies to solve a limitation caused by
68 > > OpenRC?
69 >
70 > This would be because opentmpfiles is its own project now rather than
71 > something shipped as part of (or even needed by) openrc. And so, it's
72 > now a runtime dep *when and only when* not processing the tmpfiles.d
73 > *.conf file is going to make the package fail at runtime, internally
74 > and intrinsically to the package itself (not to its init script or any
75 > other init/rc related thing).
76
77 Are you going to expect all packages with init scripts to depend
78 on OpenRC now, because your common-assumed use case requires the init
79 script to do something? Should we also make them depend on systemd at
80 the same time for completeness? And possibly on bash, vim, etc. so that
81 all those extra files get really used.
82
83 > Realistically, software should ensure the directories it needs at
84 > runtime are created through their own code, but upstreams are lazy and
85 > so they don't bother because, hey, we can have this tmpfiles.d *.conf
86 > file to have the system do it for us! In those cases, we'd need that
87 > rdepend.
88
89 So now I'm disallowed to run eix-update as a regular user because it
90 should be able to create its own directory that normally the packaging
91 should ensure?
92
93 > -----
94 >
95 > Part of what you brought up here did trigger a bit of a concern for me
96 > though, and that is, we want to be careful that we as developers and
97 > package maintainers don't start using this eclass and tmpfiles.d
98 > *.conf files -instead of- keepdir. I'm hoping that this was never the
99 > intention, but in case it was I wanted to check.
100
101 It is the intention whenever the directory is volatile. In other words,
102 whenever Portage already spits a big QA warning that your keepdir is
103 not going to survive a reboot and/or cache cleanup.
104
105 --
106 Best regards,
107 Michał Górny
108 <http://dev.gentoo.org/~mgorny/>

Replies

Subject Author
Re: [gentoo-dev] tmpfiles virtual Ian Stakenvicius <axs@g.o>