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 746123 - Delete .commitmeta file when writing empty metadata
Delete .commitmeta file when writing empty metadata
Status: RESOLVED FIXED
Product: ostree
Classification: Infrastructure
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: OSTree maintainer(s)
OSTree maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2015-03-13 01:08 UTC by Matthew Barnes
Modified: 2015-03-13 16:37 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch (2.63 KB, patch)
2015-03-13 01:21 UTC, Matthew Barnes
accepted-commit_now Details | Review

Description Matthew Barnes 2015-03-13 01:08:14 UTC
Now that I have GPG signature deletion working I found a bug with ostree_repo_write_commit_detached_metadata().

When the last signature is deleted I remove the "ostree.gpgsigs" key from the metadata dictionary.  This is often the only key that was in the metadata, which means the dictionary is now empty.

Apparently g_variant_get_data() returns NULL on a normalized, empty dictionary, and g_file_replace_contents() is not happy about that.

I suggest deleting the .commitmeta file if g_variant_get_size() returns 0.
Comment 1 Matthew Barnes 2015-03-13 01:21:00 UTC
Created attachment 299256 [details] [review]
Proposed patch

Too simple for a pull request.
Comment 2 Colin Walters 2015-03-13 15:23:25 UTC
Review of attachment 299256 [details] [review]:

Right.

(Though do note I'd like to port this code to *at relative at some point, doesn't have to be this commit though)
Comment 3 Matthew Barnes 2015-03-13 16:07:06 UTC
Understood.  Don't want to conflate a bug fix with porting work.