all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michael Albinus <michael.albinus@gmx.de>
To: Fan Yang <Fan_Yang@sjtu.edu.cn>
Cc: 38648@debbugs.gnu.org
Subject: bug#38648: 27.0.50; Emacs `compile' command does not handle remote (over TRAMP) file name correctly
Date: Tue, 17 Dec 2019 17:02:12 +0100	[thread overview]
Message-ID: <8736djym7v.fsf@gmx.de> (raw)
In-Reply-To: <m2fthjyvdf.fsf@Fans-Air.ipads-lab.se.sjtu.edu.cn> (Fan Yang's message of "Tue, 17 Dec 2019 20:44:28 +0800")

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

Fan Yang <Fan_Yang@sjtu.edu.cn> writes:

Hi,

> Re-produce steps:
>
> 1. `find-file' to my project root directory on a remote machine,
>    namely, "/scp:vm00:pmdk-balloon/".
> 2. `M-x compile', and give compile command "make".
> 3. (Previously I have injected some typos in some of my source files,
>    say "obj.c").
> 4. In the *compilation* buffer, the "obj.c" file appears.  But when I
>    click the underlined text (or <RET> on it), an error occurs in the
>    minibuffer:
>
>    "Find this error in (default obj.c): /scp:vm00:/System/Volumes/Data/home/fan/pmdk-balloon/src/libpmemobj"
>
>    The "/System/Volumes/Data/" is actually a path on my local machine.

> It appears that when compile.el was handling the remote path, it
> mixed-up part of my local machine path with the
> remote machine path, resulting the error.
>
> Then I find that in my environment, `(file-symlink-p "/home")' is
> evaluated to "/System/Volumes/Data/home".  Now I stuck here since I know
> little about TRAMP and how a remote file path should be handled.

Could you pls check, whether the appended patch fixes the problem?

Best regards, Michael.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1300 bytes --]

diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 3fbd6eb2c7..197d52b2de 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -2936,21 +2936,15 @@ compilation-get-file-structure
       ;; Let's normalize it and look again.
       (let ((filename (car file))
 	    ;; Get the specified directory from FILE.
-	    (spec-directory (if (cdr file)
-				(file-truename (cdr file)))))
+	    (spec-directory
+             (if (cdr file)
+		 (file-truename (concat comint-file-name-prefix (cdr file))))))

 	;; Check for a comint-file-name-prefix and prepend it if appropriate.
 	;; (This is very useful for compilation-minor-mode in an rlogin-mode
 	;; buffer.)
-	(when (and (boundp 'comint-file-name-prefix)
-		   (not (equal comint-file-name-prefix "")))
-	  (if (file-name-absolute-p filename)
-	      (setq filename
-		    (concat comint-file-name-prefix filename))
-	    (if spec-directory
-		(setq spec-directory
-		      (file-truename
-		       (concat comint-file-name-prefix spec-directory))))))
+	(if (file-name-absolute-p filename)
+	    (setq filename (concat comint-file-name-prefix filename)))

 	;; If compilation-parse-errors-filename-function is
 	;; defined, use it to process the filename.  The result might be a

  reply	other threads:[~2019-12-17 16:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-17 12:44 bug#38648: 27.0.50; Emacs `compile' command does not handle remote (over TRAMP) file name correctly Fan Yang
2019-12-17 16:02 ` Michael Albinus [this message]
2019-12-18  1:52   ` Fan Yang
2019-12-18  2:02     ` Fan Yang
2019-12-18  9:21       ` Michael Albinus
2019-12-18  9:20     ` Michael Albinus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8736djym7v.fsf@gmx.de \
    --to=michael.albinus@gmx.de \
    --cc=38648@debbugs.gnu.org \
    --cc=Fan_Yang@sjtu.edu.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.