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 682496 - weird dialog after plugging in iphone
weird dialog after plugging in iphone
Status: RESOLVED FIXED
Product: gvfs
Classification: Core
Component: afc backend and volume monitor
1.13.x
Other Linux
: Normal normal
: ---
Assigned To: gvfs-maint
gvfs-maint
Depends on:
Blocks:
 
 
Reported: 2012-08-22 19:02 UTC by William Jon McCann
Modified: 2012-08-23 10:08 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
screenshot (50.58 KB, image/jpeg)
2012-08-22 19:02 UTC, William Jon McCann
  Details
afc: null-terminate choices string array (1.20 KB, patch)
2012-08-22 20:38 UTC, Cosimo Cecchi
committed Details | Review
afc: use the correct choice index for "Cancel" (891 bytes, patch)
2012-08-22 20:39 UTC, Cosimo Cecchi
reviewed Details | Review
afc: use curly double quotes for dialog question (1.09 KB, patch)
2012-08-22 20:39 UTC, Cosimo Cecchi
committed Details | Review
afc: use the correct choice index for "Cancel" (1.54 KB, patch)
2012-08-23 09:58 UTC, Cosimo Cecchi
committed Details | Review

Description William Jon McCann 2012-08-22 19:02:34 UTC
Created attachment 222181 [details]
screenshot

I got this weird dialog after plugging in my iPhone.

 * I have no idea what those buttons are for
 * The quotes should be curly double quotes
 * The icon used there is not anything like an iPhone
 * It is way too wide
Comment 1 William Jon McCann 2012-08-22 20:22:19 UTC
And cancel is a lie. It just reprompts with no way out except to unplug.
Comment 2 Cosimo Cecchi 2012-08-22 20:38:59 UTC
Created attachment 222189 [details] [review]
afc: null-terminate choices string array

Fixes extra buttons appearing in the dialog.

The fact that we pass the array length doesn't guarantee that the
function we are calling will actually work fine with a non
null-terminated array; in fact it ultimately gets passed to the
autogenerated GDBus code, which expects it to be null-terminated,
causing memory access out of the array bounds, and into the
content-types string array.
Comment 3 Cosimo Cecchi 2012-08-22 20:39:01 UTC
Created attachment 222190 [details] [review]
afc: use the correct choice index for "Cancel"

Or pressing the button won't dismiss the dialog.
Comment 4 Cosimo Cecchi 2012-08-22 20:39:05 UTC
Created attachment 222191 [details] [review]
afc: use curly double quotes for dialog question
Comment 5 Bastien Nocera 2012-08-23 09:37:55 UTC
Review of attachment 222191 [details] [review]:

::: daemon/gvfsbackendafc.c
@@ +585,3 @@
        * %s is the device name. 'Try again' is the caption of the button
        * shown in the dialog which is defined above. */
+      message = g_strdup_printf (_("The device “%s” is locked. Enter the passcode on the device and click “Try again”."), display_name);

Pretty sure that doesn't compile. Backslashes missing.
Comment 6 Bastien Nocera 2012-08-23 09:38:32 UTC
Review of attachment 222190 [details] [review]:

::: daemon/gvfsbackendafc.c
@@ -593,3 @@
                                        &aborted,
                                        &choice);
-    if (!ret || aborted || (choice == 0))

I'd rather we added an enum and used that instead of magic numbers.
Comment 7 Bastien Nocera 2012-08-23 09:39:01 UTC
Review of attachment 222189 [details] [review]:

Looks good.
Comment 8 Cosimo Cecchi 2012-08-23 09:57:24 UTC
Comment on attachment 222189 [details] [review]
afc: null-terminate choices string array

Attachment 222189 [details] pushed as 99d06e4 - afc: null-terminate choices string array
Comment 9 Cosimo Cecchi 2012-08-23 09:58:12 UTC
Comment on attachment 222191 [details] [review]
afc: use curly double quotes for dialog question

Attachment 222191 [details] pushed as 666764f - afc: use curly double quotes for dialog question
Comment 10 Cosimo Cecchi 2012-08-23 09:58:29 UTC
Created attachment 222207 [details] [review]
afc: use the correct choice index for "Cancel"

Or pressing the button won't dismiss the dialog.
Comment 11 Cosimo Cecchi 2012-08-23 09:59:03 UTC
Comment on attachment 222190 [details] [review]
afc: use the correct choice index for "Cancel"

Added the enum to the new patch, and some comments to keep the array and the enum in sync
Comment 12 Bastien Nocera 2012-08-23 10:05:03 UTC
Review of attachment 222207 [details] [review]:

::: daemon/gvfsbackendafc.c
@@ +384,3 @@
 }
 
+/* keep in sync with the choices array below */

s/below/in g_vfs_backend_afc_mount()/
Comment 13 Cosimo Cecchi 2012-08-23 10:08:30 UTC
Attachment 222207 [details] pushed as 3fb6e42 - afc: use the correct choice index for "Cancel"

Pushed with the suggested change.