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 721278 - format does not work when --xid option is present (breaks formatting from nautilus)
format does not work when --xid option is present (breaks formatting from nau...
Status: RESOLVED FIXED
Product: gnome-disk-utility
Classification: Core
Component: format dialog
3.10.x
Other Linux
: Normal major
: ---
Assigned To: gnome-disk-utility-maint
gnome-disk-utility-maint
: 703424 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2013-12-31 15:15 UTC by Jakob Unterwurzacher
Modified: 2014-01-09 18:07 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Be more careful with XIDs (1.31 KB, patch)
2014-01-08 23:54 UTC, Matthias Clasen
committed Details | Review
Make dialog work with --xid again (3.67 KB, patch)
2014-01-09 00:26 UTC, Matthias Clasen
committed Details | Review

Description Jakob Unterwurzacher 2013-12-31 15:15:43 UTC
When you right-click your USB stick in the nautilus sidebar and select format, nautilus calls gnome-disks like this (as verified by looking at /proc/`pgrep gnome-disks`/cmdline):

gnome-disks --block-device /dev/sdb1 --format-device --xid 60817414

A dialog pops up and everything, but in the end, the disk is not formatted (no error message either). This is reported against nautilus in https://bugzilla.gnome.org/show_bug.cgi?id=703424 , however, the bug seems to be in gnome-disks as it can be reproduced by calling gnome-disks manually:

1) Open terminal window
2) Get the window id using xwininfo, convert to decimal
3) gnome-disks --block-device /dev/sdb1 --format-device --xid $WINDOWID
4) Click through dialogs
5) See that disk was not formatted
Comment 1 António Fernandes 2014-01-01 13:47:05 UTC
*** Bug 703424 has been marked as a duplicate of this bug. ***
Comment 2 Matthias Clasen 2014-01-08 23:54:24 UTC
Created attachment 265804 [details] [review]
Be more careful with XIDs

When an invalid XID is specified, we end up calling
gdk_window_set_transient_for with a NULL window. This leads
to a crash, so don't do it, and instead silently ignore
the invalid XID.
Comment 3 Matthias Clasen 2014-01-09 00:07:39 UTC
This is just a robustness fix. The actual problem is that gnome-disks is using a GApplicationCommandline to implement the format when --xid is specified. And it is starting an async operation (gdu_utils_ensure_unused ) without calling g_application_hold. Thus, when gdu_format_volume_dialog_show_for_xid returns, the application exists without waiting for the async operation to complete.
Comment 4 Matthias Clasen 2014-01-09 00:26:35 UTC
Created attachment 265806 [details] [review]
Make dialog work with --xid again

When triggering an async operation from a GApplicationCommandline,
we must use g_application_hold/release to ensure the application
instance stays around until the operation is done.
Comment 5 David Zeuthen (not reading bugmail) 2014-01-09 18:05:02 UTC
Review of attachment 265804 [details] [review]:

LGTM, thanks!
Comment 6 David Zeuthen (not reading bugmail) 2014-01-09 18:05:41 UTC
Review of attachment 265806 [details] [review]:

Excellent catch, thanks!
Comment 7 Matthias Clasen 2014-01-09 18:07:41 UTC
Attachment 265804 [details] pushed as 62253c5 - Be more careful with XIDs
Attachment 265806 [details] pushed as 0eb9516 - Make dialog work with --xid again