aboutsummaryrefslogtreecommitdiffstats
path: root/test/lisp
diff options
context:
space:
mode:
authorMichael Albinus2017-08-26 15:09:55 +0200
committerMichael Albinus2017-08-26 15:09:55 +0200
commitcc7530cae09b0aa4d648d92ca0f82c81439a6b34 (patch)
treeda638672ca419b379a5df3e7675aaff852b986ea /test/lisp
parentdcc3ef3ee7b7cf2730378fca4c959f1fc799fbe2 (diff)
downloademacs-cc7530cae09b0aa4d648d92ca0f82c81439a6b34.tar.gz
emacs-cc7530cae09b0aa4d648d92ca0f82c81439a6b34.zip
Fix Tramp part of Bug#28156
* lisp/files.el (file-name-non-special): Use `file-name-quote' instead prefixing "/:", the file could already be quoted. * lisp/net/tramp.el (tramp-error): Handle null arguments. (tramp-handle-make-symbolic-link): * lisp/net/tramp-sh.el (tramp-sh-handle-make-symbolic-link) (tramp-sh-handle-add-name-to-file): * lisp/net/tramp-smb.el (tramp-smb-handle-add-name-to-file) (tramp-smb-handle-make-symbolic-link): Adapt implementation to stronger semantics in Emacs. (Bug#28156) * test/lisp/net/tramp-tests.el (tramp-test21-file-links): Extend test.
Diffstat (limited to 'test/lisp')
-rw-r--r--test/lisp/net/tramp-tests.el30
1 files changed, 24 insertions, 6 deletions
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 55f4b52ccdf..3dbb522a7cd 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -2587,16 +2587,19 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
2587 (not (string-equal (error-message-string err) 2587 (not (string-equal (error-message-string err)
2588 "make-symbolic-link not supported"))))) 2588 "make-symbolic-link not supported")))))
2589 (should (file-symlink-p tmp-name2)) 2589 (should (file-symlink-p tmp-name2))
2590 (should-error (make-symbolic-link tmp-name1 tmp-name2)) 2590 (should-error (make-symbolic-link tmp-name1 tmp-name2)
2591 :type 'file-already-exists)
2591 (make-symbolic-link tmp-name1 tmp-name2 'ok-if-already-exists) 2592 (make-symbolic-link tmp-name1 tmp-name2 'ok-if-already-exists)
2592 (should (file-symlink-p tmp-name2)) 2593 (should (file-symlink-p tmp-name2))
2593 ;; `tmp-name3' is a local file name. 2594 ;; `tmp-name3' is a local file name.
2594 (should-error (make-symbolic-link tmp-name1 tmp-name3))) 2595 (make-symbolic-link tmp-name1 tmp-name3)
2596 (should (file-symlink-p tmp-name3)))
2595 2597
2596 ;; Cleanup. 2598 ;; Cleanup.
2597 (ignore-errors 2599 (ignore-errors
2598 (delete-file tmp-name1) 2600 (delete-file tmp-name1)
2599 (delete-file tmp-name2))) 2601 (delete-file tmp-name2)
2602 (delete-file tmp-name3)))
2600 2603
2601 ;; Check `add-name-to-file'. 2604 ;; Check `add-name-to-file'.
2602 (unwind-protect 2605 (unwind-protect
@@ -2605,7 +2608,8 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
2605 (should (file-exists-p tmp-name1)) 2608 (should (file-exists-p tmp-name1))
2606 (add-name-to-file tmp-name1 tmp-name2) 2609 (add-name-to-file tmp-name1 tmp-name2)
2607 (should-not (file-symlink-p tmp-name2)) 2610 (should-not (file-symlink-p tmp-name2))
2608 (should-error (add-name-to-file tmp-name1 tmp-name2)) 2611 (should-error (add-name-to-file tmp-name1 tmp-name2)
2612 :type 'file-already-exists)
2609 (add-name-to-file tmp-name1 tmp-name2 'ok-if-already-exists) 2613 (add-name-to-file tmp-name1 tmp-name2 'ok-if-already-exists)
2610 (should-not (file-symlink-p tmp-name2)) 2614 (should-not (file-symlink-p tmp-name2))
2611 ;; `tmp-name3' is a local file name. 2615 ;; `tmp-name3' is a local file name.
@@ -2626,10 +2630,24 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
2626 (should-not (string-equal tmp-name2 (file-truename tmp-name2))) 2630 (should-not (string-equal tmp-name2 (file-truename tmp-name2)))
2627 (should 2631 (should
2628 (string-equal (file-truename tmp-name1) (file-truename tmp-name2))) 2632 (string-equal (file-truename tmp-name1) (file-truename tmp-name2)))
2629 (should (file-equal-p tmp-name1 tmp-name2))) 2633 (should (file-equal-p tmp-name1 tmp-name2))
2634 ;; `tmp-name3' is a local file name.
2635 (make-symbolic-link tmp-name1 tmp-name3)
2636 (should (file-symlink-p tmp-name3))
2637 (should-not (string-equal tmp-name3 (file-truename tmp-name3)))
2638 ;; `file-truename' returns a quoted file name for `tmp-name3'.
2639 ;; We must unquote it.
2640 (should
2641 (string-equal
2642 (file-truename tmp-name1)
2643 (funcall
2644 'tramp-compat-file-name-unquote (file-truename tmp-name3)))))
2645
2646 ;; Cleanup.
2630 (ignore-errors 2647 (ignore-errors
2631 (delete-file tmp-name1) 2648 (delete-file tmp-name1)
2632 (delete-file tmp-name2))) 2649 (delete-file tmp-name2)
2650 (delete-file tmp-name3)))
2633 2651
2634 ;; `file-truename' shall preserve trailing link of directories. 2652 ;; `file-truename' shall preserve trailing link of directories.
2635 (unless (file-symlink-p tramp-test-temporary-file-directory) 2653 (unless (file-symlink-p tramp-test-temporary-file-directory)