bo-yang / plan9front

Automatically exported from code.google.com/p/plan9front
0 stars 0 forks source link

drawterm tries to chdir to local working directory in remote filesystem #115

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Using drawterm, try to connect to a plan9 server from a directory /home/me/9

$ drawterm -a <host> -c <host> -u glenda 

We get the warning message
cpu: failed to chdir to /home/me/9

This is not expected. there is very little chance of plan9 server having the 
same directory structure as the machine from which drawterm is invoked. The 
only path that drawterm can take for granted is /mnt/term however, it is not 
clear if it would help to change directory to /mnt/term.

Here is the location of the problem and a possible solution

diff -r 9c9f289188ff cpu.c
--- a/cpu.c     Sun Jan 02 18:33:44 2011 -0500
+++ b/cpu.c     Fri May 04 21:52:29 2012 -0700
@@ -185,10 +185,7 @@
        /* Tell the remote side the command to execute and where our working directory is */
        if(cflag)
                writestr(data, cmd, "command", 0);
-       if(getcwd(dat, sizeof(dat)) == 0)
-               writestr(data, "NO", "dir", 0);
-       else
-               writestr(data, dat, "dir", 0);
+       writestr(data, "NO", "dir", 0);

        /* 
         *  Wait for the other end to execute and start our file service

Original issue reported on code.google.com by 9...@vrtra.net on 5 May 2012 at 4:55

GoogleCodeExporter commented 9 years ago
this is a drawterm issue, not cpu problem. the changedir
feature is used from plan9 and makes sense in the context
when all terminals share ther root filesystem from plan9
fileserver.

Original comment by cinap_le...@felloff.net on 16 May 2012 at 3:18

GoogleCodeExporter commented 9 years ago
Yes, the patch is against the cpu.c in drawterm. Since it is in drawterm which 
is invoked from another OS, we cant assume that root fs is shared by the client.

(I will move this to http://code.swtch.com/drawterm/issues since that is the 
dev project for drawterm.)

Original comment by 9...@vrtra.net on 16 May 2012 at 3:31