On 11/24/2015 06:59 AM, Greg Reagle wrote:
Mod-C  Create a new shell window using the current working directory of
the focused window.

This is mod key followed by capital C.  For me it does the same things
as mod key followed by lower case c, i.e. it has no effect on the
working directory of the new client window.

For me this bug is reproducible without any effort--it never works.

I've debugged and found the source of the problem.  Output of ps xf:

22958 pts/2    S      0:27      \_ ddd ./dvtm
22967 pts/5    Ss+    0:06      |   \_ gdb -q -fullname ./dvtm
25217 pts/5    t      0:00      |   |   \_
/home/greg/computer/apps/dvtm/dvtm
25231 pts/6    Ss     0:00      |   |       \_ /usr/bin/fish -c
/usr/bin/fish
25245 pts/6    S+     0:00      |   |           \_ /usr/bin/fish

The function getcwd_by_pid() in dvtm.c uses 25231 for c->pid.  So dvtm
considers process 25231 to be the client of the window.  But the cwd of
25231 never changes.  It is the cwd of 25245 that changes.

The only way I can think to solve this problem is to remove this extra
level of process spawning.  I don't understand why dvtm does this, but I
assume that there is a good reason that I just don't understand.

And here is a fix attached.

>From f1939ff71b77b793ebf01a74c151791806f194e9 Mon Sep 17 00:00:00 2001
From: Greg Reagle <greg.rea...@umbc.edu>
Date: Tue, 24 Nov 2015 09:28:26 -0500
Subject: [PATCH] enable Mod-C by eliminating $SHELL -c

---
 dvtm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dvtm.c b/dvtm.c
index e337061..1873639 100644
--- a/dvtm.c
+++ b/dvtm.c
@@ -990,7 +990,7 @@ static char *getcwd_by_pid(Client *c) {
 static void
 create(const char *args[]) {
 	const char *cmd = (args && args[0]) ? args[0] : shell;
-	const char *pargs[] = { shell, "-c", cmd, NULL };
+	const char *pargs[] = { cmd, NULL };
 	char buf[8], *cwd = NULL;
 	const char *env[] = {
 		"DVTM_WINDOW_ID", buf,
-- 
1.9.1

Reply via email to