[systemd-devel] [PATCH] tmpfiles: only execute chmod()/chown() when needed

Dave Reisner d at falconindy.com
Fri Jul 11 15:04:43 PDT 2014


On Fri, Jul 11, 2014 at 02:26:13PM -0700, Colin Walters wrote:
> 
> 
> On Fri, Jul 11, 2014, at 06:05 AM, Michael Olbrich wrote:
> > This avoids errors like this, when the paths are already there with the
> > correct permissions and owner:
> > 
> > chmod(/var/spool) failed: Read-only file system
> 
> I'd say we should avoid running systemd-tmpfiles if the filesystem is
> read only.  In your case is / read-write even?  What do you think about
> e.g.:

No way. This precludes tmpfiles from creating directories in /run.

> diff --git a/units/systemd-tmpfiles-setup.service.in
> b/units/systemd-tmpfiles-setup.service.in
> index 72ab083..c5b6416 100644
> --- a/units/systemd-tmpfiles-setup.service.in
> +++ b/units/systemd-tmpfiles-setup.service.in
> @@ -13,6 +13,7 @@ Conflicts=shutdown.target
>  After=systemd-readahead-collect.service
>  systemd-readahead-replay.service local-fs.target
>  systemd-sysusers.service
>  Before=sysinit.target shutdown.target
>  RefuseManualStop=yes
> +ConditionPathIsReadWrite=/
>  
>  [Service]
>  Type=oneshot
> 
> See also
> https://git.gnome.org/browse/ostree/commit/?id=ff6883ca0655ac8844cd783caf6a7d8815515ba3
> 
> > +        if (stat(path, &st) >= 0) {
> 
> I don't think we want to follow symlinks here, right?
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel


More information about the systemd-devel mailing list