On Sun, 28 Jun 2020 at 11:08:36 +0200, Niels Thykier wrote:
> Simon McVittie:
> > For now I'm going to put a workaround in mutter to create its own
> > temporary XDG_RUNTIME_DIR, but it seems a shame not to be able to take
> > advantage of debhelper solving this problem centrally.
> 
> Finally, there is the third option of rolling back this feature as
> premature and dysfunctional until a better solution can be found.  I
> doubt neither of us wants it, but I think the previous status-quo was
> better than broken builds that are hard to work around.

The workaround in mutter[1] isn't *too* awful. The most problematic
thing about it is that the logic for it has to be "inside" dh_auto_test;
setting the XDG_RUNTIME_DIR in d/rules is no longer effective, because
debhelper overrides it. This is easy enough with Meson but would be a
pain to do in Autotools.

I think this is more likely to be a problem for XDG_RUNTIME_DIR than
for HOME, because:

- the only common implementation of XDG_RUNTIME_DIR is systemd's,
  which uses a short path, meaning users of that interface do not expect
  to see longer paths;
- the only other implementation I'm aware of is Ubuntu's pam_xdg from
  before they used systemd, which also uses a short path (a different one);
- upstream developers know that home directories are
  arbitrary/uncontrolled, so are more cautious about making assumptions
  about them than about XDG_RUNTIME_DIR;
- and XDG_RUNTIME_DIR is mostly for sockets, which have the hard 108 byte
  limit, whereas HOME is mostly for regular files and directories,
  which don't

So I think even if you decide to revert the XDG_RUNTIME_DIR part of
this feature, that doesn't necessarily imply that you should revert the
HOME part too. (Also, setting your own XDG_RUNTIME_DIR is a lot simpler
than remembering that when you set your own HOME, you also have to unset
XDG_{CACHE,CONFIG,DATA}_{HOME,DIRS}, which has caught me out in the past.)

I wonder whether it would be viable to create an XDG_RUNTIME_DIR in /tmp
on entry to dh_auto_test, and delete it before dh_auto_test exits? It
seems to me that dh_auto_test is the debhelper step that is most likely
to want to put sockets in XDG_RUNTIME_DIR. By creating a temporary
XDG_RUNTIME_DIR before testing and deleting it afterwards, you'd
effectively be pretending that the beginning of testing was the
transition from 0 to 1 logins as this uid, and pretending that the end
of testing was the transition from 1 to 0 logins, which seems like a
reasonable mental model for what is going on.

    smcv

[1] 
https://salsa.debian.org/gnome-team/mutter/-/commit/2650f22af313674cacec7cd3dab905c032c8dc18

Reply via email to