Subject: Re: tramp on NT emacs
From: Keith Amidon <[email-masked]>
To: [email-masked] (Mark A. Hershberger)
Cc: "rcp.el mailing list" <[email-masked]>, [email-masked], [email-masked]
Date: 23 Apr 2001 08:50:12 -0700

Inspired by Mark, I've been poking around trying to get tramp working
on nt-emacs 20.7 with the Cygwin ssh port.  I'm really
close. Hopefully someone knows what needs to be done to take this the
rest of the way.

NOTE: I already have the Cygwin SSH port setup to use ssh-agent for
all authentication. So, I never have to enter ssh passwords or
passphrases within emacs to get a remote shell. I believe this is
necessary for what I have described below to work...

I'm using the very latest Cygwin openssh version (2.5.2p2-3). If you
look at the man page, you will notice a slight change to the
description of the "-t" options. It states:

   Multiple -t options force tty allocation, even if ssh has no
   local tty.

This seemed promising. I started by trying to get ssh.el working. By
doing:

   (setq ssh-explicit-args '("-t" "-t"))

I was able to use ssh.el to open ssh connnections to several machines
I use regularly, and playing around in the shell seemed to work
fine. I do get the message:

   tcgetattr: Not a character device
   tcsetattr: Not a character device

when this first connects, which I suspect this may be an indicator of
why Cygwin thinks it can't allocate a PTY for the emacs subprocess,
but I'm not sure...

Anyway, given that ssh.el seemed to be working okay, I started working
on tramp. I customized my tramp variables a bit:

   tramp-verbose = 10
   tramp-default-method = "scp"
   tramp-debug-buffer = t

And, in the tramp-methods, for method "scp" set:

   tramp-rsh-args = '("-e" "none" "-t" "-t")

I hope that makes sense. I would have just pasted the customizations
from my .emacs, but they are a bit difficult to read because
tramp-methods is so big... Let me know if you have questions.

So, now I attempt to load something remotely, first seting
debug-on-error to t so I get a backtrace when it fails. I do a
find-file on "/r@scp:[email-masked]:"

When I do this, I get the following backtrace:

Signaling: (error "Couldn't find exit status of `test -d \"/devkits/cygwin/devkits/cygwin/bin/ln\"'")
  signal(error ("Couldn't find exit status of `test -d \"/devkits/cygwin/devkits/cygwin/bin/ln\"'"))
  error("Couldn't find exit status of `%s'" "test -d \"/devkits/cygwin/devkits/cygwin/bin/ln\"")
  tramp-send-command-and-check(nil "scp" "amidon" "camalot.picnicpark.org" "test -d \"/devkits/cygwin/devkits/cygwin/bin/ln\"" t)
  tramp-handle-file-directory-p("/r@scp:[email-masked]:/devkits/cygwin/devkits/cygwin/bin/ln")
  apply(tramp-handle-file-directory-p "/r@scp:[email-masked]:/devkits/cygwin/devkits/cygwin/bin/ln")
  tramp-file-name-handler(file-directory-p "/r@scp:[email-masked]:/devkits/cygwin/devkits/cygwin/bin/ln")
  file-directory-p("/r@scp:[email-masked]:/devkits/cygwin/bin/ln/")
  find-file-noselect("/r@scp:[email-masked]:" nil nil 1)
  find-file("/r@scp:[email-masked]:" 1)
  call-interactively(find-file)
  find-file-at-point()
  call-interactively(find-file-at-point)

Obviously something isn't working, but for the life of me I can't
figure out where the "/devkits/cygwin/devkits/cygwin/bin/ln" request
came from... I have cygwin installed in "c:\devkits\cygwin" on the
Win2000 machine I am attempting this from, but I don't understand
where tramp is picking this path up from...

I think I'm really close to having this working, and if anyone can
help me get over this (hopefully) last hurdle, I would really
appreciate it. The tramp-debug buffer for the request is that
generated the backtrace above is attached below if that helps.
 
    Thanks,  Keith 

-----------------
# Opening connection for [email-masked] using scp...
# Waiting 60s for shell or passwd prompt from camalot.picnicpark.org
tcgetattr: Not a character device
tcsetattr: Not a character device
Last login: Mon Apr 23 08:26:53 2001 from dynamic-13.picnicpark.org
[amidon@camalot amidon]$ # Initializing remote shell
$ exec /bin/sh
# Waiting 30s for remote `/bin/sh' to come up...
exec /bin/sh
[amidon@camalot amidon]$ # Setting up remote shell environment
stty -inlcr -echo
[amidon@camalot amidon]$ [amidon@camalot amidon]$ # Determining coding system
foo
bar
[amidon@camalot amidon]$ # Waiting 30s for `unset HISTFILE'
[amidon@camalot amidon]$ # Waiting 30s for `set +o vi +o emacs'
set: not in vi editing mode
[amidon@camalot amidon]$ # Waiting 30s for `unset MAIL MAILCHECK MAILPATH'
[amidon@camalot amidon]$ # Waiting 30s for `unset CDPATH'
[amidon@camalot amidon]$ # Setting shell prompt
$ PS1='
/////
'; PS2=''; PS3=''
$ echo hello
# Waiting for remote `/bin/sh' to come up...
hello
# Waiting for remote `/bin/sh' to come up...done
$ echo ~root
/root
# Remote `/bin/sh' groks tilde expansion, good
# Finding command to check if file exists
$ ls -d "/" ; echo tramp_exit_status $?
/
tramp_exit_status 0
$ ls -d "/devkits/cygwin/ this file does not exist " ; echo tramp_exit_status $?
ls: /devkits/cygwin/ this file does not exist : No such file or directory
tramp_exit_status 1
# Finding a suitable `ls' command
# Checking remote `/bin/ls' command for `-n' option
$ test -x "/bin/ls" ; echo tramp_exit_status $?
tramp_exit_status 0
# Testing remote command `/bin/ls' for -n...
$ /bin/ls -lnd / >/dev/null 2>&1 ; echo tramp_exit_status $?
tramp_exit_status 0
# Testing remote command `/bin/ls' for -n...okay
# Using remote command `/bin/ls' for getting directory listings
$ tramp_set_exit_status () {
return $1
}
$ ls -d "/devkits/cygwin/devkits/cygwin/bin" ; echo tramp_exit_status $?
ls: /devkits/cygwin/devkits/cygwin/bin: No such file or directory
tramp_exit_status 1
$ ls -d "/devkits/cygwin/devkits/cygwin/usr/bin" ; echo tramp_exit_status $?
ls: /devkits/cygwin/devkits/cygwin/usr/bin: No such file or directory
tramp_exit_status 1
$ ls -d "/devkits/cygwin/devkits/cygwin/usr/sbin" ; echo tramp_exit_status $?
ls: /devkits/cygwin/devkits/cygwin/usr/sbin: No such file or directory
tramp_exit_status 1
$ ls -d "/devkits/cygwin/devkits/cygwin/usr/local/bin" ; echo tramp_exit_status $?
ls: /devkits/cygwin/devkits/cygwin/usr/local/bin: No such file or directory
tramp_exit_status 1
$ ls -d "/devkits/cygwin/devkits/cygwin/usr/ccs/bin" ; echo tramp_exit_status $?
ls: /devkits/cygwin/devkits/cygwin/usr/ccs/bin: No such file or directory
tramp_exit_status 1
$ ls -d "/devkits/cygwin/devkits/cygwin/local/bin" ; echo tramp_exit_status $?
ls: /devkits/cygwin/devkits/cygwin/local/bin: No such file or directory
tramp_exit_status 1
$ ls -d "/devkits/cygwin/devkits/cygwin/local/freeware/bin" ; echo tramp_exit_status $?
ls: /devkits/cygwin/devkits/cygwin/local/freeware/bin: No such file or directory
tramp_exit_status 1
$ ls -d "/devkits/cygwin/devkits/cygwin/local/gnu/bin" ; echo tramp_exit_status $?
ls: /devkits/cygwin/devkits/cygwin/local/gnu/bin: No such file or directory
tramp_exit_status 1
$ ls -d "/devkits/cygwin/devkits/cygwin/usr/freeware/bin" ; echo tramp_exit_status $?
ls: /devkits/cygwin/devkits/cygwin/usr/freeware/bin: No such file or directory
tramp_exit_status 1
$ ls -d "/devkits/cygwin/devkits/cygwin/usr/pkg/bin" ; echo tramp_exit_status $?
ls: /devkits/cygwin/devkits/cygwin/usr/pkg/bin: No such file or directory
tramp_exit_status 1
$ PATH=; export PATH
$ LC_TIME=C; export LC_TIME; echo huhu
huhu
$ mesg n; echo huhu
sh: mesg: No such file or directory
huhu
$ biff n ; echo huhu
sh: biff: No such file or directory
huhu
$ unalias ls; echo huhu
unalias: `ls' not an alias
huhu
$ test / -nt /
$ tramp_test_nt () {
test -n "`find $1 -prune -newer $2 -print`"
}
$ while read d; do if test -x $d/perl5 -a -f $d/perl5; then echo $d/perl5; break; fi; done <<'EOF'
$ /bin

$ /usr/bin

$ /usr/sbin

$ /usr/local/bin

$ /usr/ccs/bin

$ /local/bin

$ /local/freeware/bin

$ /local/gnu/bin

$ /usr/freeware/bin

$ /usr/pkg/bin

$ EOF

$ while read d; do if test -x $d/perl -a -f $d/perl; then echo $d/perl; break; fi; done <<'EOF'
$ /bin

$ /usr/bin

$ /usr/sbin

$ /usr/local/bin

$ /usr/ccs/bin

$ /local/bin

$ /local/freeware/bin

$ /local/gnu/bin

$ /usr/freeware/bin

$ /usr/pkg/bin

$ EOF

$ while read d; do if test -x $d/ln -a -f $d/ln; then echo $d/ln; break; fi; done <<'EOF'
$ /bin

$ /usr/bin

$ /usr/sbin

$ /usr/local/bin

$ /usr/ccs/bin

$ /local/bin

$ /local/freeware/bin

$ /local/gnu/bin

$ /usr/freeware/bin

$ /usr/pkg/bin

$ EOF

/usr/bin/perl

/////
$ cd ~; pwd
/bin/ln

/////
$ ( test -d "/devkits/cygwin/devkits/cygwin/bin/ln" ; echo tramp_exit_status $? )
/home/amidon

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple