Dashes and underscores in desktop file IDs
Alexander Larsson
alexl at redhat.com
Mon Oct 16 12:40:44 UTC 2017
On Mon, 2017-10-16 at 14:16 +0200, Matthias Klumpp wrote:
> 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?
Flatpak sort of relies on this in the exported-filename-prefix rules.
In particular, to avoid conflicts, all exported files must have the app
id as prefix, followed by a dot, or an invalid character.
So, for example org.the.App is allowed to export:
org.the.App
org.the.App.png
org.the.App-symbolic.png
But not:
org.the.AppOther
org.the.App_symbolic.png
So, if - was allowed, then we could not export the symbolic icons.
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Alexander Larsson Red Hat, Inc
alexl at redhat.com alexander.larsson at gmail.com
He's a scarfaced soccer-playing farmboy with a mysterious suitcase
handcuffed to his arm. She's a cosmopolitan foul-mouthed Valkyrie with an
incredible destiny. They fight crime!
More information about the dbus
mailing list