weston does not fallback gracefully if $XDG_RUNTIME_DIR is not set

Bug #1058211 reported by Darxus on 2012-09-28
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Weston
Won't Fix
Medium
weston (Ubuntu)
Undecided
Unassigned

Bug Description

Without $XDG_RUNTIME_DIR set, weston won't start. This package handles it more properly than the user setting it manually.

(It's possible the switch to not starting happened after this release, and this release will start, resulting in things not working for reasons that aren't very clear to the user - server and clients ending up with different $XDG_RUNTIME_DIRs.)

Not certain if it should be depends, recommends, or suggests. But recommends seems right to me.

libpam-xdg-support was very recently packaged for bug 894391, blueprint foundations-q-xdg-runtime-dir.

Darxus (darxus) on 2012-09-28
description: updated
description: updated
Logan Rosen (logan) on 2012-09-28
Changed in weston (Ubuntu):
status: New → In Progress
assignee: nobody → Logan Rosen (logan)
Dimitri John Ledkov (xnox) wrote :

Preferably don't add this dependency. This should be seeded as part of ubuntu-desktop, and weston itself should fall back to $something_sensible if the path isn't set.

from the spec http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
"""
If $XDG_RUNTIME_DIR is not set applications should fall back to a replacement directory with similar capabilities and print a warning message. Applications should use this directory for communication and synchronization purposes and should not place larger files in it, since it might reside in runtime memory and cannot necessarily be swapped out to disk.
"""

Changed in weston (Ubuntu):
status: In Progress → Confirmed
summary: - Add "recommends" for libpam-xdg-support
+ weston does not fallback gracefully if $XDG_RUNTIME_DIR is not set
Dimitri John Ledkov (xnox) wrote :

I am not sure what good fallback location is.

Changed in weston (Ubuntu):
assignee: Logan Rosen (logan) → nobody
Darxus (darxus) wrote :

And that is why there isn't one.

"[libpam-xdg-support] should be seeded as part of ubuntu-desktop...."

Is that a personal opinion, or something that is actually going to happen?

Steve Langasek (vorlon) wrote :

> Is that a personal opinion

No, this is the whole reason pam-xdg-support was written in the first place.

Individual applications should not, in general, recommend specific pam modules.

Steve Langasek (vorlon) wrote :

> I am not sure what good fallback location is.

Check the behavior of e.g., nautilus or dconf for comparison. I believe they fall back to something under the user's homedir - that's not guaranteed to be local, but it's guaranteed to exist and be writable.

Darxus (darxus) wrote :

Great, thanks. In that case I'm fine with weston having no recommends for libpam-xdg-support.

From #weston:

--- Day changed Thu Sep 06 2012
15:52 < smallfoot-> weston should work without XDG_RUNTIME_DIR
15:52 < smallfoot-> as per the spec
15:52 < smallfoot-> http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html#variables
15:52 < smallfoot-> "If $XDG_RUNTIME_DIR is not set applications should fall back to a replacement directory with similar
capabilities and print a warning message. "
16:13 < Darxus> smallfoot-: That's kind of funny.
16:20 < krh> smallfoot-: the funny thing is, there is no directory with similar capabilities
16:33 < smallfoot-> krh, oh, maybe ~/tmp/ or /tmp/ or /run/user/ ?
16:34 < smallfoot-> today mountall was updated in ubuntu from 2.38 to 2.40 which have /run/user/ and the preliminary work for XDG_RUNTIME_SUPPORT, the other part is missing is a PAM module
16:36 < smallfoot-> https://bugs.launchpad.net/ubuntu/+source/consolekit/+bug/894391
16:38 < thiago> $HOME could be network-mounted
16:38 < thiago> it could also be SMB, which means no sockets
16:38 < thiago> /tmp is insecure, since other users can write to it
16:39 < thiago> and /run/user/$USER *is* XDG_RUNTIME_DIR. If your distro creates it, why doesn't it set the variable?
16:43 < smallfoot-> oh
16:43 < thiago> but we could create a secure dir in /tmp
17:27 < uartie> smallfoot: http://lists.freedesktop.org/archives/wayland-devel/2012-June/003935.html
17:28 < Darxus> Heh.
17:29 < Darxus> uartie: There were problems with people not realizing it was using ./ and as a result trying to run clients from a different directory than where they ran weston.
17:30 < Darxus> Creating a secure directory in /tmp seems good.
17:30 < uartie> yeh

The link in there is to a post by krh (creator of wayland) to the mailing list on the same subject: http://lists.freedesktop.org/archives/wayland-devel/2012-June/003935.html

I don't really mind weston just failing if $XDG_RUNTIME_DIR is not set. I think it cut down on confusion considerably.

Darxus (darxus) wrote :

My interest in this bug is resolved with ubuntu-desktop now having a dependency on libpam-xdg-support.

Is there any real chance anybody here is going to do anything on what the summary was changed to, the lack of fallback if $XDG_RUNTIME_DIR is not set, especially now that it will be set by default for everyone due to the above, or should it be closed "won't fix"?

Currently weston aborts if XDG_RUNTIME_DIR is unset. However the XDG base dir spec says:

"If $XDG_RUNTIME_DIR is not set applications should fall back to a replacement directory with similar capabilities and print a warning message."[1]

This is specially problematic because of weston-launch resetting the environment (bug 61877).

[1] http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html

Explanation for current behavior by pq here: http://lists.freedesktop.org/archives/wayland-devel/2013-March/007902.html

Contents:

> But still, Emilio, the reason we on purpose fail on missing
> XDG_RUNTIME_DIR is that there is no suitable "replacement directory
> with similar capabilities" to be found in general.
>
> For example, falling back to anything under $HOME will fail for
> nfs-mounted home, I believe.
>
> The requirements for XDG_RUNTIME_DIR are actually quite difficult
> to fill without specific distribution support. Especially the following:
>
> "The directory MUST be on a local file system and not shared with
> any other system. The directory MUST by fully-featured by the
> standards of the operating system. More specifically, on Unix-like
> operating systems AF_UNIX sockets, symbolic links, hard links,
> proper permissions, file locking, sparse files, memory mapping,
> file change notifications, a reliable hard link count must be
> supported, and no restrictions on the file name character set
> should be imposed."
>
> - http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
>
> Therefore we want the user to explicitly shoot himself in the
> foot if they have to. We actually used to have a fallback for
> XDG_RUNTIME_DIR being unset, and it only caused confusion.

Changed in weston:
importance: Unknown → Medium
status: Unknown → Confirmed

"Yup, not much to add here, that is the reason for how things work." - krh

Closing "wontfix". Let us know if you have better, specific ideas.

Changed in weston:
status: Confirmed → Won't Fix
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.