[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tramp (2.0.29); erroneous error message: File is a symlink to a none

From: Kai Großjohann
Subject: Re: tramp (2.0.29); erroneous error message: File is a symlink to a nonexistent target
Date: Sun, 06 Apr 2003 21:49:24 +0200
User-agent: Gnus/5.090018 (Oort Gnus v0.18) Emacs/21.3.50 (gnu/linux)

Michael Albinus <address@hidden> writes:

> Kai: could you, please, verify this, and commit the ange-ftp patch to
> CVS if you agree?

I've now tried stuff, and I'm afraid things aren't working out so
well.  I've got the current Emacs CVS and I've also got the current
Tramp CVS.  And then I applied changes to ange-ftp.el; I hope they
are what you meant.  I'll include them below so that you can check.

When I hit `f' on the x symlink in the following dired buffer, I get
a backtrace that indicates that ange-ftp-expand-symlink has been
called with a nil first arg.

Here is the dired buffer:

  total 8
  drwxrwx---    2 kai      kai          4096 Mar 31 23:09 .
  drwxrwx---    5 kai      kai          4096 Mar 31 23:02 ..
  lrwxrwxrwx    1 kai      kai             7 Mar 31 23:02 x -> ../auto
  lrwxrwxrwx    1 kai      kai             4 Mar 31 23:03 y -> /tmp
  lrwxrwxrwx    1 kai      kai             4 Mar 31 23:05 y- -> /tmp
  lrwxrwxrwx    1 kai      kai             4 Mar 31 23:05 y-- -> /tmp
  lrwxrwxrwx    1 kai      kai            11 Mar 31 23:09 z -> /tmp/kaifoo

Here is the backtrace:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  (if (file-name-absolute-p file) (ange-ftp-replace-name-component dir file) 
(expand-file-name file dir))
  (let ((res ...)) (if (file-symlink-p res) (ange-ftp-expand-symlink ... ...) 
  (ange-ftp-insert-directory (ange-ftp-expand-symlink (nth 2 ...) 
(file-name-directory ...)) switches wildcard full)
  (if (and (not wildcard) (setq tem ...)) (ange-ftp-insert-directory 
(ange-ftp-expand-symlink ... ...) switches wildcard full) (insert (if wildcard 
... ...)))
  (if parsed (if (and ... ...) (ange-ftp-insert-directory ... switches wildcard 
full) (insert ...)) (ange-ftp-real-insert-directory file switches wildcard 
  (let ((short ...) (parsed ...) tem) (if parsed (if ... ... ...) 
(ange-ftp-real-insert-directory file switches wildcard full)))
"--dired -al" nil t)
("/ftp:address@hidden:/home/kai/tmp/ange-ftp-test/x/" "--dired -al" nil t))
  (progn (apply fn args))
  (unwind-protect (progn (apply fn args)) (set-match-data 
  (let ((save-match-data-internal ...)) (unwind-protect (progn ...) 
(set-match-data save-match-data-internal)))
  (save-match-data (apply fn args))
  (if fn (save-match-data (apply fn args)) (ange-ftp-run-real-handler operation 
  (let ((fn ...)) (if fn (save-match-data ...) (ange-ftp-run-real-handler 
operation args)))
"/ftp:address@hidden:/home/kai/tmp/ange-ftp-test/x/" "--dired -al" nil t)
  apply(ange-ftp-hook-function insert-directory 
("/ftp:address@hidden:/home/kai/tmp/ange-ftp-test/x/" "--dired -al" nil t))
"/ftp:address@hidden:/home/kai/tmp/ange-ftp-test/x/" "--dired -al" nil t)
  apply(tramp-ftp-file-name-handler insert-directory 
("/ftp:address@hidden:/home/kai/tmp/ange-ftp-test/x/" "--dired -al" nil t))
"/ftp:address@hidden:/home/kai/tmp/ange-ftp-test/x/" "--dired -al" nil t)
"--dired -al" nil t)
"-al" nil nil t)
  find-file-noselect("/ftp:address@hidden:/home/kai/tmp/ange-ftp-test/x" nil 
nil nil)
  ad-Orig-find-file("/ftp:address@hidden:/home/kai/tmp/ange-ftp-test/x" nil)
  (setq ad-return-value (ad-Orig-find-file filename wildcards))
  (let (ad-return-value) (setq ad-return-value (ad-Orig-find-file filename 
wildcards)) ad-return-value)

And, finally, here are the changes.  I ran "make recompile" in the
lisp subdir of the Emacs source tree, then did a "make install", then
started a new Emacs instance that produced the above backtrace.

Maybe I made a mistake in applying the patches?  I couldn't just run
the snippets through "patch", it rejected two of the three hunks.  So
I did it manually.  Quite possibly, I've b0rked it somewhere.

--- ange-ftp.el.~1.48.~ Sat Feb 15 16:41:33 2003
+++ ange-ftp.el Sun Apr  6 21:38:23 2003
@@ -3356,9 +3356,14 @@
       (ange-ftp-real-insert-file-contents filename visit beg end replace))))
 (defun ange-ftp-expand-symlink (file dir)
-  (if (file-name-absolute-p file)
-      (ange-ftp-replace-name-component dir file)
-    (expand-file-name file dir)))
+  (let ((res (if (file-name-absolute-p file)
+                (ange-ftp-replace-name-component dir file)
+              (expand-file-name file dir))))
+    (if (file-symlink-p res)
+       (ange-ftp-expand-symlink
+        (ange-ftp-get-file-entry res)
+        (file-name-directory (directory-file-name res)))
+      res)))
 (defun ange-ftp-file-symlink-p (file)
   ;; call ange-ftp-expand-file-name rather than the normal
@@ -3370,11 +3375,7 @@
              (ange-ftp-get-file-part file)
              (ange-ftp-get-files (file-name-directory file)))))
-       (if (stringp file-ent)
-           (if (file-name-absolute-p file-ent)
-               (ange-ftp-replace-name-component
-                (file-name-directory file) file-ent)
-             file-ent)))
+       (and (stringp file-ent) file-ent))
     (ange-ftp-real-file-symlink-p file)))
 (defun ange-ftp-file-exists-p (name)
@@ -4432,7 +4433,8 @@
                 (setq tem (file-symlink-p (directory-file-name file))))
-             tem (file-name-directory (directory-file-name file)))
+             (nth 2 (ange-ftp-ftp-name tem))
+             (file-name-directory (directory-file-name file)))
             switches wildcard full)
           (if wildcard

So, how to proceed from here?
A preposition is not a good thing to end a sentence with.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]