From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Christian Johansson Newsgroups: gmane.emacs.bugs Subject: bug#30533: 26.0.60; (copy-file) over TRAMP FTP mistakes file for directory Date: Thu, 22 Feb 2018 06:11:13 +0100 Message-ID: References: <121b6c23-1806-2d06-17df-0ccc1cfa99c5@cvj.se> <87k1v6cvv5.fsf@gmx.de> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="------------D7781B034220ADD68CE72648" X-Trace: blaine.gmane.org 1519276212 12746 195.159.176.226 (22 Feb 2018 05:10:12 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 22 Feb 2018 05:10:12 +0000 (UTC) User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 Cc: 30533@debbugs.gnu.org To: Michael Albinus Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Feb 22 06:10:08 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eoj8y-0002sO-2R for geb-bug-gnu-emacs@m.gmane.org; Thu, 22 Feb 2018 06:10:08 +0100 Original-Received: from localhost ([::1]:36153 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eojB0-0007hI-90 for geb-bug-gnu-emacs@m.gmane.org; Thu, 22 Feb 2018 00:12:14 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39033) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eojAt-0007h5-OK for bug-gnu-emacs@gnu.org; Thu, 22 Feb 2018 00:12:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eojAo-0001F7-Ms for bug-gnu-emacs@gnu.org; Thu, 22 Feb 2018 00:12:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:47251) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eojAo-0001Do-9J for bug-gnu-emacs@gnu.org; Thu, 22 Feb 2018 00:12:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eojAn-0007Fc-QE for bug-gnu-emacs@gnu.org; Thu, 22 Feb 2018 00:12:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Christian Johansson Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 22 Feb 2018 05:12:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 30533 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 30533-submit@debbugs.gnu.org id=B30533.151927630327842 (code B ref 30533); Thu, 22 Feb 2018 05:12:01 +0000 Original-Received: (at 30533) by debbugs.gnu.org; 22 Feb 2018 05:11:43 +0000 Original-Received: from localhost ([127.0.0.1]:55147 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eojAU-0007F0-LT for submit@debbugs.gnu.org; Thu, 22 Feb 2018 00:11:42 -0500 Original-Received: from cvj.se ([31.192.230.63]:35435) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eojAS-0007Eq-Hl for 30533@debbugs.gnu.org; Thu, 22 Feb 2018 00:11:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=cvj.se; s=x; h=Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject; bh=5IZNHHFKdtPmYEyyYWt+zNe1k7yX9t2jR50Tu1rchnU=; b=iLYGoFDybPzKX3CQH18Ufjp7D6Zng3xKKENx4WEILzX6pK89uF9TutCFDGuyXm2p+XyelrzJAEjq5wmDChOrL2ynbkpwhnixgCmE2/cTFQKnguc1hl9Z+t5XIEJu/FNvrV+nbjc8oWaLHkChFeK4IFRnIhJxBePLmqqbPwfygfY=; Original-Received: from c-efd370d5.011-155-65736b4.cust.bredbandsbolaget.se ([213.112.211.239] helo=Christians-MacBook-Air.local) by cvj.se with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1eojA4-000288-2p; Thu, 22 Feb 2018 06:11:39 +0100 In-Reply-To: <87k1v6cvv5.fsf@gmx.de> Content-Language: en-US X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:143585 Archived-At: This is a multi-part message in MIME format. --------------D7781B034220ADD68CE72648 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Hi Michael! Your fix fixed one of the issues. (file-regular-p) now works as expected over TRAMP ftp. I can't reproduce the other one right now. There must be some kind of cache influencing the other issue.. I deleted the tramp directory but it had no effect.. I'll make a new report if I find a way to reproduce the other issue. Regards Christian On 2018-02-21 14:31, Michael Albinus wrote: > Christian Johansson writes: > > Hi Christian, > >> Here are two cases that display different tramp errors related to >> copy-file, but only if you don't open the remote path using dired-mode >> first. > Got it. In fact, ange-ftp has no file-regular-p implementation. I've > added this, could you, pls, test: > > > > diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el > index e62bee4499..a267fc6448 100644 > --- a/lisp/net/ange-ftp.el > +++ b/lisp/net/ange-ftp.el > @@ -3373,6 +3373,13 @@ ange-ftp-file-symlink-p > (file-error nil)) > (ange-ftp-real-file-symlink-p file))) > > +(defun ange-ftp-file-regular-p (file) > + ;; Reuse Tramp's implementation. > + (if (ange-ftp-ftp-name file) > + (and (file-exists-p file) > + (eq ?- (aref (file-attribute-modes (file-attributes file)) 0))) > + (ange-ftp-real-file-regular-p file))) > + > (defun ange-ftp-file-exists-p (name) > (setq name (expand-file-name name)) > (if (ange-ftp-ftp-name name) > @@ -4389,6 +4396,7 @@ ange-ftp-hook-function > (put 'file-readable-p 'ange-ftp 'ange-ftp-file-readable-p) > (put 'file-executable-p 'ange-ftp 'ange-ftp-file-executable-p) > (put 'file-symlink-p 'ange-ftp 'ange-ftp-file-symlink-p) > +(put 'file-regular-p 'ange-ftp 'ange-ftp-file-regular-p) > (put 'delete-file 'ange-ftp 'ange-ftp-delete-file) > (put 'verify-visited-file-modtime 'ange-ftp > 'ange-ftp-verify-visited-file-modtime) > @@ -4477,6 +4485,8 @@ ange-ftp-real-file-executable-p > (ange-ftp-run-real-handler 'file-executable-p args)) > (defun ange-ftp-real-file-symlink-p (&rest args) > (ange-ftp-run-real-handler 'file-symlink-p args)) > +(defun ange-ftp-real-file-regular-p (&rest args) > + (ange-ftp-run-real-handler 'file-regular-p args)) > (defun ange-ftp-real-delete-file (&rest args) > (ange-ftp-run-real-handler 'delete-file args)) > (defun ange-ftp-real-verify-visited-file-modtime (&rest args) > > > Best regards, Michael. --------------D7781B034220ADD68CE72648 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit

