diff options
| author | Glenn Morris | 2017-11-14 17:43:06 -0500 |
|---|---|---|
| committer | Glenn Morris | 2017-11-14 17:43:06 -0500 |
| commit | 52d822f31bc7cb57694c1e209b2d02e5efb8f48c (patch) | |
| tree | a3d07b0e0e1e4a692a2420c7e5c0d7c05e3ab62b | |
| parent | 13248f7444630508cfc3b78a07e8d96613af11c8 (diff) | |
| parent | 796c7f7a949c83d64ae37cadb9a0ca28a2f1823a (diff) | |
| download | emacs-52d822f31bc7cb57694c1e209b2d02e5efb8f48c.tar.gz emacs-52d822f31bc7cb57694c1e209b2d02e5efb8f48c.zip | |
Merge from origin/emacs-26
796c7f7 (origin/emacs-26) ; Fix last fix of 'mouse-drag-and-drop-region'
40d41dd (emacs-26) Fix Bug#28139
a5ec644 Fix Bug#29291
8b900e5 Fix Bug#2928
ff7bd84 Make 'mouse-drag-and-drop-region' work with 'mouse-autoselect...
0491de8 * etc/PROBLEMS: Remove fixed xterm-mouse-mode problems
caa39f4 Fix cookie handling (bug#29282)
93304e3 Improve documentation of Edebug and macros
| -rw-r--r-- | doc/lispref/edebug.texi | 32 | ||||
| -rw-r--r-- | etc/PROBLEMS | 24 | ||||
| -rw-r--r-- | lisp/mouse.el | 4 | ||||
| -rw-r--r-- | lisp/net/tramp-sh.el | 25 | ||||
| -rw-r--r-- | lisp/url/url-cookie.el | 53 | ||||
| -rw-r--r-- | test/lisp/net/tramp-tests.el | 123 |
6 files changed, 136 insertions, 125 deletions
diff --git a/doc/lispref/edebug.texi b/doc/lispref/edebug.texi index 651bfacb4cf..979add9f319 100644 --- a/doc/lispref/edebug.texi +++ b/doc/lispref/edebug.texi | |||
| @@ -1144,9 +1144,12 @@ the @code{declare} form. | |||
| 1144 | @c automatically load the entire source file containing the function | 1144 | @c automatically load the entire source file containing the function |
| 1145 | @c being instrumented. That would avoid this. | 1145 | @c being instrumented. That would avoid this. |
| 1146 | Take care to ensure that the specifications are known to Edebug when | 1146 | Take care to ensure that the specifications are known to Edebug when |
| 1147 | you instrument code. If you are instrumenting a function from a file | 1147 | you instrument code. If you are instrumenting a function which uses a |
| 1148 | that uses @code{eval-when-compile} to require another file containing | 1148 | macro defined in another file, you may first need to either evaluate |
| 1149 | macro definitions, you may need to explicitly load that file. | 1149 | the @code{require} forms in the file containing your function, or |
| 1150 | explicitly load the file containing the macro. If the definition of a | ||
| 1151 | macro is wrapped by @code{eval-when-compile}, you may need to evaluate | ||
| 1152 | it. | ||
| 1150 | 1153 | ||
| 1151 | You can also define an edebug specification for a macro separately | 1154 | You can also define an edebug specification for a macro separately |
| 1152 | from the macro definition with @code{def-edebug-spec}. Adding | 1155 | from the macro definition with @code{def-edebug-spec}. Adding |
| @@ -1231,13 +1234,17 @@ A single unevaluated Lisp object, which is not instrumented. | |||
| 1231 | @c an "expression" is not necessarily intended for evaluation. | 1234 | @c an "expression" is not necessarily intended for evaluation. |
| 1232 | 1235 | ||
| 1233 | @item form | 1236 | @item form |
| 1234 | A single evaluated expression, which is instrumented. | 1237 | A single evaluated expression, which is instrumented. If your macro |
| 1238 | wraps the expression with @code{lambda} before it is evaluated, use | ||
| 1239 | @code{def-form} instead. See @code{def-form} below. | ||
| 1235 | 1240 | ||
| 1236 | @item place | 1241 | @item place |
| 1237 | A generalized variable. @xref{Generalized Variables}. | 1242 | A generalized variable. @xref{Generalized Variables}. |
| 1238 | 1243 | ||
| 1239 | @item body | 1244 | @item body |
| 1240 | Short for @code{&rest form}. See @code{&rest} below. | 1245 | Short for @code{&rest form}. See @code{&rest} below. If your macro |
| 1246 | wraps its body of code with @code{lambda} before it is evaluated, use | ||
| 1247 | @code{def-body} instead. See @code{def-body} below. | ||
| 1241 | 1248 | ||
| 1242 | @item function-form | 1249 | @item function-form |
| 1243 | A function form: either a quoted function symbol, a quoted lambda | 1250 | A function form: either a quoted function symbol, a quoted lambda |
| @@ -1292,11 +1299,16 @@ succeeds. | |||
| 1292 | 1299 | ||
| 1293 | @item &define | 1300 | @item &define |
| 1294 | @c @kindex &define @r{(Edebug)} | 1301 | @c @kindex &define @r{(Edebug)} |
| 1295 | Indicates that the specification is for a defining form. The defining | 1302 | |
| 1296 | form itself is not instrumented (that is, Edebug does not stop before and | 1303 | Indicates that the specification is for a defining form. Edebug's |
| 1297 | after the defining form), but forms inside it typically will be | 1304 | definition of a defining form is a form containing one or more code |
| 1298 | instrumented. The @code{&define} keyword should be the first element in | 1305 | forms which are saved and executed later, after the execution of the |
| 1299 | a list specification. | 1306 | defining form. |
| 1307 | |||
| 1308 | The defining form itself is not instrumented (that is, Edebug does not | ||
| 1309 | stop before and after the defining form), but forms inside it | ||
| 1310 | typically will be instrumented. The @code{&define} keyword should be | ||
| 1311 | the first element in a list specification. | ||
| 1300 | 1312 | ||
| 1301 | @item nil | 1313 | @item nil |
| 1302 | This is successful when there are no more arguments to match at the | 1314 | This is successful when there are no more arguments to match at the |
diff --git a/etc/PROBLEMS b/etc/PROBLEMS index 6a847f695b9..78d563ef817 100644 --- a/etc/PROBLEMS +++ b/etc/PROBLEMS | |||
| @@ -1113,14 +1113,6 @@ to happen in *.UTF-8 locales; zh_CN.GB2312 and zh_CN.GBK locales, for | |||
| 1113 | example, work fine. A bug report has been filed in the Gnome | 1113 | example, work fine. A bug report has been filed in the Gnome |
| 1114 | bugzilla: http://bugzilla.gnome.org/show_bug.cgi?id=357032 | 1114 | bugzilla: http://bugzilla.gnome.org/show_bug.cgi?id=357032 |
| 1115 | 1115 | ||
| 1116 | *** Gnome: Emacs's xterm-mouse-mode doesn't work on the Gnome terminal. | ||
| 1117 | |||
| 1118 | A symptom of this bug is that double-clicks insert a control sequence | ||
| 1119 | into the buffer. The reason this happens is an apparent | ||
| 1120 | incompatibility of the Gnome terminal with Xterm, which also affects | ||
| 1121 | other programs using the Xterm mouse interface. A problem report has | ||
| 1122 | been filed. | ||
| 1123 | |||
| 1124 | *** Gnome: GPaste clipboard manager causes erratic behavior of 'yank' | 1116 | *** Gnome: GPaste clipboard manager causes erratic behavior of 'yank' |
| 1125 | 1117 | ||
| 1126 | The symptom is that 'kill-line' followed by 'yank' often (but not | 1118 | The symptom is that 'kill-line' followed by 'yank' often (but not |
| @@ -1492,22 +1484,6 @@ this, you can remove the X resource or put this in your init file: | |||
| 1492 | 1484 | ||
| 1493 | (xterm-remove-modify-other-keys) | 1485 | (xterm-remove-modify-other-keys) |
| 1494 | 1486 | ||
| 1495 | ** Emacs's xterm-mouse doesn't work well in Evil mode. | ||
| 1496 | |||
| 1497 | Specifically, clicking mouse-1 doesn't work as expected: instead of | ||
| 1498 | moving point where you click, it highlights the region between the | ||
| 1499 | line beginning and the click location, and displays error messages | ||
| 1500 | about unbound keys in the echo area. | ||
| 1501 | |||
| 1502 | To work around this, put this in your .emacs file: | ||
| 1503 | |||
| 1504 | (with-eval-after-load 'evil-maps | ||
| 1505 | (define-key evil-motion-state-map [down-mouse-1] nil)) | ||
| 1506 | |||
| 1507 | This appears to be a bug in Evil. | ||
| 1508 | See discussions in https://github.com/emacs-evil/evil/issues/960 | ||
| 1509 | and https://debbugs.gnu.org/cgi/bugreport.cgi?bug=29143 | ||
| 1510 | |||
| 1511 | ** Emacs spontaneously displays "I-search: " at the bottom of the screen. | 1487 | ** Emacs spontaneously displays "I-search: " at the bottom of the screen. |
| 1512 | 1488 | ||
| 1513 | This means that Control-S/Control-Q (XON/XOFF) "flow control" is being | 1489 | This means that Control-S/Control-Q (XON/XOFF) "flow control" is being |
diff --git a/lisp/mouse.el b/lisp/mouse.el index 5eeee1ec52c..17d1732e501 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el | |||
| @@ -2380,7 +2380,9 @@ is copied instead of being cut." | |||
| 2380 | ;; When event was click instead of drag, skip loop | 2380 | ;; When event was click instead of drag, skip loop |
| 2381 | (while (progn | 2381 | (while (progn |
| 2382 | (setq event (read-event)) | 2382 | (setq event (read-event)) |
| 2383 | (mouse-movement-p event)) | 2383 | (or (mouse-movement-p event) |
| 2384 | ;; Handle `mouse-autoselect-window'. | ||
| 2385 | (eq (car-safe event) 'select-window))) | ||
| 2384 | (unless value-selection ; initialization | 2386 | (unless value-selection ; initialization |
| 2385 | (delete-overlay mouse-secondary-overlay) | 2387 | (delete-overlay mouse-secondary-overlay) |
| 2386 | (setq value-selection (buffer-substring start end)) | 2388 | (setq value-selection (buffer-substring start end)) |
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 52a6b8fac0b..acb5a12ba2a 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el | |||
| @@ -533,9 +533,7 @@ the list by the special value `tramp-own-remote-path'." | |||
| 533 | 533 | ||
| 534 | ;;;###tramp-autoload | 534 | ;;;###tramp-autoload |
| 535 | (defcustom tramp-remote-process-environment | 535 | (defcustom tramp-remote-process-environment |
| 536 | `("ENV=''" "TMOUT=0" "LC_CTYPE=''" | 536 | '("ENV=''" "TMOUT=0" "LC_CTYPE=''" |
| 537 | ,(format "TERM=%s" tramp-terminal-type) | ||
| 538 | ,(format "INSIDE_EMACS='%s,tramp:%s'" emacs-version tramp-version) | ||
| 539 | "CDPATH=" "HISTORY=" "MAIL=" "MAILCHECK=" "MAILPATH=" "PAGER=cat" | 537 | "CDPATH=" "HISTORY=" "MAIL=" "MAILCHECK=" "MAILPATH=" "PAGER=cat" |
| 540 | "autocorrect=" "correct=") | 538 | "autocorrect=" "correct=") |
| 541 | "List of environment variables to be set on the remote host. | 539 | "List of environment variables to be set on the remote host. |
| @@ -544,8 +542,15 @@ Each element should be a string of the form ENVVARNAME=VALUE. An | |||
| 544 | entry ENVVARNAME= disables the corresponding environment variable, | 542 | entry ENVVARNAME= disables the corresponding environment variable, |
| 545 | which might have been set in the init files like ~/.profile. | 543 | which might have been set in the init files like ~/.profile. |
| 546 | 544 | ||
| 547 | Special handling is applied to the PATH environment, which should | 545 | Special handling is applied to some environment variables, |
| 548 | not be set here. Instead, it should be set via `tramp-remote-path'." | 546 | which should not be set here: |
| 547 | |||
| 548 | The PATH environment variable should be set via `tramp-remote-path'. | ||
| 549 | |||
| 550 | The TERM environment variable should be set via `tramp-terminal-type'. | ||
| 551 | |||
| 552 | The INSIDE_EMACS environment variable will automatically be set | ||
| 553 | based on the TRAMP and Emacs versions, and should not be set here." | ||
| 549 | :group 'tramp | 554 | :group 'tramp |
| 550 | :version "26.1" | 555 | :version "26.1" |
| 551 | :type '(repeat string) | 556 | :type '(repeat string) |
| @@ -3948,9 +3953,17 @@ file exists and nonzero exit status otherwise." | |||
| 3948 | ;; file clobbering $PS1. $PROMPT_COMMAND is another way to set | 3953 | ;; file clobbering $PS1. $PROMPT_COMMAND is another way to set |
| 3949 | ;; the prompt in /bin/bash, it must be discarded as well. | 3954 | ;; the prompt in /bin/bash, it must be discarded as well. |
| 3950 | ;; $HISTFILE is set according to `tramp-histfile-override'. | 3955 | ;; $HISTFILE is set according to `tramp-histfile-override'. |
| 3956 | ;; $TERM and $INSIDE_EMACS set here to ensure they have the | ||
| 3957 | ;; correct values when the shell starts, not just processes | ||
| 3958 | ;; run within the shell. (Which processes include our | ||
| 3959 | ;; initial probes to ensure the remote shell is usable.) | ||
| 3951 | (tramp-send-command | 3960 | (tramp-send-command |
| 3952 | vec (format | 3961 | vec (format |
| 3953 | "exec env ENV=%s %s PROMPT_COMMAND='' PS1=%s PS2='' PS3='' %s %s" | 3962 | (concat |
| 3963 | "exec env TERM='%s' INSIDE_EMACS='%s,tramp:%s' " | ||
| 3964 | "ENV=%s %s PROMPT_COMMAND='' PS1=%s PS2='' PS3='' %s %s") | ||
| 3965 | tramp-terminal-type | ||
| 3966 | emacs-version tramp-version ; INSIDE_EMACS | ||
| 3954 | (or (getenv-internal "ENV" tramp-remote-process-environment) "") | 3967 | (or (getenv-internal "ENV" tramp-remote-process-environment) "") |
| 3955 | (if (stringp tramp-histfile-override) | 3968 | (if (stringp tramp-histfile-override) |
| 3956 | (format "HISTFILE=%s" | 3969 | (format "HISTFILE=%s" |
diff --git a/lisp/url/url-cookie.el b/lisp/url/url-cookie.el index 109d55ad39d..8045050c61e 100644 --- a/lisp/url/url-cookie.el +++ b/lisp/url/url-cookie.el | |||
| @@ -290,7 +290,7 @@ i.e. 1970-1-1) are loaded as expiring one year from now instead." | |||
| 290 | 290 | ||
| 291 | (defun url-cookie-handle-set-cookie (str) | 291 | (defun url-cookie-handle-set-cookie (str) |
| 292 | (setq url-cookies-changed-since-last-save t) | 292 | (setq url-cookies-changed-since-last-save t) |
| 293 | (let* ((args (url-parse-args str t)) | 293 | (let* ((args (nreverse (url-parse-args str t))) |
| 294 | (case-fold-search t) | 294 | (case-fold-search t) |
| 295 | (secure (and (assoc-string "secure" args t) t)) | 295 | (secure (and (assoc-string "secure" args t) t)) |
| 296 | (domain (or (cdr-safe (assoc-string "domain" args t)) | 296 | (domain (or (cdr-safe (assoc-string "domain" args t)) |
| @@ -298,44 +298,16 @@ i.e. 1970-1-1) are loaded as expiring one year from now instead." | |||
| 298 | (current-url (url-view-url t)) | 298 | (current-url (url-view-url t)) |
| 299 | (trusted url-cookie-trusted-urls) | 299 | (trusted url-cookie-trusted-urls) |
| 300 | (untrusted url-cookie-untrusted-urls) | 300 | (untrusted url-cookie-untrusted-urls) |
| 301 | (expires (cdr-safe (assoc-string "expires" args t))) | 301 | (max-age (cdr-safe (assoc-string "max-age" args t))) |
| 302 | (localpart (or (cdr-safe (assoc-string "path" args t)) | 302 | (localpart (or (cdr-safe (assoc-string "path" args t)) |
| 303 | (file-name-directory | 303 | (file-name-directory |
| 304 | (url-filename url-current-object)))) | 304 | (url-filename url-current-object)))) |
| 305 | (rest nil)) | 305 | (expires nil)) |
| 306 | (dolist (this args) | 306 | (if (and max-age (string-match "\\`-?[0-9]+\\'" max-age)) |
| 307 | (or (member (downcase (car this)) '("secure" "domain" "expires" "path")) | 307 | (setq expires (format-time-string "%a %b %d %H:%M:%S %Y GMT" |
| 308 | (setq rest (cons this rest)))) | 308 | (time-add nil (read max-age)) |
| 309 | 309 | t)) | |
| 310 | ;; Sometimes we get dates that the timezone package cannot handle very | 310 | (setq expires (cdr-safe (assoc-string "expires" args t)))) |
| 311 | ;; gracefully - take care of this here, instead of in url-cookie-expired-p | ||
| 312 | ;; to speed things up. | ||
| 313 | (and expires | ||
| 314 | (string-match | ||
| 315 | (concat "^[^,]+, +\\(..\\)-\\(...\\)-\\(..\\) +" | ||
| 316 | "\\(..:..:..\\) +\\[*\\([^]]+\\)\\]*$") | ||
| 317 | expires) | ||
| 318 | (setq expires (concat (match-string 1 expires) " " | ||
| 319 | (match-string 2 expires) " " | ||
| 320 | (match-string 3 expires) " " | ||
| 321 | (match-string 4 expires) " [" | ||
| 322 | (match-string 5 expires) "]"))) | ||
| 323 | |||
| 324 | ;; This one is for older Emacs/XEmacs variants that don't | ||
| 325 | ;; understand this format without tenths of a second in it. | ||
| 326 | ;; Wednesday, 30-Dec-2037 16:00:00 GMT | ||
| 327 | ;; - vs - | ||
| 328 | ;; Wednesday, 30-Dec-2037 16:00:00.00 GMT | ||
| 329 | (and expires | ||
| 330 | (string-match | ||
| 331 | "\\([0-9]+\\)-\\([A-Za-z]+\\)-\\([0-9]+\\)[ \t]+\\([0-9]+:[0-9]+:[0-9]+\\)\\(\\.[0-9]+\\)*[ \t]+\\([-+a-zA-Z0-9]+\\)" | ||
| 332 | expires) | ||
| 333 | (setq expires (concat (match-string 1 expires) "-" ; day | ||
| 334 | (match-string 2 expires) "-" ; month | ||
| 335 | (match-string 3 expires) " " ; year | ||
| 336 | (match-string 4 expires) ".00 " ; hour:minutes:seconds | ||
| 337 | (match-string 6 expires)))) ":" ; timezone | ||
| 338 | |||
| 339 | (while (consp trusted) | 311 | (while (consp trusted) |
| 340 | (if (string-match (car trusted) current-url) | 312 | (if (string-match (car trusted) current-url) |
| 341 | (setq trusted (- (match-end 0) (match-beginning 0))) | 313 | (setq trusted (- (match-end 0) (match-beginning 0))) |
| @@ -359,8 +331,9 @@ i.e. 1970-1-1) are loaded as expiring one year from now instead." | |||
| 359 | (not trusted) | 331 | (not trusted) |
| 360 | (save-window-excursion | 332 | (save-window-excursion |
| 361 | (with-output-to-temp-buffer "*Cookie Warning*" | 333 | (with-output-to-temp-buffer "*Cookie Warning*" |
| 362 | (dolist (x rest) | 334 | (princ (format "%s=\"%s\"\n" (caar args) (cdar args))) |
| 363 | (princ (format "%s - %s" (car x) (cdr x))))) | 335 | (dolist (x (cdr args)) |
| 336 | (princ (format " %s=\"%s\"\n" (car x) (cdr x))))) | ||
| 364 | (prog1 | 337 | (prog1 |
| 365 | (not (funcall url-confirmation-func | 338 | (not (funcall url-confirmation-func |
| 366 | (format "Allow %s to set these cookies? " | 339 | (format "Allow %s to set these cookies? " |
| @@ -371,8 +344,8 @@ i.e. 1970-1-1) are loaded as expiring one year from now instead." | |||
| 371 | nil) | 344 | nil) |
| 372 | ((url-cookie-host-can-set-p (url-host url-current-object) domain) | 345 | ((url-cookie-host-can-set-p (url-host url-current-object) domain) |
| 373 | ;; Cookie is accepted by the user, and passes our security checks. | 346 | ;; Cookie is accepted by the user, and passes our security checks. |
| 374 | (dolist (cur rest) | 347 | (url-cookie-store (caar args) (cdar args) |
| 375 | (url-cookie-store (car cur) (cdr cur) expires domain localpart secure))) | 348 | expires domain localpart secure)) |
| 376 | (t | 349 | (t |
| 377 | (url-lazy-message "%s tried to set a cookie for domain %s - rejected." | 350 | (url-lazy-message "%s tried to set a cookie for domain %s - rejected." |
| 378 | (url-host url-current-object) domain))))) | 351 | (url-host url-current-object) domain))))) |
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 7a7cf933fa3..68236daf49b 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el | |||
| @@ -2921,6 +2921,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 2921 | ;; Cleanup. | 2921 | ;; Cleanup. |
| 2922 | (ignore-errors (delete-file tmp-name)))))) | 2922 | (ignore-errors (delete-file tmp-name)))))) |
| 2923 | 2923 | ||
| 2924 | ;; This test is inspired by Bug#29149. | ||
| 2924 | (ert-deftest tramp-test24-file-acl () | 2925 | (ert-deftest tramp-test24-file-acl () |
| 2925 | "Check that `file-acl' and `set-file-acl' work proper." | 2926 | "Check that `file-acl' and `set-file-acl' work proper." |
| 2926 | (skip-unless (tramp--test-enabled)) | 2927 | (skip-unless (tramp--test-enabled)) |
| @@ -2939,7 +2940,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 2939 | (write-region "foo" nil tmp-name1) | 2940 | (write-region "foo" nil tmp-name1) |
| 2940 | (should (file-exists-p tmp-name1)) | 2941 | (should (file-exists-p tmp-name1)) |
| 2941 | (should (file-acl tmp-name1)) | 2942 | (should (file-acl tmp-name1)) |
| 2942 | (copy-file tmp-name1 tmp-name2) | 2943 | (copy-file tmp-name1 tmp-name2 nil nil nil 'preserve-permissions) |
| 2943 | (should (file-acl tmp-name2)) | 2944 | (should (file-acl tmp-name2)) |
| 2944 | (should (string-equal (file-acl tmp-name1) (file-acl tmp-name2))) | 2945 | (should (string-equal (file-acl tmp-name1) (file-acl tmp-name2))) |
| 2945 | ;; Different permissions mean different ACLs. | 2946 | ;; Different permissions mean different ACLs. |
| @@ -2965,7 +2966,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 2965 | (write-region "foo" nil tmp-name1) | 2966 | (write-region "foo" nil tmp-name1) |
| 2966 | (should (file-exists-p tmp-name1)) | 2967 | (should (file-exists-p tmp-name1)) |
| 2967 | (should (file-acl tmp-name1)) | 2968 | (should (file-acl tmp-name1)) |
| 2968 | (copy-file tmp-name1 tmp-name3) | 2969 | (copy-file tmp-name1 tmp-name3 nil nil nil 'preserve-permissions) |
| 2969 | (should (file-acl tmp-name3)) | 2970 | (should (file-acl tmp-name3)) |
| 2970 | (should (string-equal (file-acl tmp-name1) (file-acl tmp-name3))) | 2971 | (should (string-equal (file-acl tmp-name1) (file-acl tmp-name3))) |
| 2971 | ;; Different permissions mean different ACLs. | 2972 | ;; Different permissions mean different ACLs. |
| @@ -2979,7 +2980,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 2979 | 2980 | ||
| 2980 | ;; Two files with same ACLs. | 2981 | ;; Two files with same ACLs. |
| 2981 | (delete-file tmp-name1) | 2982 | (delete-file tmp-name1) |
| 2982 | (copy-file tmp-name3 tmp-name1) | 2983 | (copy-file tmp-name3 tmp-name1 nil nil nil 'preserve-permissions) |
| 2983 | (should (file-acl tmp-name1)) | 2984 | (should (file-acl tmp-name1)) |
| 2984 | (should (string-equal (file-acl tmp-name1) (file-acl tmp-name3))) | 2985 | (should (string-equal (file-acl tmp-name1) (file-acl tmp-name3))) |
| 2985 | ;; Different permissions mean different ACLs. | 2986 | ;; Different permissions mean different ACLs. |
| @@ -2995,8 +2996,6 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 2995 | (ignore-errors (delete-file tmp-name1)) | 2996 | (ignore-errors (delete-file tmp-name1)) |
| 2996 | (ignore-errors (delete-file tmp-name3)))))) | 2997 | (ignore-errors (delete-file tmp-name3)))))) |
| 2997 | 2998 | ||
| 2998 | ;; TODO: This test didn't run in reality yet. Pls report if it | ||
| 2999 | ;; doesn't work as expected. | ||
| 3000 | (ert-deftest tramp-test25-file-selinux () | 2999 | (ert-deftest tramp-test25-file-selinux () |
| 3001 | "Check `file-selinux-context' and `set-file-selinux-context'." | 3000 | "Check `file-selinux-context' and `set-file-selinux-context'." |
| 3002 | (skip-unless (tramp--test-enabled)) | 3001 | (skip-unless (tramp--test-enabled)) |
| @@ -3013,7 +3012,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 3013 | ;; Both files are remote. | 3012 | ;; Both files are remote. |
| 3014 | (unwind-protect | 3013 | (unwind-protect |
| 3015 | (progn | 3014 | (progn |
| 3016 | ;; Two files with same SELINUX context. | 3015 | ;; Two files with same SELinux context. |
| 3017 | (write-region "foo" nil tmp-name1) | 3016 | (write-region "foo" nil tmp-name1) |
| 3018 | (should (file-exists-p tmp-name1)) | 3017 | (should (file-exists-p tmp-name1)) |
| 3019 | (should (file-selinux-context tmp-name1)) | 3018 | (should (file-selinux-context tmp-name1)) |
| @@ -3023,14 +3022,18 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 3023 | (equal | 3022 | (equal |
| 3024 | (file-selinux-context tmp-name1) | 3023 | (file-selinux-context tmp-name1) |
| 3025 | (file-selinux-context tmp-name2))) | 3024 | (file-selinux-context tmp-name2))) |
| 3026 | ;; Different permissions mean different SELINUX context. | 3025 | ;; Check different SELinux context. We cannot support |
| 3027 | (set-file-modes tmp-name1 #o777) | 3026 | ;; different ranges in this test; let's assume the most |
| 3028 | (set-file-modes tmp-name2 #o444) | 3027 | ;; likely one. |
| 3029 | (should-not | 3028 | (let ((context (file-selinux-context tmp-name1))) |
| 3030 | (equal | 3029 | (when (and (string-equal (nth 3 context) "s0") |
| 3031 | (file-selinux-context tmp-name1) | 3030 | (setcar (nthcdr 3 context) "s0:c0") |
| 3032 | (file-selinux-context tmp-name2))) | 3031 | (set-file-selinux-context tmp-name1 context)) |
| 3033 | ;; Copy SELINUX context. | 3032 | (should-not |
| 3033 | (equal | ||
| 3034 | (file-selinux-context tmp-name1) | ||
| 3035 | (file-selinux-context tmp-name2))))) | ||
| 3036 | ;; Copy SELinux context. | ||
| 3034 | (should | 3037 | (should |
| 3035 | (set-file-selinux-context | 3038 | (set-file-selinux-context |
| 3036 | tmp-name2 (file-selinux-context tmp-name1))) | 3039 | tmp-name2 (file-selinux-context tmp-name1))) |
| @@ -3038,7 +3041,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 3038 | (equal | 3041 | (equal |
| 3039 | (file-selinux-context tmp-name1) | 3042 | (file-selinux-context tmp-name1) |
| 3040 | (file-selinux-context tmp-name2))) | 3043 | (file-selinux-context tmp-name2))) |
| 3041 | ;; An invalid SELINUX context does not harm. | 3044 | ;; An invalid SELinux context does not harm. |
| 3042 | (should-not (set-file-selinux-context tmp-name2 "foo"))) | 3045 | (should-not (set-file-selinux-context tmp-name2 "foo"))) |
| 3043 | 3046 | ||
| 3044 | ;; Cleanup. | 3047 | ;; Cleanup. |
| @@ -3047,52 +3050,83 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 3047 | 3050 | ||
| 3048 | ;; Remote and local file. | 3051 | ;; Remote and local file. |
| 3049 | (unwind-protect | 3052 | (unwind-protect |
| 3050 | (when (not (or (equal (file-selinux-context temporary-file-directory) | 3053 | (when (and (not |
| 3051 | '(nil nil nil nil)) | 3054 | (or (equal (file-selinux-context temporary-file-directory) |
| 3052 | (tramp--test-windows-nt-or-smb-p))) | 3055 | '(nil nil nil nil)) |
| 3053 | ;; Two files with same SELINUX context. | 3056 | (tramp--test-windows-nt-or-smb-p))) |
| 3057 | ;; Both users shall use the same SELinux context. | ||
| 3058 | (string-equal | ||
| 3059 | (let ((default-directory temporary-file-directory)) | ||
| 3060 | (shell-command-to-string "id -Z")) | ||
| 3061 | (let ((default-directory | ||
| 3062 | tramp-test-temporary-file-directory)) | ||
| 3063 | (shell-command-to-string "id -Z")))) | ||
| 3064 | |||
| 3065 | ;; Two files with same SELinux context. | ||
| 3054 | (write-region "foo" nil tmp-name1) | 3066 | (write-region "foo" nil tmp-name1) |
| 3055 | (should (file-exists-p tmp-name1)) | 3067 | (should (file-exists-p tmp-name1)) |
| 3056 | (should (file-selinux-context tmp-name1)) | 3068 | (should (file-selinux-context tmp-name1)) |
| 3057 | (copy-file tmp-name1 tmp-name3) | 3069 | (copy-file tmp-name1 tmp-name3) |
| 3058 | (should (file-selinux-context tmp-name3)) | 3070 | (should (file-selinux-context tmp-name3)) |
| 3071 | ;; We cannot expect that copying over file system | ||
| 3072 | ;; boundaries keeps SELinux context. So we copy it | ||
| 3073 | ;; explicitely. | ||
| 3074 | (should | ||
| 3075 | (set-file-selinux-context | ||
| 3076 | tmp-name3 (file-selinux-context tmp-name1))) | ||
| 3059 | (should | 3077 | (should |
| 3060 | (equal | 3078 | (equal |
| 3061 | (file-selinux-context tmp-name1) | 3079 | (file-selinux-context tmp-name1) |
| 3062 | (file-selinux-context tmp-name3))) | 3080 | (file-selinux-context tmp-name3))) |
| 3063 | ;; Different permissions mean different SELINUX context. | 3081 | ;; Check different SELinux context. We cannot support |
| 3064 | (set-file-modes tmp-name1 #o777) | 3082 | ;; different ranges in this test; let's assume the most |
| 3065 | (set-file-modes tmp-name3 #o444) | 3083 | ;; likely one. |
| 3066 | (should-not | 3084 | (let ((context (file-selinux-context tmp-name1))) |
| 3067 | (equal | 3085 | (when (and (string-equal (nth 3 context) "s0") |
| 3068 | (file-selinux-context tmp-name1) | 3086 | (setcar (nthcdr 3 context) "s0:c0") |
| 3069 | (file-selinux-context tmp-name3))) | 3087 | (set-file-selinux-context tmp-name1 context)) |
| 3070 | ;; Copy SELINUX context. | 3088 | (should-not |
| 3071 | (set-file-selinux-context | 3089 | (equal |
| 3072 | tmp-name3 (file-selinux-context tmp-name1)) | 3090 | (file-selinux-context tmp-name1) |
| 3091 | (file-selinux-context tmp-name3))))) | ||
| 3092 | ;; Copy SELinux context. | ||
| 3093 | (should | ||
| 3094 | (set-file-selinux-context | ||
| 3095 | tmp-name3 (file-selinux-context tmp-name1))) | ||
| 3073 | (should | 3096 | (should |
| 3074 | (equal | 3097 | (equal |
| 3075 | (file-selinux-context tmp-name1) | 3098 | (file-selinux-context tmp-name1) |
| 3076 | (file-selinux-context tmp-name3))) | 3099 | (file-selinux-context tmp-name3))) |
| 3077 | 3100 | ||
| 3078 | ;; Two files with same SELINUX context. | 3101 | ;; Two files with same SELinux context. |
| 3079 | (delete-file tmp-name1) | 3102 | (delete-file tmp-name1) |
| 3080 | (copy-file tmp-name3 tmp-name1) | 3103 | (copy-file tmp-name3 tmp-name1) |
| 3081 | (should (file-selinux-context tmp-name1)) | 3104 | (should (file-selinux-context tmp-name1)) |
| 3105 | ;; We cannot expect that copying over file system | ||
| 3106 | ;; boundaries keeps SELinux context. So we copy it | ||
| 3107 | ;; explicitely. | ||
| 3108 | (should | ||
| 3109 | (set-file-selinux-context | ||
| 3110 | tmp-name1 (file-selinux-context tmp-name3))) | ||
| 3082 | (should | 3111 | (should |
| 3083 | (equal | 3112 | (equal |
| 3084 | (file-selinux-context tmp-name1) | 3113 | (file-selinux-context tmp-name1) |
| 3085 | (file-selinux-context tmp-name3))) | 3114 | (file-selinux-context tmp-name3))) |
| 3086 | ;; Different permissions mean different SELINUX context. | 3115 | ;; Check different SELinux context. We cannot support |
| 3087 | (set-file-modes tmp-name1 #o777) | 3116 | ;; different ranges in this test; let's assume the most |
| 3088 | (set-file-modes tmp-name3 #o444) | 3117 | ;; likely one. |
| 3089 | (should-not | 3118 | (let ((context (file-selinux-context tmp-name3))) |
| 3090 | (equal | 3119 | (when (and (string-equal (nth 3 context) "s0") |
| 3091 | (file-selinux-context tmp-name1) | 3120 | (setcar (nthcdr 3 context) "s0:c0") |
| 3092 | (file-selinux-context tmp-name3))) | 3121 | (set-file-selinux-context tmp-name3 context)) |
| 3093 | ;; Copy SELINUX context. | 3122 | (should-not |
| 3094 | (set-file-selinux-context | 3123 | (equal |
| 3095 | tmp-name1 (file-selinux-context tmp-name2)) | 3124 | (file-selinux-context tmp-name1) |
| 3125 | (file-selinux-context tmp-name3))))) | ||
| 3126 | ;; Copy SELinux context. | ||
| 3127 | (should | ||
| 3128 | (set-file-selinux-context | ||
| 3129 | tmp-name1 (file-selinux-context tmp-name3))) | ||
| 3096 | (should | 3130 | (should |
| 3097 | (equal | 3131 | (equal |
| 3098 | (file-selinux-context tmp-name1) | 3132 | (file-selinux-context tmp-name1) |
| @@ -3619,7 +3653,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 3619 | (fboundp 'connection-local-set-profiles))) | 3653 | (fboundp 'connection-local-set-profiles))) |
| 3620 | 3654 | ||
| 3621 | ;; `connection-local-set-profile-variables' and | 3655 | ;; `connection-local-set-profile-variables' and |
| 3622 | ;; `connection-local-set-profiles' exist since Emacs 26. We don't | 3656 | ;; `connection-local-set-profiles' exist since Emacs 26.1. We don't |
| 3623 | ;; want to see compiler warnings for older Emacsen. | 3657 | ;; want to see compiler warnings for older Emacsen. |
| 3624 | (let ((default-directory tramp-test-temporary-file-directory) | 3658 | (let ((default-directory tramp-test-temporary-file-directory) |
| 3625 | explicit-shell-file-name kill-buffer-query-functions) | 3659 | explicit-shell-file-name kill-buffer-query-functions) |
| @@ -3923,8 +3957,8 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 3923 | (and (fboundp 'make-nearby-temp-file) (fboundp 'temporary-file-directory))) | 3957 | (and (fboundp 'make-nearby-temp-file) (fboundp 'temporary-file-directory))) |
| 3924 | 3958 | ||
| 3925 | ;; `make-nearby-temp-file' and `temporary-file-directory' exists | 3959 | ;; `make-nearby-temp-file' and `temporary-file-directory' exists |
| 3926 | ;; since Emacs 26. We don't want to see compiler warnings for older | 3960 | ;; since Emacs 26.1. We don't want to see compiler warnings for |
| 3927 | ;; Emacsen. | 3961 | ;; older Emacsen. |
| 3928 | (let ((default-directory tramp-test-temporary-file-directory) | 3962 | (let ((default-directory tramp-test-temporary-file-directory) |
| 3929 | tmp-file) | 3963 | tmp-file) |
| 3930 | ;; The remote host shall know a temporary file directory. | 3964 | ;; The remote host shall know a temporary file directory. |
| @@ -4622,7 +4656,8 @@ process sentinels. They shall not disturb each other." | |||
| 4622 | (message \"Tramp loaded: %%s\" (featurep 'tramp)) \ | 4656 | (message \"Tramp loaded: %%s\" (featurep 'tramp)) \ |
| 4623 | (file-name-all-completions \"/foo:\" \"/\") \ | 4657 | (file-name-all-completions \"/foo:\" \"/\") \ |
| 4624 | (message \"Tramp loaded: %%s\" (featurep 'tramp)))")) | 4658 | (message \"Tramp loaded: %%s\" (featurep 'tramp)))")) |
| 4625 | (dolist (tm '(t nil)) | 4659 | ;; Tramp doesn't load when `tramp-mode' is nil since Emacs 26.1. |
| 4660 | (dolist (tm (if (tramp--test-emacs26-p) '(t nil) '(nil))) | ||
| 4626 | (should | 4661 | (should |
| 4627 | (string-match | 4662 | (string-match |
| 4628 | (format | 4663 | (format |