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 729981 - gio/gtestdbus.c: Fix write_config_file() for Windows
gio/gtestdbus.c: Fix write_config_file() for Windows
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gio
2.40.x
Other Windows
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2014-05-12 04:26 UTC by Fan, Chun-wei
Modified: 2014-05-12 14:18 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gio/gtestdbus.c: Close fd in write_config_file() before calling g_file_set_contents() (1.12 KB, patch)
2014-05-12 04:30 UTC, Fan, Chun-wei
committed Details | Review

Description Fan, Chun-wei 2014-05-12 04:26:33 UTC
Hi,

In write_config_file(), we are calling g_file_set_contents() to write items into a temp file.  As g_file_set_contents() call on g_unlink(), we would get a permission denied error on Windows as it locks that temp file unless the file descriptor (fd) that was associated with the temp file during its creation is closed beforehand.
Comment 1 Fan, Chun-wei 2014-05-12 04:30:14 UTC
Created attachment 276354 [details] [review]
gio/gtestdbus.c: Close fd in write_config_file() before calling g_file_set_contents()

Hi,

As the fd that was acquired during the creation of the temp file in write_config_file() is not used directly after its creation, call close() on the fd earlier, before we call g_file_set_contents().  This would fix a number of GTK+ tests on Windows, as a result.  This is my patch to attempt to fix this issue.

With blessings, thank you!
Comment 2 Colin Walters 2014-05-12 11:31:34 UTC
Review of attachment 276354 [details] [review]:

Looks good.
Comment 3 Fan, Chun-wei 2014-05-12 14:18:03 UTC
Review of attachment 276354 [details] [review]:

Hello Colin,

Thanks for the review.  The patch was pushed as:
master:    c2a82877
glib-2-40: 321b827d

With blessings, thank you!