From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Noah Lavine Newsgroups: gmane.emacs.devel Subject: Re: SCPC Detection Program Date: Thu, 15 Apr 2010 19:53:32 -0400 Message-ID: References: <8739z26jxo.fsf@gmx.de> <87iq7weaz4.fsf@gmx.de> <8739z0wim6.fsf@gmx.de> <877hobrrsc.fsf@gmx.de> <87y6gptmrf.fsf@gmx.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: dough.gmane.org 1271375686 8763 80.91.229.12 (15 Apr 2010 23:54:46 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 15 Apr 2010 23:54:46 +0000 (UTC) Cc: tramp-devel@gnu.org, emacs-devel@gnu.org To: Michael Albinus Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Apr 16 01:54:45 2010 connect(): No such file or directory Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1O2YtO-00042W-BF for ged-emacs-devel@m.gmane.org; Fri, 16 Apr 2010 01:54:42 +0200 Original-Received: from localhost ([127.0.0.1]:46643 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O2YtN-0003tn-Rf for ged-emacs-devel@m.gmane.org; Thu, 15 Apr 2010 19:54:41 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O2YsM-0003g0-PV for emacs-devel@gnu.org; Thu, 15 Apr 2010 19:53:38 -0400 Original-Received: from [140.186.70.92] (port=33933 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O2YsK-0003fF-Ux for emacs-devel@gnu.org; Thu, 15 Apr 2010 19:53:38 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O2YsJ-0005Bq-DQ for emacs-devel@gnu.org; Thu, 15 Apr 2010 19:53:36 -0400 Original-Received: from mail-yw0-f191.google.com ([209.85.211.191]:54013) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O2YsI-0005Bc-Uu; Thu, 15 Apr 2010 19:53:35 -0400 Original-Received: by ywh29 with SMTP id 29so1818185ywh.14 for ; Thu, 15 Apr 2010 16:53:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:received:message-id:subject:from:to:cc:content-type; bh=GqzGqwt4tHJsHQMCKHeuiw74OOBy4gR+V3xS96mHEQg=; b=T+wPH7jsBJRJ6nn4FtTXnBHJcacBla1p+BX0hj5PXBXBDMWrE5gAtTDmIAXbuQ38WT 1IANzPO4kmT75XMlOYpGKesI40vhnI77gmCjATbIO9sptC1XY61LVWDuSVcIsj0Mxo1m 7RMk3LOpb3412RFlmE5gbE4kiuf3QHFqu/qaA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=Z2rw0L8w+UETY7PdCX831NFMIgQKA1U00CAj1eeD+I7POIu2SvhjRi7M59qzRuZvs8 3PW1PP7B5qvvVAx0XtSw/M+p3jcPpJk96lKN0AbMAFffZIeRrJMEtX9CDU5cIQcC9QOT gA5BWh+ouT9XTryCVOD+U9nMSTW2ei17uwPp4= Original-Received: by 10.231.37.2 with HTTP; Thu, 15 Apr 2010 16:53:32 -0700 (PDT) In-Reply-To: <87y6gptmrf.fsf@gmx.de> Original-Received: by 10.101.206.5 with SMTP id i5mr1384622anq.199.1271375613064; Thu, 15 Apr 2010 16:53:33 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:123728 Archived-At: Hi Michael, I believe the following patch should do it. It's a bit less than 15 lines, but if that's still a problem, I've already written copyright-clerk@fsf.org asking for papers to make it completely legal. One issue is that the detection is currently fragile in the sense that it will return nil if the response isn't formatted exactly as it expects, even if the ssh program supports the ControlMaster argument - but it seems to me that false positives are the thing to worry about here, since false negatives are essentially exactly what the current scheme gives anyway. As for a ChangeLog entry, how about this? lisp/net/tramp.el: Detect ssh 'ControlMaster' argument automatically in some cases. Thank you very much Noah Lavine --- lisp/net/tramp-old.el 2010-04-08 10:40:26.000000000 -0400 +++ lisp/net/tramp.el 2010-04-15 19:45:21.000000000 -0400 @@ -653,38 +653,47 @@ `localhost' or the name of the local host. Another host name is useful only in combination with `tramp-default-proxies-alist'.") - +(defun tramp-detect-ssh-controlmaster () + "Call ssh with invalid arguments to try to detect whether it supports the ControlMaster argument. This function may return nil when the argument is supported, but shouldn't return t when it isn't" + (with-temp-buffer + (let ((ssh-call (condition-case nil + (call-process "ssh" nil t nil "-o" "ControlMaster") + (error nil)))) + (and ssh-call + (goto-char (point-min)) + (looking-at "command-line line 0: Missing ControlMaster argument."))))) (defcustom tramp-default-method ;; An external copy method seems to be preferred, because it is much ;; more performant for large files, and it hasn't too serious delays ;; for small files. But it must be ensured that there aren't ;; permanent password queries. Either a password agent like - ;; "ssh-agent" or "Pageant" shall run, or the optional password.el - ;; package shall be active for password caching. "scpc" would be - ;; another good choice because of the "ControlMaster" option, but - ;; this is a more modern alternative in OpenSSH 4, which cannot be - ;; taken as default. - (cond - ;; PuTTY is installed. - ((executable-find "pscp") - (if (or (fboundp 'password-read) + ;; "ssh-agent" or "Pageant" shall run, or the optional + ;; password-cache.el or auth-sources.el packages shall be active for + ;; password caching. + ;; "scpc" is chosen if we detect that the user is running OpenSSH 4.0 + ;; or newer. + cond + ;; PuTTY is installed. + ((executable-find "pscp") + (if (or (fboundp 'password-read) + (fboundp 'auth-source-user-or-password) ;; Pageant is running. - (and (fboundp 'w32-window-exists-p) - (funcall (symbol-function 'w32-window-exists-p) - "Pageant" "Pageant"))) - "pscp" - "plink")) - ;; There is an ssh installation. - ((executable-find "scp") - (if (or (fboundp 'password-read) - ;; ssh-agent is running. - (getenv "SSH_AUTH_SOCK") - (getenv "SSH_AGENT_PID")) - "scp" - "ssh")) - ;; Fallback. - (t "ftp")) + (tramp-compat-process-running-p "Pageant")) + "pscp" + "plink")) + ;; There is an ssh installation. + ((executable-find "scp") + (cond + ((tramp-detect-ssh-controlmaster) "scpc") + ((or (fboundp 'password-read) + (fboundp 'auth-source-user-or-password) + ;; ssh-agent is running. + (getenv "SSH_AUTH_SOCK") + (getenv "SSH_AGENT_PID")) "scp") + (t "ssh"))) + ;; Fallback. + (t "ftp") "*Default method to use for transferring files. See `tramp-methods' for possibilities. Also see `tramp-default-method-alist'." On Wed, Apr 14, 2010 at 11:31 PM, Michael Albinus wrote: > Noah Lavine writes: > >> Hi Michael, > > Hi Noah, > >> That sounds excellent. I'll try to submit a patch soon to implement >> that. Is it correct that patches like that should go to >> bug-gnu-emacs@gnu.org? > > It depends. In this case, it would be sufficient, if you simply post the > diff + a ChangeLog entry; I would commit it then for you. > > However, the change in tramp.el shall not be longer than ~15 lines, this > is acceptable if you have not signed the FSF papers. If you intend to > contribute further on, I recommend you to contact the FSF and sign the > papers; somebody has told earlier where to find information about. > >> Noah > > Thanks, and best regards, Michael. >