[Merge] lp:~xnox/upstart/user-log-dir into lp:upstart
James Hunt
james.hunt at canonical.com
Thu Jan 17 14:20:29 UTC 2013
> > OK, you've convinced me on paths.h :-)
> >
> > I've updated the spec such that we have a script which sets the appropriate
> > XDG vars if not already set *and* creates them if they don't exist. It will
>
> no, this is wrong again.
> It's perfectly valid to not have XDG_HOME_* variables set, as by default the default fallbacks should be used.
> It's only meant for a user to change them if they want to launch set of applications with "clean" config, cache.
> The XDG_RUNTIME_DIR in ubuntu is already set by libpam-xdg-support
> https://blueprints.launchpad.net/ubuntu/+spec/foundations-q-xdg-runtime-dir
>
> So these variables should not be set, if they don't already exist.
>
> Creating the directories if they don't yet exist is a good point. Especially brand new accounts, might not have those directories.
The reason for my specifying in the spec that we create the directories is that if they do not already exist, we end up with impotent inotify watches: meaning no job logging and no way for a user to create jobs *after* they create ~/.config/upstart/ manually. All very confusing from the users perspective. However, yes, seemingly we should not set them, implying Upstart needs to handle this.
> Oh and as per XDG spec we should create them with permissions 0700 if we need to access them.
Right.
>
> The spec is unclear about XDG_RUNTIME_DIR, I'd like to assert if it doesn't exist. In ubuntu it exists in quantal and up. To be compliant with the spec we should gracefully fallback to some other place, but I don't know what that other place is a good to fallback to.
Asserting is a little harsh. If it's not set, how about we display a warning and then fall back to ${TMPDIR}/${USER} and if that's not set, /tmp/${USER}? Steve?
>
> > then start the Session Init. However, I wonder if the Session Init should also
> > attempt to create the directories returned by xdg_get_cache_home() and
> > xdg_get_config_home() to handle the scenario that a user logs in multiple
> > times and in the first session say deletes one or both of these directories.
Lets go with this then and I'll revert the spec change.
> >
>
> I don't like the idea of creating empty directories, just to place inotify watch on it (for the $XDG_CONFIG_HOME/upstart).
> We intend to generate logs everytime, so precreating $XDG_CACHE_HOME/upstart makes sense.
See above: we need to do both as what is the point in creating the log directory if no jobs can be registered if the config directory does not exist? 1 inotify watch is a small price to pay for sane behaviour. Added to which there is precedent: we already create a watch for /etc/init.conf.
>
> > I think that to be conformant to the XDG spec, the alluded-to script can as
> > Dmitrijs says run 'initctl list-sessions' and if that returns nothing, remove
> > XDG_RUNTIME_DIR before exiting.
> >
>
> I believe XDG_RUNTIME_DIR is cleaned up for us after the last logout. I'll check that. Or do you mean to clean up bits in the $XDG_RUNTIME_DIR/upstart/ that we created? E.g. remove pidfiles on exit?
What is doing the cleaning up currently? And will that need to change when Upstart is in control?
--
https://code.launchpad.net/~xnox/upstart/user-log-dir/+merge/143091
Your team Upstart Reviewers is subscribed to branch lp:upstart.
More information about the upstart-devel
mailing list