* [PATCH] gnu: ratpoison: Patch to use $SHELL instead of /bin/sh
@ 2014-02-13 6:28 Mark H Weaver
2014-02-13 8:53 ` Andreas Enge
0 siblings, 1 reply; 3+ messages in thread
From: Mark H Weaver @ 2014-02-13 6:28 UTC (permalink / raw)
To: guix-devel
[-- Attachment #1: Type: text/plain, Size: 138 bytes --]
I'm not entirely sure this will be wanted, but it bugged me that
ratpoison has /bin/sh hardcoded in its source code. WDYT?
Mark
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: [PATCH] gnu: ratpoison: Patch to use $SHELL instead of /bin/sh --]
[-- Type: text/x-patch, Size: 5813 bytes --]
From 2218f563424e4154ee24f5f9fdeb1b6e00ffae7f Mon Sep 17 00:00:00 2001
From: Mark H Weaver <mhw@netris.org>
Date: Thu, 13 Feb 2014 00:42:41 -0500
Subject: [PATCH] gnu: ratpoison: Patch to use $SHELL instead of /bin/sh.
* gnu/packages/patches/ratpoison-shell.patch: New file.
* gnu/packages/ratpoison.scm (ratpoison): Add patch.
* gnu-system.am (dist_patch_DATA): Add patch.
---
gnu-system.am | 1 +
gnu/packages/patches/ratpoison-shell.patch | 91 ++++++++++++++++++++++++++++++
gnu/packages/ratpoison.scm | 4 +-
3 files changed, 95 insertions(+), 1 deletion(-)
create mode 100644 gnu/packages/patches/ratpoison-shell.patch
diff --git a/gnu-system.am b/gnu-system.am
index 8229cf0..7110a60 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -297,6 +297,7 @@ dist_patch_DATA = \
gnu/packages/patches/qemu-make-4.0.patch \
gnu/packages/patches/qemu-multiple-smb-shares.patch \
gnu/packages/patches/qt4-tests.patch \
+ gnu/packages/patches/ratpoison-shell.patch \
gnu/packages/patches/readline-link-ncurses.patch \
gnu/packages/patches/ripperx-libm.patch \
gnu/packages/patches/scheme48-tests.patch \
diff --git a/gnu/packages/patches/ratpoison-shell.patch b/gnu/packages/patches/ratpoison-shell.patch
new file mode 100644
index 0000000..63d265a
--- /dev/null
+++ b/gnu/packages/patches/ratpoison-shell.patch
@@ -0,0 +1,91 @@
+Use $SHELL instead of hardcoding /bin/sh in ratpoison.
+
+Patch by Mark H Weaver <mhw@netris.org>.
+
+--- ratpoison/src/actions.c.orig 2013-04-06 21:37:43.000000000 -0400
++++ ratpoison/src/actions.c 2014-02-13 00:34:10.992553710 -0500
+@@ -19,6 +19,7 @@
+ */
+ \f
+ #include <unistd.h>
++#include <stdlib.h>
+ #include <ctype.h> /* for isspace */
+ #include <sys/wait.h>
+ #include <X11/keysym.h>
+@@ -223,12 +223,12 @@
+ add_command ("escape", cmd_escape, 1, 1, 1,
+ "Key: ", arg_KEY);
+ add_command ("exec", cmd_exec, 1, 1, 1,
+- "/bin/sh -c ", arg_SHELLCMD);
++ "$SHELL -c ", arg_SHELLCMD);
+ add_command ("execa", cmd_execa, 1, 1, 1,
+- "/bin/sh -c ", arg_SHELLCMD);
++ "$SHELL -c ", arg_SHELLCMD);
+ add_command ("execf", cmd_execf, 2, 2, 2,
+ "frame to execute in:", arg_FRAME,
+- "/bin/sh -c ", arg_SHELLCMD);
++ "$SHELL -c ", arg_SHELLCMD);
+ add_command ("fdump", cmd_fdump, 1, 0, 0,
+ "", arg_NUMBER);
+ add_command ("focus", cmd_next_frame, 0, 0, 0);
+@@ -359,7 +359,7 @@
+ add_command ("unsetenv", cmd_unsetenv, 1, 1, 1,
+ "Variable: ", arg_STRING);
+ add_command ("verbexec", cmd_verbexec, 1, 1, 1,
+- "/bin/sh -c ", arg_SHELLCMD);
++ "$SHELL -c ", arg_SHELLCMD);
+ add_command ("version", cmd_version, 0, 0, 0);
+ add_command ("vsplit", cmd_v_split, 1, 0, 0,
+ "Split: ", arg_STRING);
+@@ -2627,6 +2627,9 @@
+ pid = fork();
+ if (pid == 0)
+ {
++ char *shell_path;
++ char *shell_name;
++
+ /* Some process setup to make sure the spawned process runs
+ in its own session. */
+ putenv(current_screen()->display_string);
+@@ -2641,7 +2644,18 @@
+ /* raw means don't run it through sh. */
+ if (raw)
+ execl (cmd, cmd, NULL);
+- execl("/bin/sh", "sh", "-c", cmd, NULL);
++
++ shell_path = getenv ("SHELL");
++ if (shell_path == NULL)
++ shell_path = "/bin/sh";
++
++ shell_name = strrchr (shell_path, '/');
++ if (shell_name == NULL)
++ shell_name = shell_path;
++ else
++ shell_name++;
++
++ execl(shell_path, shell_name, "-c", cmd, NULL);
+ _exit(EXIT_FAILURE);
+ }
+
+--- ratpoison/src/events.c.orig 2013-04-06 20:05:48.000000000 -0400
++++ ratpoison/src/events.c 2014-02-13 00:34:39.327758789 -0500
+@@ -920,7 +920,7 @@
+ {
+ /* Report any child that didn't return 0. */
+ if (cur->status != 0)
+- marked_message_printf (0,0, "/bin/sh -c \"%s\" finished (%d)",
++ marked_message_printf (0,0, "$SHELL -c \"%s\" finished (%d)",
+ cur->cmd, cur->status);
+ list_del (&cur->node);
+ free (cur->cmd);
+--- ratpoison/src/messages.h.orig 2012-07-20 20:25:33.000000000 -0400
++++ ratpoison/src/messages.h 2014-02-13 00:34:28.608398437 -0500
+@@ -41,7 +41,7 @@
+
+ #define MESSAGE_PROMPT_SWITCH_TO_WINDOW "Switch to window: "
+ #define MESSAGE_PROMPT_NEW_WINDOW_NAME "Set window's title to: "
+-#define MESSAGE_PROMPT_SHELL_COMMAND "/bin/sh -c "
++#define MESSAGE_PROMPT_SHELL_COMMAND "$SHELL -c "
+ #define MESSAGE_PROMPT_COMMAND ":"
+ #define MESSAGE_PROMPT_SWITCH_WM "Switch to wm: "
+ #define MESSAGE_PROMPT_XTERM_COMMAND MESSAGE_PROMPT_SHELL_COMMAND TERM_PROG " -e "
diff --git a/gnu/packages/ratpoison.scm b/gnu/packages/ratpoison.scm
index fb1bfd8..aabd1d3 100644
--- a/gnu/packages/ratpoison.scm
+++ b/gnu/packages/ratpoison.scm
@@ -21,6 +21,7 @@
#:use-module (guix download)
#:use-module (guix build-system gnu)
#:use-module ((guix licenses) #:select (gpl2+))
+ #:use-module (gnu packages)
#:use-module (gnu packages xorg)
#:use-module (gnu packages perl)
#:use-module (gnu packages readline)
@@ -37,7 +38,8 @@
version ".tar.xz"))
(sha256
(base32
- "0v4mh8d3vsh5xbbycfdl3g8zfygi1rkslh1x7k5hi1d05bfq3cdr"))))
+ "0v4mh8d3vsh5xbbycfdl3g8zfygi1rkslh1x7k5hi1d05bfq3cdr"))
+ (patches (list (search-patch "ratpoison-shell.patch")))))
(build-system gnu-build-system)
(inputs
`(("libXi" ,libxi)
--
1.8.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] gnu: ratpoison: Patch to use $SHELL instead of /bin/sh
2014-02-13 6:28 [PATCH] gnu: ratpoison: Patch to use $SHELL instead of /bin/sh Mark H Weaver
@ 2014-02-13 8:53 ` Andreas Enge
2014-02-13 13:08 ` Ludovic Courtès
0 siblings, 1 reply; 3+ messages in thread
From: Andreas Enge @ 2014-02-13 8:53 UTC (permalink / raw)
To: Mark H Weaver; +Cc: guix-devel
On Thu, Feb 13, 2014 at 01:28:25AM -0500, Mark H Weaver wrote:
> I'm not entirely sure this will be wanted, but it bugged me that
> ratpoison has /bin/sh hardcoded in its source code. WDYT?
Should it be replaced by the user $SHELL or by (which "bash")?
Andreas
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] gnu: ratpoison: Patch to use $SHELL instead of /bin/sh
2014-02-13 8:53 ` Andreas Enge
@ 2014-02-13 13:08 ` Ludovic Courtès
0 siblings, 0 replies; 3+ messages in thread
From: Ludovic Courtès @ 2014-02-13 13:08 UTC (permalink / raw)
To: Andreas Enge; +Cc: guix-devel
Andreas Enge <andreas@enge.fr> skribis:
> On Thu, Feb 13, 2014 at 01:28:25AM -0500, Mark H Weaver wrote:
>> I'm not entirely sure this will be wanted, but it bugged me that
>> ratpoison has /bin/sh hardcoded in its source code. WDYT?
>
> Should it be replaced by the user $SHELL or by (which "bash")?
I think it’s OK to not use (which "bash") here, because it doesn’t
affect core functionality.
The patch looks good to me; OK to push.
An alternative way to do it would be to have a Ratpoison variable for
the shell to use. That’s something that could be accepted upstream I
suppose.
Thanks,
Ludo’.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-02-13 13:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-13 6:28 [PATCH] gnu: ratpoison: Patch to use $SHELL instead of /bin/sh Mark H Weaver
2014-02-13 8:53 ` Andreas Enge
2014-02-13 13:08 ` Ludovic Courtès
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).