[hackers] [dvtm] create in $CWD not working

From: Ross Mohn <rpmohn_AT_waxandwane.org>
Date: Wed, 15 Jul 2015 11:32:38 -0400

Hi,

The create() function can take a third argument in order to use the
directory of the current client, sel, when it creates a new client.
This command is mapped to MOD+C by default. To implement this, the
function uses the /proc/ tree to find the current directory of process
sel->pid. The problem, at least for me, is that sel->pid is the generic
sh that spawns the actual user shell, so when I cd in my shell, the cwd
of the calling sh process doesn't change.

    $ pstree -p 2199
    dvtm(2199)─┬─sh(2239)───bash(2240)───mutt(11096)
               ├─sh(2324)───bash(2325)
               ├─sh(12015)───bash(12016)───vim(17544)
               └─sh(12116)───bash(12117)───pstree(21626)

For example, sel->pid is 2324, and I'm interacting with shell pid 2325.
The cwd of process 2324 is ~/, but I've changed the cwd of process 2325
to ~/local/repos/dvtm/. When I press MOD+C in my shell, dvtm creates a
new client with cwd of ~/, same as sel->pid 2324, not where I expect it
to in ~/local/repos/dvtm/.

Do others also have this issue? I'm not very familiar with /proc/; is
there something in there that could be used to identify the user shell
instead? But that might not work for everyone.

Thanks -Ross
Received on Wed Jul 15 2015 - 17:32:38 CEST

This archive was generated by hypermail 2.3.0 : Wed Jul 15 2015 - 17:36:16 CEST