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 663432 - GKeyFile rejects empty files
GKeyFile rejects empty files
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
: 656192 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2011-11-04 22:06 UTC by Jürg Billeter
Modified: 2012-01-04 05:38 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch (893 bytes, patch)
2011-11-04 22:06 UTC, Jürg Billeter
accepted-commit_now Details | Review
GKeyFile: Accept empty files (942 bytes, patch)
2011-11-18 04:12 UTC, Matthias Clasen
committed Details | Review

Description Jürg Billeter 2011-11-04 22:06:13 UTC
Created attachment 200717 [details] [review]
Proposed patch

g_key_file_load_from_fd explicitly checks for empty files and returns a parse error in this case. However, it happily accepts other files without actual content, e.g., files consisting solely of whitespace. The attached patch simply drops this check.

The desktop entry spec¹ doesn't say anything about rejecting empty files, however, that spec also requires a [Desktop Entry] group header, so it is too specific to be used as reference in this case.

¹ http://standards.freedesktop.org/desktop-entry-spec/latest/
Comment 1 Matthias Clasen 2011-11-11 16:33:08 UTC
Review of attachment 200717 [details] [review]:

Seems reasonable, indeed.
Comment 2 Matthias Clasen 2011-11-18 04:12:10 UTC
The following fix has been pushed:
fcffe6a GKeyFile: Accept empty files
Comment 3 Matthias Clasen 2011-11-18 04:12:12 UTC
Created attachment 201642 [details] [review]
GKeyFile: Accept empty files

It already accepts files consisting solely of whitespace.
Comment 4 Matthias Clasen 2012-01-04 05:38:47 UTC
*** Bug 656192 has been marked as a duplicate of this bug. ***