Over the weekend, I finally put in the hours to figure out why dvtm's copymode works fine at home, but doesn't work at all on my servers at the office. At work, I use shared UNIX hosts without root access. I compile with PREFIX=~/local so that I have my own compiled apps and customizations. My dvtm terminal info files are installed under $PREFIX, and when I'm running inside dvtm I have set TERMINFO=~/local/share/terminfo
The problem occurs when the child process of vt_forkpty() calls execvp() to switch to the editor program. The environment variable TERM is set to dvtm-256color, but TERMINFO is not set. The call to execvp() is successful, but the editor crashes because it doesn't understand the TERM (I tested with vis, vim, and less). I don't know the best way to fix this so for myself, for now, I just hardcoded setenv("TERMINFO", "~/local/share/terminfo", 1); after the setenv() line for TERM. I thought through some actual solutions, but none seemed to fit well. I'd love to hear some ideas! Incidentally, the fprintf(stderr, ...) statement after execvp() doesn't do anything because the child's stderr doesn't go anywhere meaningful. The call to execvp() wasn't failing in the problem above, but I tested forcing it to fail. I ended up opening a specific file, rather than stderr, and had fprintf() write directly to it, but that's obviously not a general solution. The fprintf() should either be fixed or removed. Thanks -Ross