Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 303072 Details for
Bug 443235
gpk-install-file does not handle files where the path has a space
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
what i'm about to commit
pk-space-delimit.patch (text/plain), 13.73 KB, created by
Richard Hughes
on 2008-04-20 20:50:05 UTC
(
hide
)
Description:
what i'm about to commit
Filename:
MIME Type:
Creator:
Richard Hughes
Created:
2008-04-20 20:50:05 UTC
Size:
13.73 KB
patch
obsolete
>diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py >index d0f829a..b2b3625 100644 >--- a/backends/yum/helpers/yumBackend.py >+++ b/backends/yum/helpers/yumBackend.py >@@ -925,11 +925,11 @@ class PackageKitYumBackend(PackageKitBaseBackend): > if len(self.yumbase.tsInfo) > 0: > self._runYumTransaction() > else: >- self.error(ERROR_PACKAGE_ALREADY_INSTALLED,"Can't install %s " % inst_file) >+ self.error(ERROR_LOCAL_INSTALL_FAILED,"Can't install %s " % inst_file) > > except yum.Errors.InstallError,e: > msgs = ';'.join(e) >- self.error(ERROR_PACKAGE_ALREADY_INSTALLED,msgs) >+ self.error(ERROR_LOCAL_INSTALL_FAILED,msgs) > except (yum.Errors.RepoError, yum.Errors.PackageSackError, IOError): > # We might not be able to connect to the internet to get > # repository metadata, or the package might not exist. >diff --git a/libpackagekit/pk-common.c b/libpackagekit/pk-common.c >index 36f4b99..547f731 100644 >--- a/libpackagekit/pk-common.c >+++ b/libpackagekit/pk-common.c >@@ -640,6 +640,74 @@ pk_delay_yield (gfloat delay) > } > > /** >+ * pk_ptr_array_to_argv: >+ * @array: the GPtrArray of strings >+ * >+ * Form a composite string array of strings. >+ * The data in the GPtrArray is copied. >+ * >+ * Return value: the string array, or %NULL if invalid >+ **/ >+gchar ** >+pk_ptr_array_to_argv (GPtrArray *array) >+{ >+ gchar **strv_array; >+ const gchar *value_temp; >+ guint i; >+ >+ g_return_val_if_fail (array != NULL, NULL); >+ >+ /* copy the array to a strv */ >+ strv_array = g_new0 (gchar *, array->len + 2); >+ for (i=0; i<array->len; i++) { >+ value_temp = (const gchar *) g_ptr_array_index (array, i); >+ strv_array[i] = g_strdup (value_temp); >+ } >+ /* set the last element to NULL */ >+ strv_array[i] = NULL; >+ >+ return strv_array; >+} >+ >+/** >+ * pk_va_list_to_argv: >+ * @string_first: the first string >+ * @args: any subsequant string's >+ * >+ * Form a composite string array of string >+ * >+ * Return value: the string array, or %NULL if invalid >+ **/ >+gchar ** >+pk_va_list_to_argv (const gchar *string_first, va_list *args) >+{ >+ GPtrArray *ptr_array; >+ gchar **array; >+ gchar *value_temp; >+ guint i; >+ >+ g_return_val_if_fail (args != NULL, NULL); >+ g_return_val_if_fail (string_first != NULL, NULL); >+ >+ /* find how many elements we have in a temp array */ >+ ptr_array = g_ptr_array_new (); >+ g_ptr_array_add (ptr_array, g_strdup (string_first)); >+ for (i=0;; i++) { >+ value_temp = va_arg (*args, gchar *); >+ if (value_temp == NULL) break; >+ g_ptr_array_add (ptr_array, g_strdup (value_temp)); >+ } >+ pk_debug ("number of strings=%i", i+1); >+ >+ /* convert the array to a strv type */ >+ array = pk_ptr_array_to_argv (ptr_array); >+ >+ /* get rid of the array, and free the contents */ >+ g_ptr_array_free (ptr_array, TRUE); >+ return array; >+} >+ >+/** > * pk_strbuild_va: > * @first_element: The first string item, or NULL > * @args: the va_list >diff --git a/libpackagekit/pk-common.h b/libpackagekit/pk-common.h >index 644f364..9908ec2 100644 >--- a/libpackagekit/pk-common.h >+++ b/libpackagekit/pk-common.h >@@ -84,6 +84,11 @@ gchar **pk_strsplit (const gchar *id, > gchar *pk_strbuild_va (const gchar *first_element, > va_list *args) > G_GNUC_WARN_UNUSED_RESULT; >+gchar **pk_ptr_array_to_argv (GPtrArray *array) >+ G_GNUC_WARN_UNUSED_RESULT; >+gchar **pk_va_list_to_argv (const gchar *string_first, >+ va_list *args) >+ G_GNUC_WARN_UNUSED_RESULT; > gboolean pk_strcmp_sections (const gchar *id1, > const gchar *id2, > guint parts, >diff --git a/libpackagekit/pk-package-ids.c b/libpackagekit/pk-package-ids.c >index fd1ca6b..933da1f 100644 >--- a/libpackagekit/pk-package-ids.c >+++ b/libpackagekit/pk-package-ids.c >@@ -51,23 +51,7 @@ > gchar ** > pk_package_ids_from_array (GPtrArray *array) > { >- gchar **strv_array; >- const gchar *value_temp; >- guint i; >- >- g_return_val_if_fail (array != NULL, NULL); >- >- /* copy the temp array to a strv */ >- strv_array = g_new0 (gchar *, array->len + 2); >- for (i=0; i<array->len; i++) { >- value_temp = (const gchar *) g_ptr_array_index (array, i); >- /* we don't need to copy the copy */ >- strv_array[i] = g_strdup (value_temp); >- } >- /* set the last element to NULL */ >- strv_array[i] = NULL; >- >- return strv_array; >+ return pk_ptr_array_to_argv (array); > } > > /** >@@ -82,30 +66,7 @@ pk_package_ids_from_array (GPtrArray *array) > gchar ** > pk_package_ids_from_va_list (const gchar *package_id_first, va_list *args) > { >- GPtrArray *data; >- gchar **array; >- gchar *value_temp; >- guint i; >- >- g_return_val_if_fail (args != NULL, NULL); >- g_return_val_if_fail (package_id_first != NULL, NULL); >- >- /* find how many elements we have in a temp array */ >- data = g_ptr_array_new (); >- g_ptr_array_add (data, g_strdup (package_id_first)); >- for (i=0;; i++) { >- value_temp = va_arg (*args, gchar *); >- if (value_temp == NULL) break; >- g_ptr_array_add (data, g_strdup (value_temp)); >- } >- pk_debug ("number of packages=%i", i+1); >- >- /* convert the array to a strv type */ >- array = pk_package_ids_from_array (data); >- >- /* get rid of the array, and free the contents */ >- g_ptr_array_free (data, TRUE); >- return array; >+ return pk_va_list_to_argv (package_id_first, args); > } > > /** >diff --git a/src/pk-backend-spawn.c b/src/pk-backend-spawn.c >index 7031178..6f933ca 100644 >--- a/src/pk-backend-spawn.c >+++ b/src/pk-backend-spawn.c >@@ -441,45 +441,50 @@ pk_backend_spawn_helper_new (PkBackendSpawn *backend_spawn) > } > > /** >- * pk_backend_spawn_helper_internal: >+ * pk_backend_spawn_helper_va_list: > **/ > static gboolean >-pk_backend_spawn_helper_internal (PkBackendSpawn *backend_spawn, const gchar *script, const gchar *argument) >+pk_backend_spawn_helper_va_list (PkBackendSpawn *backend_spawn, const gchar *executable, va_list *args) > { > gboolean ret; > gchar *filename; >- gchar *command; >+ gchar **argv; > > g_return_val_if_fail (PK_IS_BACKEND_SPAWN (backend_spawn), FALSE); > >+ /* convert to a argv */ >+ argv = pk_va_list_to_argv (executable, args); >+ if (argv == NULL) { >+ pk_warning ("argv NULL"); >+ return FALSE; >+ } >+ > #if PK_BUILD_LOCAL > /* prefer the local version */ >- filename = g_build_filename ("..", "backends", backend_spawn->priv->name, "helpers", script, NULL); >+ filename = g_build_filename ("..", "backends", backend_spawn->priv->name, "helpers", argv[0], NULL); > if (g_file_test (filename, G_FILE_TEST_EXISTS) == FALSE) { > pk_debug ("local helper not found '%s'", filename); > g_free (filename); >- filename = g_build_filename (DATADIR, "PackageKit", "helpers", backend_spawn->priv->name, script, NULL); >+ filename = g_build_filename (DATADIR, "PackageKit", "helpers", backend_spawn->priv->name, argv[0], NULL); > } > #else >- filename = g_build_filename (DATADIR, "PackageKit", "helpers", backend_spawn->priv->name, script, NULL); >+ filename = g_build_filename (DATADIR, "PackageKit", "helpers", backend_spawn->priv->name, argv[0], NULL); > #endif > pk_debug ("using spawn filename %s", filename); > >- if (argument != NULL) { >- command = g_strdup_printf ("%s %s", filename, argument); >- } else { >- command = g_strdup (filename); >- } >+ /* replace the filename with the full path */ >+ g_free (argv[0]); >+ argv[0] = g_strdup (filename); > > pk_backend_spawn_helper_new (backend_spawn); >- ret = pk_spawn_command (backend_spawn->priv->spawn, command); >+ ret = pk_spawn_argv (backend_spawn->priv->spawn, argv); > if (!ret) { > pk_backend_spawn_helper_delete (backend_spawn); >- pk_backend_error_code (backend_spawn->priv->backend, PK_ERROR_ENUM_INTERNAL_ERROR, "Spawn of helper '%s' failed", command); >+ pk_backend_error_code (backend_spawn->priv->backend, PK_ERROR_ENUM_INTERNAL_ERROR, >+ "Spawn of helper '%s' failed", argv[0]); > pk_backend_finished (backend_spawn->priv->backend); > } > g_free (filename); >- g_free (command); > return ret; > } > >@@ -527,22 +532,20 @@ pk_backend_spawn_kill (PkBackendSpawn *backend_spawn) > * pk_backend_spawn_helper: > **/ > gboolean >-pk_backend_spawn_helper (PkBackendSpawn *backend_spawn, const gchar *script, const gchar *first_element, ...) >+pk_backend_spawn_helper (PkBackendSpawn *backend_spawn, const gchar *first_element, ...) > { > gboolean ret; > va_list args; >- gchar *arguments; > > g_return_val_if_fail (PK_IS_BACKEND_SPAWN (backend_spawn), FALSE); >+ g_return_val_if_fail (first_element != NULL, FALSE); > g_return_val_if_fail (backend_spawn->priv->name != NULL, FALSE); > > /* get the argument list */ > va_start (args, first_element); >- arguments = pk_strbuild_va (first_element, &args); >+ ret = pk_backend_spawn_helper_va_list (backend_spawn, first_element, &args); > va_end (args); > >- ret = pk_backend_spawn_helper_internal (backend_spawn, script, arguments); >- g_free (arguments); > return ret; > } > >diff --git a/src/pk-backend-spawn.h b/src/pk-backend-spawn.h >index b16149e..e2a5459 100644 >--- a/src/pk-backend-spawn.h >+++ b/src/pk-backend-spawn.h >@@ -51,7 +51,6 @@ typedef struct > GType pk_backend_spawn_get_type (void) G_GNUC_CONST; > PkBackendSpawn *pk_backend_spawn_new (void); > gboolean pk_backend_spawn_helper (PkBackendSpawn *backend_spawn, >- const gchar *script, > const gchar *first_element, ...); > gboolean pk_backend_spawn_kill (PkBackendSpawn *backend_spawn); > const gchar *pk_backend_spawn_get_name (PkBackendSpawn *backend_spawn); >diff --git a/src/pk-spawn.c b/src/pk-spawn.c >index d5d6884..9b415b1 100644 >--- a/src/pk-spawn.c >+++ b/src/pk-spawn.c >@@ -267,28 +267,22 @@ pk_spawn_kill (PkSpawn *spawn) > } > > /** >- * pk_spawn_command: >+ * pk_spawn_argv: >+ * @argv: Can be generated using g_strsplit (command, " ", 0) >+ * if there are no spaces in the filename >+ * > **/ > gboolean >-pk_spawn_command (PkSpawn *spawn, const gchar *command) >+pk_spawn_argv (PkSpawn *spawn, gchar **argv) > { > gboolean ret; >- gchar **argv; > > g_return_val_if_fail (PK_IS_SPAWN (spawn), FALSE); >- g_return_val_if_fail (command != NULL, FALSE); >- >- if (command == NULL) { >- pk_warning ("command NULL"); >- return FALSE; >- } >+ g_return_val_if_fail (argv != NULL, FALSE); > >- pk_debug ("command '%s'", command); >+ pk_debug ("argv[0] '%s'", argv[0]); > spawn->priv->finished = FALSE; > >- /* split command line */ >- argv = g_strsplit (command, " ", 0); >- > /* create spawned object for tracking */ > ret = g_spawn_async_with_pipes (NULL, argv, NULL, > G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_SEARCH_PATH, >@@ -297,11 +291,10 @@ pk_spawn_command (PkSpawn *spawn, const gchar *command) > &spawn->priv->stdout_fd, > NULL, > NULL); >- g_strfreev (argv); > > /* we failed to invoke the helper */ > if (ret == FALSE) { >- pk_warning ("failed to spawn '%s'", command); >+ pk_warning ("failed to spawn '%s'", argv[0]); > return FALSE; > } > >@@ -490,6 +483,7 @@ libst_spawn (LibSelfTest *test) > PkSpawn *spawn = NULL; > gboolean ret; > gchar *path; >+ gchar **argv; > > if (libst_start (test, "PkSpawn", CLASS_AUTO) == FALSE) { > return; >@@ -501,8 +495,9 @@ libst_spawn (LibSelfTest *test) > /************************************************************/ > libst_title (test, "make sure return error for missing file"); > mexit = BAD_EXIT; >- path = pk_test_get_data ("pk-spawn-test.sh"); >- ret = pk_spawn_command (spawn, "pk-spawn-test-xxx.sh"); >+ argv = g_strsplit ("pk-spawn-test-xxx.sh", " ", 0); >+ ret = pk_spawn_argv (spawn, argv); >+ g_strfreev (argv); > if (ret == FALSE) { > libst_success (test, "failed to run invalid file"); > } else { >@@ -520,7 +515,11 @@ libst_spawn (LibSelfTest *test) > /************************************************************/ > libst_title (test, "make sure run correct helper"); > mexit = -1; >- ret = pk_spawn_command (spawn, path); >+ path = pk_test_get_data ("pk-spawn-test.sh"); >+ argv = g_strsplit (path, " ", 0); >+ ret = pk_spawn_argv (spawn, argv); >+ g_free (path); >+ g_strfreev (argv); > if (ret) { > libst_success (test, "ran correct file"); > } else { >@@ -561,7 +560,11 @@ libst_spawn (LibSelfTest *test) > /************************************************************/ > libst_title (test, "make sure run correct helper, and kill it"); > mexit = BAD_EXIT; >- ret = pk_spawn_command (spawn, path); >+ path = pk_test_get_data ("pk-spawn-test.sh"); >+ argv = g_strsplit (path, " ", 0); >+ ret = pk_spawn_argv (spawn, argv); >+ g_free (path); >+ g_strfreev (argv); > if (ret) { > libst_success (test, NULL); > } else { >@@ -583,13 +586,15 @@ libst_spawn (LibSelfTest *test) > > /* get new object */ > new_spawn_object (test, &spawn); >- g_free (path); > > /************************************************************/ > libst_title (test, "make sure run correct helper, and quit it"); > mexit = BAD_EXIT; > path = pk_test_get_data ("pk-spawn-test-sigquit.sh"); >- ret = pk_spawn_command (spawn, path); >+ argv = g_strsplit (path, " ", 0); >+ ret = pk_spawn_argv (spawn, argv); >+ g_free (path); >+ g_strfreev (argv); > if (ret) { > libst_success (test, NULL); > } else { >@@ -609,12 +614,13 @@ libst_spawn (LibSelfTest *test) > libst_failed (test, "finish %i!", mexit); > } > >- g_free (path); >- > /************************************************************/ > libst_title (test, "run lots of data for profiling"); > path = pk_test_get_data ("pk-spawn-test-profiling.sh"); >- ret = pk_spawn_command (spawn, path); >+ argv = g_strsplit (path, " ", 0); >+ ret = pk_spawn_argv (spawn, argv); >+ g_free (path); >+ g_strfreev (argv); > if (ret) { > libst_success (test, NULL); > } else { >@@ -622,7 +628,6 @@ libst_spawn (LibSelfTest *test) > } > > g_object_unref (spawn); >- g_free (path); > > libst_end (test); > } >diff --git a/src/pk-spawn.h b/src/pk-spawn.h >index 830c540..1b20fef 100644 >--- a/src/pk-spawn.h >+++ b/src/pk-spawn.h >@@ -51,8 +51,8 @@ typedef struct > GType pk_spawn_get_type (void) G_GNUC_CONST; > PkSpawn *pk_spawn_new (void); > >-gboolean pk_spawn_command (PkSpawn *spawn, >- const gchar *command) >+gboolean pk_spawn_argv (PkSpawn *spawn, >+ gchar **argv) > G_GNUC_WARN_UNUSED_RESULT; > gboolean pk_spawn_kill (PkSpawn *spawn); >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 443235
: 303072