Invocation of the interface "g_key_file_remove_comment" does not remove comment in specific case
Submitted by Areg Beketovski
Link to original bug (#476852)
Description
Please describe the problem: Invocation of the interface g_key_file_remove_comment with parameters group_name = "some_group", key = "NULL" does not remove comment above the group. This is caused by duality of the comment structure. In implementation of the "g_key_file_set_comment" interface used "comment" field of the structure, but when loading from file or data then the parsing used "NULL" key in the map.
Steps to reproduce:
- Load a key file from data.
- Call g_key_file_remove_comment with group "group_name" = "Second Group"(existing group in the key file), "key" = NULL. The correct behaviour is to remove the comment above the "Second Group" group, which contains "Third Comment" text.
- Call g_key_file_get_comment with same parameters. If the comment is removed by the previous call the g_key_file_get_comment returns NULL. Otherwise the g_key_file_get_comment returns a text of the comment that demonstrates incorrect behaviour of the g_key_file_remove_comment.
Actual results: "g_key_file_get_comment" returns the text of the comment.
Expected results: The NULL should be returned when calling "g_key_file_get_comment".
Does this happen every time? Yes
Other information: The detailed bug description can be found at:
http://linuxtesting.org/results/report?num=D0027
Version: 2.14.x