unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Default remote user name in tramp
@ 2005-09-15  7:42 Slawomir Nowaczyk
  2005-09-15 21:08 ` Michael Albinus
  0 siblings, 1 reply; 6+ messages in thread
From: Slawomir Nowaczyk @ 2005-09-15  7:42 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 960 bytes --]

Hello,

Is there any chance to have the following small patch applied to
tramp.el? It allows one to specify default user name for remote hosts.
 
Some time ago tramp used to take user-login-name as a default remote
user name if it was not specified by "user@host". Now, however,
default user name is nil -- which makes tramp not work unless user
name is specified on every request, at least for me (I use "plink"
method and it doesn't seem to recognise remote prompt "login as:" and
keeps waiting for password prompt).

With my patch one can specify user name to use in such cases (it seems
to work, but I am quite new to elisp and don't claim to understand
tramp code). Note that in the default case, if user doesn't change the
value of tramp-default-username variable, my patch doesn't change
anything.

-- 
 Best wishes,
   Slawomir Nowaczyk
     ( slawomir.nowaczyk.847@student.lu.se )

Make Lots of Money, Enjoy the Work, Operate Within the Law: Choose 2

[-- Attachment #2: tramp.diff --]
[-- Type: application/octet-stream, Size: 662 bytes --]

*** tramp.el	Mon Aug 15 15:25:27 2005
--- tramp.el	Wed Sep 14 23:44:40 2005
***************
*** 165,170 ****
--- 165,172 ----
    :group 'tramp
    :type 'boolean)
  
+ (defvar tramp-default-username nil)
+ 
  ;; Emacs case
  (eval-and-compile
    (when (boundp 'backup-directory-alist)
***************
*** 6706,6712 ****
  	  (make-tramp-file-name
  	   :multi-method nil
  	   :method method
! 	   :user (or user nil)
  	   :host host
  	   :localname localname))))))
  
--- 6708,6714 ----
  	  (make-tramp-file-name
  	   :multi-method nil
  	   :method method
! 	   :user (or user tramp-default-username)
  	   :host host
  	   :localname localname))))))
  

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Default remote user name in tramp
  2005-09-15  7:42 Default remote user name in tramp Slawomir Nowaczyk
@ 2005-09-15 21:08 ` Michael Albinus
  2005-09-16 10:55   ` Slawomir Nowaczyk
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Albinus @ 2005-09-15 21:08 UTC (permalink / raw)
  Cc: emacs-devel

Slawomir Nowaczyk <slawomir.nowaczyk.847@student.lu.se> writes:

> Hello,

Hi,

> Is there any chance to have the following small patch applied to
> tramp.el? It allows one to specify default user name for remote hosts.

I'm a little bit reserved applying this patch. Tramp 2.1, the
developpers version, has such a customization mean (both
`tramp-default-user´and `tramp-default-user-alist´). Tramp 2.0, which
is part of Emacs 22, has been frozen a while ago, and should receive
bug fixes only.

So if you are couraged enough, you could use Tramp 2.1. Or you could
try to apply one of the recipes in
<http://www.gnu.org/software/tramp/#Frequently-Asked-Questions>. This
is from the Tramp 2.1 documentation (you'll find `tramp-default-user´
there), but most of the recipes should be applicable for Tramp 2.0
too.

> Some time ago tramp used to take user-login-name as a default remote
> user name if it was not specified by "user@host". Now, however,
> default user name is nil -- which makes tramp not work unless user
> name is specified on every request, at least for me (I use "plink"
> method and it doesn't seem to recognise remote prompt "login as:" and
> keeps waiting for password prompt).

That sounds like a bug. "login as:" would not be recognized as login
prompt, see `tramp-login-prompt-regexp´. Could you try to customize
that regexp to your needs, and see whether it works better?  Something
like ".*ogin.*: *" I would recommend. Please tell then whether it
helps.

Best regards, Michael.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Default remote user name in tramp
  2005-09-15 21:08 ` Michael Albinus
@ 2005-09-16 10:55   ` Slawomir Nowaczyk
  2005-09-18 10:50     ` Michael Albinus
  0 siblings, 1 reply; 6+ messages in thread
From: Slawomir Nowaczyk @ 2005-09-16 10:55 UTC (permalink / raw)


On Thu, 15 Sep 2005 23:08:38 +0200
Michael Albinus <michael.albinus@gmx.de> wrote:

