-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Transient Unit name for applications #302
Comments
Sounds good! I created a PR to implement this. I added a dash between Btw., we should document that this becomes API and should not be changed in the future. |
Am I right in thinking that for services with If that's true, then xdg-desktop-portal will not always be able to rely on this convention anyway, both for dbus-broker and for dbus-daemon, because |
Correct. I would mostly see this as an effort to make the naming scheme of dbus-broker API, and then stick to the spec as closely as possible. |
Wouldn't that mean that adding a Something like this:
I think the ideal thing might be if there was a way for xdg-desktop-portal to inspect |
Or is the intention that this is deprecated, and if anything with an app-ID is installing a user-service, it should be named like If that is the intention, then it doesn't seem to have stuck yet. At the moment, on my Debian testing/unstable system, I have:
|
True, we already don't hard rely on this. Users can also start binaries directly from their command line etc. I don't think anyone disagrees that we should still try to make applications start in services/slices which adhere to this convention whenever possible.
This doesn't solve the issue with systemd services, does it? Even if the dbus service file contains the appid, if the systemd service name will always be whatever the systemd service file is. This might still be a good idea. It makes sure only apps end up with the "app-" prefix and not random services which don't happen do have a corresponding systemd service. On the other hand this opt-in requires the app developers to adjust to it. Just looking for a corresponding desktop file doesn't have those issues (but requires the .service and .desktop files to be named to same).
Isn't this basically already the case according to the systemd desktop integration spec? It says:
Apparently @benzea wrote this. Any opinion?
Yeah, I think we should push for that but I'm not sure what that would involve. |
Sorry, I wasn't clear enough about I don't think adding the app ID to the D-Bus service file would be useful, because the important thing on D-Bus is the bus name, which should match the app ID anyway. The D-Bus service file should ideally always be The names of systemd service files have traditionally used the same short name you might use in |
The API would guarantee that a missing The current naming-scheme already allows this, but as @swick correctly pointed out, this has not been part of our API guarantees in any way and is really fragile to rely upon. Hence, the proposed switch to a documented naming scheme plus documenting this as ABI. I am open to other suggestions, especially if they allow reliably deducing the appid from the dbus-activation file. |
Re-reading it with the knowledge that the service is a systemd service...
That would be giving up on the systemd naming convention and we would have yet another convention of how to get the app id from a process. I would much prefer to move everything over to the systemd naming convention if at all possible. The transient unit case is low hanging fruit. The systemd service case is a bit more interesting.
Sure, but on the other hand none of those are what I would consider applications. None of them have any reason to use portals and if they do, having a host app with an empty app id should just be considered authorized. That's why I was also asking if we should only enforce the systemd naming convention for transient units if the dbus service file has a corresponding desktop file (maybe require NoDisplay=false). Why do you prefer to add another key to the systemd service file instead of renaming the file according to the systemd naming convention? |
I don't prefer it, exactly, but there are two reasons I thought it should be considered:
|
This seems odd to me: usually D-Bus service files are written by application authors and only read by a message bus implementation (dbus-daemon or dbus-broker), and occasionally read/written by a sandboxed-app framework like Flatpak that needs to transform the Exec line. Applications usually only care about whether the name is activatable or not, which they canonically find out from |
I checked my install and there is literally no service for what I would consider an application. I suspect there are not many which ship with a systemd service file. Could we reasonable rename them upstream?
Not if you follow the naming schema for the systemd service file. |
This is still relevant. Not sure how to push it forward though. I think there are two problems:
I would say we can just ignore 1. and then in the future change the service file names when it makes sense. For the second issue maybe one of those is a reasonable solution:
|
Aren't you overthinking it? Maybe just assume it is an application and if it really is a service, let it define a systemd unit that should be activated. It'll get a different naming then. This is more about conventions to e.g. be able to show a desktop file belonging to a systemd unit/cgroup. |
Peronally I think the suggestion in the first post is still not a bad idea. The change is small and it would improve the situation significantly. We could revisit other measures later on. I also think that systemd services usually are not apps so them not getting the app unit naming seems like a win to me, and if they are, they can name the service files accordingly. @benzea I think you're agreeing with this? It's not entirely clear to me what you think is "overthinking". |
No, that is fine. I was thinking that it is not worth trying to decide between service and application. Just let the developers provide a service file for a service. |
I think this matter boils down to the question that smcv raised:
I have to say I am very much confused by the specification. Smcv is certainly right that the service file name of an application is part of its API. And a service might certainly be right in refusing to name its service file Further, apps might be restricted in their unit-names for other reasons. The desktop-specification is not the only place that uses unit-names as identification. Now what we could do is use unit-aliases of systemd. However, this would require runtime detection to iterate all names of a unit, rather than just check its service-ID. This is available in the PID1 D-Bus api:
If this is already what the portal does, I think it would be suitable to apply this change. In this case adding |
So, there were various points of doing this kind of convention:
I don't think that this is really an API. If someone doesn't conform, we just cannot inspect it. You'll be stuck into a generic "System" group in a task manager like GNOME Usage. Also, not sure what other restrictions/conventions there are and how much of a conflict it is in the end. |
Mh, the goal here isn't to make every cgroup follow the If avahi-daemon followed the same pattern that wouldn't be useful to us. Maybe the right route is to just fix up those cases and either add a systemd service file or a new thing to the dbus service file? The use case here is xdg-desktop-portal which does inspect the service file to get the AppID which then is used as a key for permissions. I think it's not very uniform what we do when we fail to match. Maybe we need to rethink that part as well. |
I think you might use more Flatpak apps and fewer system apps than I do, but
Several of those don't really make sense to sandbox - in particular, Nautilus really wants to be part of the TCB, because a file manager that can't access all of your files is not very useful.
I don't think we can tell which is which, at the moment. There is not enough information in a D-Bus .service file to distinguish between these D-Bus-activatable apps, and the non-app services like There is, unfortunately, also not enough information in a D-Bus .service file to be able to generate a correct systemd user service in all cases: D-Bus services are allowed to double-fork and daemonize (this is discouraged but allowed, and I believe there are real examples of services that do this), and as a result the reference dbus-daemon has a special-case code path to treat a D-Bus service exiting with status 0 before it has requested its name as not indicating failure. I believe that's the main reason why dbus-daemon's support for systemd activation (which was contributed by a systemd maintainer) needed to be opt-in via In a much earlier message, I wrote:
Runtime detection of the list of aliases, as @dvdhrm described in #302 (comment), would be one possible implementation of inspecting |
I would really like to avoid this and rather have a single thing that can be looked up because there are multiple things that want do look up this kind of information and trying to implement all those different strategies isn't viable IMO.
That sounds like the cleanest solution to me. A new |
Dbus activated processes currently live in transient units with the scheme
dbus-<unique>-<ServiceName>@<instance>.service
. The systemd Desktop Environments Integration specification says that applications should be in service or scopes which follow the following schemeapp[-<launcher>]-<ApplicationID>[@<RANDOM>].service
.xdg-desktop-portal relies on this convention to derive the app id of a calling process (when the application is not authenticated by a sandboxing specific code path). This however breaks for apps started by dbus-broker. It would be nice if it followed the convention.
Can we change the schema to
app-dbus-<ServiceName>@<unique><instance>.service
? Not all services are applications. Should we change the schema only if the service has a corresponding desktop file?The text was updated successfully, but these errors were encountered: