[prev in list] [next in list] [prev in thread] [next in thread]
List: freedesktop-dbus
Subject: Re: Escaping for paths
From: Thiago Macieira <thiago.macieira () trolltech ! com>
Date: 2006-06-15 19:21:00
Message-ID: 200606152121.00492.thiago.macieira () trolltech ! com
[Download RAW message or body]
Ross Burton wrote:
>Hi,
>
>Several applications are writing methods to escape strings so that they
>can be used in object paths (specifically Network Manager does this, and
>eds-dbus has taken code from NM too). EDS is using it so that it can
>return an object path of the
>form /org/gnome/evolution/addressbook/[uri], where obviously the URI
>needs to be escaped.
>
>I think it would be useful for DBus to contain a function that escaped
>an arbitrary string so that it could be used in an object path to avoid
>this needless wheel re-inventing. Anyone else agree?
I discussed this very issue with another developer yesterday. The issue in
question was bookmarks instead of addressbooks, but it's exactly the same
use-case.
My conclusion is that we should not provide such a generic method. I
believe it's dangerous. I'd much rather see the applications internally
changed to avoid this kind of problem.
In this example, what I would instead propose is that the object
at /org/gnome/evolution/addressbook provide a method called "FindURI" or
something similar, which would take the URI and return an object path to
the internal object. This would have the added benefit of on-demand
loading, since there's a call before the actual object access.
I also don't believe this kind of functionality belongs in the core
library. Validation? Yes. Escaping? I don't think so.
The reason why I think it's dangerous is that two different URIs or
pathnames could escape to the same object path. For example, imagine I
had addressbooks:
/home/thiago/address_book-vcf
/home/thiago/address_book.vcf
(that's a Greek alpha and a Greek beta)
Both would escape to /home/thiago/address_book_vcf or
_home_thiago_addres_book_vcf.
The only solution would be to select one of the characters we have to be
an escape character, like % in URIs. The above example would
be /home/thiago/address_5fbook_2dvcf
and /home/thiago/address_5fbook_2evcf, or
_2fhome_2fthiago_2faddress_5fbook_2dvcf and
_2fhome_2fthiago_2faddress_5fbook_2evcf. If people push arbitrary data
into this function, it would have the potential to increase the length
threefold.
Or to completely escape everything (yielding something ugly like:
_2f686f6d652f74686961676f2f61646472657373626f6f6b2e7663660a)
--
Thiago José Macieira - thiago.macieira AT trolltech.com
Trolltech ASA - Sandakerveien 116, NO-0402 Oslo, Norway
[Attachment #3 (application/pgp-signature)]
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic