diff options
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/net/tramp-sh.el | 26 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 6 | 
2 files changed, 12 insertions, 20 deletions
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 5f145d4fae1..a744a53ca42 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -613,7 +613,7 @@ use Cwd \"realpath\";  sub myrealpath {      my ($file) = @_; -    return realpath($file) if -e $file; +    return realpath($file) if (-e $file || -l $file);  }  sub recursive { @@ -1139,12 +1139,7 @@ component is used as the target of the symlink."  		     (tramp-shell-quote-argument localname)))  	    (with-current-buffer (tramp-get-connection-buffer v)  	      (goto-char (point-min)) -	      (setq result (buffer-substring (point-min) (point-at-eol)))) -	    (when (and (file-symlink-p filename) -		       (string-equal result localname)) -	      (tramp-error -	       v 'file-error -	       "Apparent cycle of symbolic links for %s" filename))) +	      (setq result (buffer-substring (point-min) (point-at-eol)))))  	   ;; Use Perl implementation.  	   ((and (tramp-get-remote-perl v) @@ -1198,16 +1193,6 @@ component is used as the target of the symlink."  			 (setq numchase (1+ numchase))  			 (when (file-name-absolute-p symlink-target)  			   (setq result nil)) -			 ;; If the symlink was absolute, we'll get a -			 ;; string like "/user@host:/some/target"; -			 ;; extract the "/some/target" part from it. -			 (when (tramp-tramp-file-p symlink-target) -			   (unless (tramp-equal-remote filename symlink-target) -			     (tramp-error -			      v 'file-error -			      "Symlink target `%s' on wrong host" -			      symlink-target)) -			   (setq symlink-target localname))  			 (setq steps  			       (append  				(split-string symlink-target "/" 'omit)	steps))) @@ -1226,6 +1211,13 @@ component is used as the target of the symlink."  			"/"))  		(when (string= "" result)  		  (setq result "/"))))) + +	  ;; Detect cycle. +	  (when (and (file-symlink-p filename) +		     (string-equal result localname)) +	    (tramp-error +	     v 'file-error +	     "Apparent cycle of symbolic links for %s" filename))  	  ;; If the resulting localname looks remote, we must quote it  	  ;; for security reasons.  	  (when (or quoted (file-remote-p result)) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index abcd5282d3a..3573eeb7d49 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -3169,7 +3169,7 @@ User is always nil."  (defun tramp-handle-file-truename (filename)    "Like `file-truename' for Tramp files." -  (let ((result filename) +  (let ((result (expand-file-name filename))  	(numchase 0)  	;; Don't make the following value larger than  	;; necessary.  People expect an error message in a @@ -3180,7 +3180,7 @@ User is always nil."  	symlink-target)      (format       "%s%s" -     (with-parsed-tramp-file-name (expand-file-name result) v1 +     (with-parsed-tramp-file-name result v1         (with-tramp-file-property v1 v1-localname "file-truename"  	 (while (and (setq symlink-target (file-symlink-p result))  		     (< numchase numchase-limit)) @@ -3850,7 +3850,7 @@ Erase echoed commands if exists."  		     (min (+ (point-min) tramp-echo-mark-marker-length)  			  (point-max))))))        ;; No echo to be handled, now we can look for the regexp. -      ;; Sometimes, lines are much to long, and we run into a "Stack +      ;; Sometimes, lines are much too long, and we run into a "Stack        ;; overflow in regexp matcher".  For example, //DIRED// lines of        ;; directory listings with some thousand files.  Therefore, we        ;; look from the end.  | 
