Dashes and underscores in desktop file IDs
Matthias Klumpp
matthias at tenstral.net
Mon Oct 16 12:16:05 UTC 2017
Hey, sorry for the late reply!
2017-10-11 13:28 GMT+02:00 Simon McVittie <smcv at collabora.com>:
> For historical reasons, D-Bus well-known bus names allow both dashes
> and underscores (but D-Bus object paths and interface names don't allow
> dashes). The Desktop Entry Specification has inherited this oddity.
> This causes intermittent problems in adjacent specifications like
> Flatpak app IDs and the DBusActivatable API, where there need to be
> strange special cases if you happen to own a domain name containing
> dashes, most recently
> <https://github.com/flatpak/flatpak-builder/issues/37>
> <https://github.com/parnold-x/nasc/issues/67> and
> <https://github.com/elementary/houston/issues/436>.
>
> Relatedly, it isn't obvious what to do if your domain name contains
> a label (element) starting with a digit. I would like to clarify this
> by putting some recommendations and anti-recommendations in the
> relevant specifications, so that the story is clearer for app authors.
> It would be a compatibility break to actually *forbid* one or the other,
> but I think we can safely recommend against it (as in SHOULD NOT rather
> than MUST NOT).
Sounds good to me!
> I personally think the recommendation should be:
>
> * Don't use dashes in new app IDs
> * Replace dashes with underscores
> * Prepend an underscore to elements that would otherwise start with a
> digit
>
> and I've proposed some possible patches for the Desktop Entry spec on
> <https://bugs.freedesktop.org/show_bug.cgi?id=103216>. The D-Bus
> Specification should also have a corresponding change, when we've
> agreed on what the change should be.
>
> If there is consensus that the recommendation should be dashes and not
> underscores, I'd be willing to go with that instead, but I think we
> should pick one.
Is there a chance that DBus and other tools can get rid of the naming
limitations anytime soon? Or does the "no-digit-start, no-dash" rule
have to stay forever?
> Unfortunately it looks as though the AppStream spec currently allows
> dashes but not underscores, which (if enforced) conflicts fairly badly
> with Flatpak renaming AppStream XML that doesn't match the Flatpak app
> IDs (underscores but not dashes). Would the maintainers of AppStream
> be willing/able to relax the spec for <id> to allow underscores?
Urgh, that is definitely a bug, AppStream should allow underscores for
sure. I will fix that with the next release.
> If not, then I think the AppStream spec should explain what you should
> do if your desktop file ID contains an underscore (presumably replacing
> it with a dash).
There's no need for that, fortunately :-)
I will add the naming recommendations you outlined above to AppStream
in the next release, because the AppStream ID is used by Flatpak to
generate bundle names (and to reduce confusion). The AS spec should
really allow underscores, because they are an allowed character in
domain names, so that part is just a bug, and likely my mistake.
Thanks for raising this issue!
Cheers,
Matthias
More information about the Flatpak
mailing list