path name rules
Havoc Pennington
hp at redhat.com
Mon Oct 3 08:10:09 PDT 2005
On Mon, 2005-10-03 at 08:16 -0300, Claudio Takahasi wrote:
> Hi folks,
>
> I am developing D-Bus services for BlueZ. We would like define paths
> names based on bluetooth device address, eg:
> "/org/bluez/Manager/00:0D:88:BE:89:BA/Network".However, according with
> D-Bus specification it is NOT possible use the character ":" in the
> middle of the path name. Is there a reason for doesn't allow the
> character ":" in the middle of the path name?
>
> Specification description:
>
> - The path must begin with an ASCII '/' (integer 47) character, and
> must consist of elements separated by slash characters.
> - Each element must only contain the ASCII characters
> "[A-Z][a-z][0-9]_"
>
If we allow all characters, it will be a big pain in the butt since
paths will have to be escaped wherever they are _used_ (in html, shell
scripts, language bindings, etc.) So it's a whitelist of characters and
paths have to be escaped when they are _created_.
Why underscore and not : is basically because it doesn't seem worth
going through ascii and thinking about each character one-by-one, and it
seems easier for dbus programmers to remember "just alphanumeric and
underscore" than "alphanumeric and random list of exceptions"
If I try to rationalize it, I could say that afaik nothing important has
underscore as a special character. : is not often a special character,
but it isn't allowed in most programming language identifiers and the
shell uses it as a path separator.
But mostly it's just we aren't going to include every char so the
simplest is to just say alphanumeric only.
Also, hyphen deliberately omitted so people don't get to make up their
own mind on the "hyphen vs. underscore" debate ;-) and we have
consistent conventions.
Havoc
More information about the dbus
mailing list