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 540656 - Cannot overwriting existing files using Gio::File::replace
Cannot overwriting existing files using Gio::File::replace
Status: RESOLVED FIXED
Product: glibmm
Classification: Bindings
Component: giomm
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2008-06-28 18:29 UTC by Armin Burgmeier
Modified: 2008-07-02 16:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch (2.59 KB, patch)
2008-06-28 18:30 UTC, Armin Burgmeier
committed Details | Review

Description Armin Burgmeier 2008-06-28 18:29:24 UTC
giomm passes an empty string instead of NULL as the etag parameter to g_file_replace or g_file_replace_async, respectively. g_file_replace does only overwrite files if the given etag matches the one of the existing file, except when the given etag is NULL. Since giomm does not allow passing NULL to the C function, it is quite troublesome to overwrite a file using that function. I propose passing NULL to the C function if the etag parameter is the empty string ("").
Comment 1 Armin Burgmeier 2008-06-28 18:30:37 UTC
Created attachment 113577 [details] [review]
Proposed patch

This patch passes NULL to the C function if the etag parameter is the empty string.
Comment 2 Murray Cumming 2008-06-29 09:02:19 UTC
Looks good. Please commit.
Comment 3 Armin Burgmeier 2008-06-29 10:30:43 UTC
Committed to trunk and glibmm-2-16.
Comment 4 Murray Cumming 2008-07-02 12:44:53 UTC
I guess that the use of g_file_replace_contents() needs this too, though I have not investigated whether "" has any meaning in any of these functions. Could you fix that too, if necessary, please.

And please mention this bug number in the ChangeLog.
Comment 5 Armin Burgmeier 2008-07-02 16:47:17 UTC
2008-07-02  Armin Burgmeier  <armin@arbur.net>

        * gio/src/file.ccg: Pass NULL to the underlying C function for the
        etags parameter in the various replace_contents functions. Also bug
        #540656.

Again, committed to trunk and glibmm-2-16