#> > Is there any chance to have the following small patch applied to
#> > tramp.el? It allows one to specify default user name for remote hosts.

#> I'm a little bit reserved applying this patch. Tramp 2.1, the
#> developpers version, has such a customization mean (both
#> `tramp-default-user´and `tramp-default-user-alist´). Tramp 2.0,
#> which is part of Emacs 22, has been frozen a while ago, and should
#> receive bug fixes only.

OK, I see... I wasn't aware Tramp is being developed outside Emacs
CVS. There is no point in applying my patch in this case.

#> So if you are couraged enough, you could use Tramp 2.1.

I have tried Tramp-2.1.3, but it doesn't work for me at all. I get 
"format-spec: Invalid format string" error from macro at line 5783 of
tramp.el, in defun tramp-maybe-open-connection.

I will try to investigate further when I have time.

#> Or you could try to apply one of the recipes in
#> <http://www.gnu.org/software/tramp/#Frequently-Asked-Questions>.
#> This is from the Tramp 2.1 documentation (you'll find
#> `tramp-default-user´ there), but most of the recipes should be
#> applicable for Tramp 2.0 too.

A couple of those look interesting, although neither is as easy to use
as default user name :)

#> > Some time ago tramp used to take user-login-name as a default
#> > remote user name if it was not specified by "user@host". Now,
#> > however, default user name is nil -- which makes tramp not work
#> > unless user name is specified on every request, at least for me
#> > (I use "plink" method and it doesn't seem to recognise remote
#> > prompt "login as:" and keeps waiting for password prompt).
#> 
#> That sounds like a bug. "login as:" would not be recognized as
#> login prompt, see `tramp-login-prompt-regexp´. Could you try to
#> customize that regexp to your needs, and see whether it works
#> better? Something like ".*ogin.*: *" I would recommend. Please tell
#> then whether it helps.

I tried that. When I do:

(setq tramp-login-prompt-regexp "[Ll]ogin\\( as\\)?: *")

my "login as:" prompt gets recognised and tramp proceeds trying to
login using my user-login-name... cool :) 

Except there is, apparently, a bug which causes tramp to strip last
letter from user name (i.e. if my user-login-name is "slawek", tramp
tries to login using "slawe").

Setting user-login-name to "slawekX" seems to work for me at the
moment ;) I don't have any more time to hunt this bug right now, but
I will try to figure it out later.

Thanks for your ideas.

-- 
 Best wishes,
   Slawomir Nowaczyk
     ( slawomir.nowaczyk.847@student.lu.se )

If the code and the comments disagree, then both are probably wrong.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Default remote user name in tramp
  2005-09-16 10:55   ` Slawomir Nowaczyk
@ 2005-09-18 10:50     ` Michael Albinus
  2005-09-21 14:38       ` Slawomir Nowaczyk
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Albinus @ 2005-09-18 10:50 UTC (permalink / raw)
  Cc: emacs-devel

Slawomir Nowaczyk <slawomir.nowaczyk.847@student.lu.se> writes:

> #> So if you are couraged enough, you could use Tramp 2.1.
>
> I have tried Tramp-2.1.3, but it doesn't work for me at all. I get
> "format-spec: Invalid format string" error from macro at line 5783 of
> tramp.el, in defun tramp-maybe-open-connection.
>
> I will try to investigate further when I have time.

Please do so. If you know more, you might raise a bug report via
`tramp-submit-bug'.

> I tried that. When I do:
>
> (setq tramp-login-prompt-regexp "[Ll]ogin\\( as\\)?: *")
>
> my "login as:" prompt gets recognised and tramp proceeds trying to
> login using my user-login-name... cool :)

OK. I'll extend the regexp matching your case.

> Except there is, apparently, a bug which causes tramp to strip last
> letter from user name (i.e. if my user-login-name is "slawek", tramp
> tries to login using "slawe").
>
> Setting user-login-name to "slawekX" seems to work for me at the
> moment ;) I don't have any more time to hunt this bug right now, but
> I will try to figure it out later.

I cannot reproduce it here. Tramp uses the expression
(or user (user-login-name)) for sending the login name; I have no
idea why (and how) it should shorten it. What happens when you write
your user name in the file name, like "/ssh:username@hostname:/path"?

> Thanks for your ideas.