Hi Michael!

Your fix fixed one of the issues. (file-regular-p) now works as expected over TRAMP ftp.

I can't reproduce the other one right now. There must be some kind of cache influencing the other issue.. I deleted the tramp directory but it had no effect.. I'll make a new report if I find a way to reproduce the other issue.

Regards
Christian


On 2018-02-21 14:31, Michael Albinus wrote:
Christian Johansson <christian@cvj.se> writes:

Hi Christian,

Here are two cases that display different tramp errors related to
copy-file, but only if you don't open the remote path using dired-mode
first.
Got it. In fact, ange-ftp has no file-regular-p implementation. I've
added this, could you, pls, test:



diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el
index e62bee4499..a267fc6448 100644
--- a/lisp/net/ange-ftp.el
+++ b/lisp/net/ange-ftp.el
@@ -3373,6 +3373,13 @@ ange-ftp-file-symlink-p
 	(file-error nil))
     (ange-ftp-real-file-symlink-p file)))
 
+(defun ange-ftp-file-regular-p (file)
+  ;; Reuse Tramp's implementation.
+  (if (ange-ftp-ftp-name file)
+      (and (file-exists-p file)
+       (eq ?- (aref (file-attribute-modes (file-attributes file)) 0)))
+    (ange-ftp-real-file-regular-p file)))
+
 (defun ange-ftp-file-exists-p (name)
   (setq name (expand-file-name name))
   (if (ange-ftp-ftp-name name)
@@ -4389,6 +4396,7 @@ ange-ftp-hook-function
 (put 'file-readable-p 'ange-ftp 'ange-ftp-file-readable-p)
 (put 'file-executable-p 'ange-ftp 'ange-ftp-file-executable-p)
 (put 'file-symlink-p 'ange-ftp 'ange-ftp-file-symlink-p)
+(put 'file-regular-p 'ange-ftp 'ange-ftp-file-regular-p)
 (put 'delete-file 'ange-ftp 'ange-ftp-delete-file)
 (put 'verify-visited-file-modtime 'ange-ftp
      'ange-ftp-verify-visited-file-modtime)
@@ -4477,6 +4485,8 @@ ange-ftp-real-file-executable-p
   (ange-ftp-run-real-handler 'file-executable-p args))
 (defun ange-ftp-real-file-symlink-p (&rest args)
   (ange-ftp-run-real-handler 'file-symlink-p args))
+(defun ange-ftp-real-file-regular-p (&rest args)
+  (ange-ftp-run-real-handler 'file-regular-p args))
 (defun ange-ftp-real-delete-file (&rest args)
   (ange-ftp-run-real-handler 'delete-file args))
 (defun ange-ftp-real-verify-visited-file-modtime (&rest args)


Best regards, Michael.

--------------D7781B034220ADD68CE72648--