diff --git a/ChangeLog b/ChangeLog index 8bed7c719b664f4b5a5b752a2b96a321a9b435be..8344e8e095f43443ba3dd57b25cf292914db3696 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-04-19 Benedikt Meurer <benny@xfce.org> + + * configure.in.in: Check for paths.h. + * plugins/thunar-uca/thunar-uca-model.c: Run the action commands using + the bourne shell (or the systems replacement), so environment variables + and backticks can be used. + * NEWS: Update NEWS. + 2006-04-18 Benedikt Meurer <benny@xfce.org> * thunar/thunar-dialogs.c(thunar_dialogs_show_about): Use (translatable) diff --git a/NEWS b/NEWS index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..3e35388a578193f635c15ce2b588408358e3630b 100644 --- a/NEWS +++ b/NEWS @@ -0,0 +1,4 @@ +0.3.2beta2 +========== +- The custom actions are now run using the shell. + diff --git a/configure.in.in b/configure.in.in index 35cbe9cab3b91df6e2b021b63853dfc377a5df10..c6d2cdd8df20f85f1559c5067c09ac8d5c4d897b 100644 --- a/configure.in.in +++ b/configure.in.in @@ -102,8 +102,9 @@ dnl ********************************** dnl *** Check for standard headers *** dnl ********************************** AC_CHECK_HEADERS([ctype.h dirent.h errno.h fcntl.h fnmatch.h fstab.h grp.h \ - limits.h locale.h math.h memory.h mntent.h pwd.h regex.h sched.h \ - setjmp.h stdarg.h stdlib.h string.h sys/xattr.h sys/extattr.h \ + limits.h locale.h math.h memory.h mntent.h paths.h pwd.h \ + regex.h sched.h setjmp.h stdarg.h stdlib.h string.h \ + sys/xattr.h sys/extattr.h \ sys/cdio.h sys/mman.h sys/mount.h sys/param.h sys/stat.h \ sys/statfs.h sys/statvfs.h sys/time.h sys/uio.h \ sys/vfs.h sys/wait.h time.h wchar.h wctype.h]) diff --git a/plugins/thunar-uca/thunar-uca-model.c b/plugins/thunar-uca/thunar-uca-model.c index a586d86d0dd10dc0d40c2c97974ae52ecd9eb767..2df4df68b7fe3d6cb8c26041a443b9f83100214b 100644 --- a/plugins/thunar-uca/thunar-uca-model.c +++ b/plugins/thunar-uca/thunar-uca-model.c @@ -31,6 +31,9 @@ #ifdef HAVE_MEMORY_H #include <memory.h> #endif +#ifdef HAVE_PATHS_H +#include <paths.h> +#endif #ifdef HAVE_STRING_H #include <string.h> #endif @@ -46,6 +49,13 @@ +/* not all systems define _PATH_BSHELL */ +#ifndef _PATH_BSHELL +#define _PATH_BSHELL "/bin/sh" +#endif + + + typedef struct _ThunarUcaModelItem ThunarUcaModelItem; @@ -1398,7 +1408,6 @@ thunar_uca_model_parse_argv (ThunarUcaModel *uca_model, { ThunarUcaModelItem *item; const gchar *p; - gboolean result = FALSE; GString *command_line = g_string_new (NULL); GList *lp; gchar *dirname; @@ -1415,7 +1424,7 @@ thunar_uca_model_parse_argv (ThunarUcaModel *uca_model, if (item->command == NULL || *item->command == '\0') { g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_INVAL, _("Command not configured")); - goto done; + goto error; } /* generate the command line */ @@ -1433,7 +1442,7 @@ thunar_uca_model_parse_argv (ThunarUcaModel *uca_model, g_free (uri); if (G_UNLIKELY (path == NULL)) - goto done; + goto error; quoted = g_shell_quote (path); g_string_append (command_line, quoted); @@ -1453,7 +1462,7 @@ thunar_uca_model_parse_argv (ThunarUcaModel *uca_model, g_free (uri); if (G_UNLIKELY (path == NULL)) - goto done; + goto error; quoted = g_shell_quote (path); g_string_append (command_line, quoted); @@ -1495,7 +1504,7 @@ thunar_uca_model_parse_argv (ThunarUcaModel *uca_model, g_free (uri); if (G_UNLIKELY (path == NULL)) - goto done; + goto error; dirname = g_path_get_dirname (path); quoted = g_shell_quote (path); @@ -1517,7 +1526,7 @@ thunar_uca_model_parse_argv (ThunarUcaModel *uca_model, g_free (uri); if (G_UNLIKELY (path == NULL)) - goto done; + goto error; dirname = g_path_get_dirname (path); quoted = g_shell_quote (path); @@ -1564,11 +1573,22 @@ thunar_uca_model_parse_argv (ThunarUcaModel *uca_model, } } - result = g_shell_parse_argv (command_line->str, argcp, argvp, error); + /* we run the command using the bourne shell (or the systems + * replacement for the bourne shell), so environment variables + * and backticks can be used for the action commands. + */ + (*argcp) = 3; + (*argvp) = g_new (gchar *, 4); + (*argvp)[0] = g_strdup (_PATH_BSHELL); + (*argvp)[1] = g_strdup ("-c"); + (*argvp)[2] = g_string_free (command_line, FALSE); + (*argvp)[3] = NULL; -done: + return TRUE; + +error: g_string_free (command_line, TRUE); - return result; + return FALSE; }