Best regards, Michael.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Default remote user name in tramp
  2005-09-18 10:50     ` Michael Albinus
@ 2005-09-21 14:38       ` Slawomir Nowaczyk
  2005-09-21 20:37         ` Michael Albinus
  0 siblings, 1 reply; 6+ messages in thread
From: Slawomir Nowaczyk @ 2005-09-21 14:38 UTC (permalink / raw)


On Sun, 18 Sep 2005 12:50:49 +0200
Michael Albinus <michael.albinus@gmx.de> wrote:

#> > I have tried Tramp-2.1.3, but it doesn't work for me at all. I get
#> > "format-spec: Invalid format string" error from macro at line 5783 of
#> > tramp.el, in defun tramp-maybe-open-connection.
#> >
#> > I will try to investigate further when I have time.
#> 
#> Please do so. If you know more, you might raise a bug report via
#> `tramp-submit-bug'.

It turned out to be configuration error on my part. Tramp-2.1.3 is
working great for me now.

This probably isn't the right forum for this question, but I wonder
why tramp sends Perl mime-encode and mime-decode scripts, even if
working mimencode program is found on the host. Seems a bit wasteful
for me, and I think (may be wrong) some earlier versions didn't do
that.

#> > Except there is, apparently, a bug which causes tramp to strip last
#> > letter from user name (i.e. if my user-login-name is "slawek", tramp
#> > tries to login using "slawe").
#> >
#> > Setting user-login-name to "slawekX" seems to work for me at the
#> > moment ;) I don't have any more time to hunt this bug right now, but
#> > I will try to figure it out later.
#> 
#> I cannot reproduce it here. Tramp uses the expression
#> (or user (user-login-name)) for sending the login name; I have no
#> idea why (and how) it should shorten it.

Neither do I. I did a quick check, but couldn't find the reason.

Adding " " in tramp-action-login like this:

    (process-send-string nil (concat (or user (user-login-name)) " "
    				   tramp-rsh-end-of-line)))

fixes the problem. I have no idea why, this may be related to the
end-of-line character on Windows (there is a workaround for sending
password, maybe something similar would help for user name as well).

However, everything is working fine with Tramp-2.1.3, so I am using it
right now. Seems to be the best possible workaround ;)

#> What happens when you write your user name in the file name, like
#> "/ssh:username@hostname:/path"?

It works fine. No idea why.

-- 
 Best wishes,
   Slawomir Nowaczyk
     ( slawomir.nowaczyk.847@student.lu.se )

There are two kinds of people, those who do the work and those who
take the credit. Try to be in the first group;
there is less competition there.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Default remote user name in tramp
  2005-09-21 14:38       ` Slawomir Nowaczyk
@ 2005-09-21 20:37         ` Michael Albinus
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Albinus @ 2005-09-21 20:37 UTC (permalink / raw)
  Cc: emacs-devel

Slawomir Nowaczyk <slawomir.nowaczyk.847@student.lu.se> writes:

> This probably isn't the right forum for this question, but I wonder
> why tramp sends Perl mime-encode and mime-decode scripts, even if
> working mimencode program is found on the host. Seems a bit wasteful
> for me, and I think (may be wrong) some earlier versions didn't do
> that.

Tramp 2.1.4, which I'm working on, has several optimizations. One of
them is a delayed transfer of scripts, that means a script is sent
at the time it is needed. This should speedup Tramp.

> #> I cannot reproduce it here. Tramp uses the expression
> #> (or user (user-login-name)) for sending the login name; I have no
> #> idea why (and how) it should shorten it.
>
> Neither do I. I did a quick check, but couldn't find the reason.

Again, a bug report will provide much more information. Please submit.

> I have no idea why, this may be related to the end-of-line character
> on Windows (there is a workaround for sending password, maybe
> something similar would help for user name as well).

Good guess. I will check it, when I'm back from my Sweden trip. (Hey,
I'll even pass Lund, but I won't have time to give local support :-)

Best regards, Michael.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-09-21 20:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-15  7:42 Default remote user name in tramp Slawomir Nowaczyk
2005-09-15 21:08 ` Michael Albinus
2005-09-16 10:55   ` Slawomir Nowaczyk
2005-09-18 10:50     ` Michael Albinus
2005-09-21 14:38       ` Slawomir Nowaczyk
2005-09-21 20:37         ` Michael Albinus

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).