Bug 28826 - KeyFile should support spaces in key names and string list params that don't terminate with ;
Summary: KeyFile should support spaces in key names and string list params that don't ...
Status: RESOLVED FIXED
Alias: None
Product: Telepathy
Classification: Unclassified
Component: tp-qt (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Andre Moreira Magalhaes
QA Contact: Telepathy bugs list
URL:
Whiteboard: r+
Keywords:
Depends on:
Blocks: 28819
  Show dependency treegraph
 
Reported: 2010-06-29 18:22 UTC by Andre Moreira Magalhaes
Modified: 2010-07-01 09:05 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Andre Moreira Magalhaes 2010-06-29 18:22:21 UTC
KeyFile does not support spaces in key names which is needed to parse Protocol RequestableChannelClasses param in manager files.

Also if a string list does not terminate with ; KeyFile::valueAsStringList misses the last string.
Comment 1 Will Thompson 2010-06-30 05:43:05 UTC
-        // as an extension to the Desktop Entry spec, we allow "_", "." and "@"
+        // as an extension to the Desktop Entry spec, we allow " ", "_", "." and "@"
         // as valid key characters - "_" and "." are needed for keys that are
         // D-Bus property names, and GKeyFile and KConfigIniBackend also accept
         // all three of those characters.

There are now four extra characters, not three. Do GKF and KCIB both also accept space?

(In reply to comment #0)
> Also if a string list does not terminate with ; KeyFile::valueAsStringList
> misses the last string.

So this is being permissive when parsing malformed keyfiles?
Comment 2 Simon McVittie 2010-06-30 05:47:16 UTC
There should be a regression test for a key containing a space.

There should be regression tests for string lists that do and don't end with ";". The protocol "somewhat-pathological" in tests/telepathy/managers/test-manager-file.manager is an example of what test data for this sort of thing ought to look like: please parse all the default values.

> -        // as an extension to the Desktop Entry spec, we allow "_", "." and "@"
> +        // as an extension to the Desktop Entry spec, we allow " ", "_", "." and "@"
>          // as valid key characters - "_" and "." are needed for keys that are
>          // D-Bus property names, and GKeyFile and KConfigIniBackend also accept
>          // all three of those characters.

All four of those characters? :-P

Fact-check: does KConfigIniBackend actually accept those? I hope so...

FYI, GKeyFile rejects spaces at the beginning or end of a key, and has special handling for square brackets (they must be paired and can only contain alphanumerics or "-_.@", which are enough for all locales).

We should watch out for this in telepathy-spec in future...
Comment 3 Andre Moreira Magalhaes 2010-06-30 06:43:36 UTC
(In reply to comment #2)
> There should be a regression test for a key containing a space.
> 
> There should be regression tests for string lists that do and don't end with
> ";". The protocol "somewhat-pathological" in
> tests/telepathy/managers/test-manager-file.manager is an example of what test
> data for this sort of thing ought to look like: please parse all the default
> values.
Done

> > -        // as an extension to the Desktop Entry spec, we allow "_", "." and "@"
> > +        // as an extension to the Desktop Entry spec, we allow " ", "_", "." and "@"
> >          // as valid key characters - "_" and "." are needed for keys that are
> >          // D-Bus property names, and GKeyFile and KConfigIniBackend also accept
> >          // all three of those characters.
> 
> All four of those characters? :-P
Done

> 
> Fact-check: does KConfigIniBackend actually accept those? I hope so...
Just checked and KCIB does accept _everything_ as key values. It finds the first = and everything before it is the key. The key can have [] which are treated specially.

Note that we do not support [] yet. We can always add support later when/if needed.

> FYI, GKeyFile rejects spaces at the beginning or end of a key, and has special
> handling for square brackets (they must be paired and can only contain
> alphanumerics or "-_.@", which are enough for all locales).
We also ignore spaces in the begin/end of a key (We trim the string). We need to support spaces (not in the begin/end), cause RequestableChannelClasses need it. Unless we change RequestableChannelClasses definition in .manager file, we need it.

> We should watch out for this in telepathy-spec in future...
Indeed
Comment 4 Andre Moreira Magalhaes 2010-07-01 09:05:46 UTC
Merged upstream. It will be in next release 0.3.6.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.