GNOME Bugzilla – Bug 776169
Various gio-tool fixes
Last modified: 2017-06-06 11:22:09 UTC
I wanted to fix one wrong error message and ended up with the following patches. I hope you will like that...
Created attachment 342056 [details] [review] gio-tool: Various fixes related to error messages This patch contains the following changes: - Print all errors with "gio: " prefix - Print file uri in error for each tool allowing multiple locations - Mark all error messages translatable - Do not leak strings used in error messages - Always start error messages with capital letter - Unify some error messages across various tools - Fix addional/missing new line characters
Created attachment 342057 [details] [review] gio-tool: Various memory leak fixes
Created attachment 342058 [details] [review] gio-tool: Do not print settable arguments unless they are any "Settable arguments:" is printed even if they are not any arguments to print. Do not print it similarly as it is done for "Writable namespaces:".
Created attachment 342059 [details] [review] gio-tool: Return error if there are not any volumes to mount Print error and return error code if device doesn't contain any volumes to mount.
Review of attachment 342056 [details] [review]: OK.
Review of attachment 342057 [details] [review]: I didn't look closely, but seems sane.
Review of attachment 342058 [details] [review]: OK.
Review of attachment 342059 [details] [review]: OK.
Colin, thanks for the reviews! I wanted to fix one more issue and ended up with other patches, attaching them... :-D
Review of attachment 342056 [details] [review]: ::: gio/gio-tool-monitor.c @@ +268,3 @@ if (!total) { + show_help (context, _("No locations given")); I've realized that the context is already freed at this point...
Created attachment 342214 [details] [review] gio-tool: Various fixes related to error messages So I've fixed the use-after-free in gio-tool-monitor and added the following changes: @@ -151 +151 @@ handle_cat (int argc, char *argv[], gboolean do_help) - show_help (context, _("No files given")); + show_help (context, _("No locations given")); @@ -69 +69 @@ handle_open (int argc, char *argv[], gboolean do_help) - show_help (context, _("No files to open")); + show_help (context, _("No locations given")); @@ -70 +70 @@ handle_remove (int argc, char *argv[], gboolean do_help) - show_help (context, _("No files to delete")); + show_help (context, _("No locations given")); I don't think we need special error messages in this cases... let's use "No locations given" which is already used at several other places.
Created attachment 342215 [details] [review] gio-tool: Add g_drive_is_removable() support The g_drive_is_removable() support was added recently in gio/gvfs (see Bug 765900 and Bug 765457). It was also added in gvfs-mount, but we forgot to add it also in gio-tool-mount.
Created attachment 342216 [details] [review] gio-tool: Do not leak GOptionContext GOptionContext is freed only in case of success. Free the context also in case of failure.
Review of attachment 342214 [details] [review]: ok
Review of attachment 342215 [details] [review]: sure
Review of attachment 342216 [details] [review]: not sure it helps much, but ok
Attachment 342057 [details] pushed as bde2bde - gio-tool: Various memory leak fixes Attachment 342058 [details] pushed as bcb1bfd - gio-tool: Do not print settable arguments unless they are any Attachment 342059 [details] pushed as 0946134 - gio-tool: Return error if there are not any volumes to mount Attachment 342214 [details] pushed as 0beeeb2 - gio-tool: Various fixes related to error messages Attachment 342215 [details] pushed as 292f10d - gio-tool: Add g_drive_is_removable() support Attachment 342216 [details] pushed as fb7d218 - gio-tool: Do not leak GOptionContext
Created attachment 353245 [details] [review] gio-tool: Fix alignment of monitor messages Name of GMount/GVolume/GDrive is aligned in many cases in output messages, except few cases. Let's unify the alignment.
Review of attachment 353245 [details] [review]: ++
Attachment 353245 [details] pushed as 6863080 - gio-tool: Fix alignment of monitor messages