After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 750659 - NMConfig doesn't strip keyfile strings
NMConfig doesn't strip keyfile strings
Status: RESOLVED FIXED
Product: NetworkManager
Classification: Platform
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: NetworkManager maintainer(s)
NetworkManager maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2015-06-09 19:32 UTC by Dan Williams
Modified: 2015-07-07 14:06 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Dan Williams 2015-06-09 19:32:41 UTC
nm-config.c should g_strstrip() values it reads from the config files.  Probably should just create a nm_config_keyfile_get_string() that does:

return g_strstrip (g_key_file_get_value ());

and then use that in most places, but definitely in init_sync().
Comment 1 Thomas Haller 2015-06-10 15:31:37 UTC
On branch th/nm-config-intern-bgo750558 there is patch
  "config: fix usage of g_key_file_get_value() vs. g_key_file_get_string()"

That might be relevant for seeing wrong values.


Also, I just added a patch:
  "config: ensure nm_config_get_plugins() to return stripped values"
to th/nm-config-intern-bgo750558.

In this case, nm_config_get_plugins() _will_ return stripped values. Because it understands that for "plugins" it makes no sense to have white-space.

But IMO it is wrong to do it on the native values as returned by
  nm_config_data_get_value().
NMConfig doesn't know the meaning of these values, it should not pre-mangle them.
Comment 2 Thomas Haller 2015-07-07 14:06:59 UTC
bug 750558 was fixed and th/nm-config-intern-bgo750558 got merged upstream (in two parts).

master:
http://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?id=65753dbc133f77ccd5531288aab9a9e80da3b786
http://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?id=05db3ee08a30edc503e2b9033993ee3d2cbf019f

the first part fixes this bug and was backported to nm-1-0:
http://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?id=cf15f2a4a82f085d67f54f49ab9355d0d40c0969



It does not unconditionally strip values, but it
  - strips values for properties where it makes sense (for "connectivity.url"
    but not for "connectivity.response").
  - several fixes of how to parse the value. E.g.
    http://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?id=df1cd73
  - fix whitespace handling for device-specs
  - config: add NMConfigGetValueFlags argument to nm_config_data_get_value() 
    http://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?id=1b66696

IMO this fixes the bug and I'm closing this one.
Let's open a new bug if there are still issues.