diff options
| author | Michael Albinus | 2020-12-17 18:52:23 +0100 |
|---|---|---|
| committer | Michael Albinus | 2020-12-17 18:52:23 +0100 |
| commit | ddff5d3d879d23f0684b8abe7d923fce4f86ec2e (patch) | |
| tree | 26369adf33fb81537e14d86a4d259436e855feae | |
| parent | d428cc1b927ae1bf8240ed30b37c9418e819381d (diff) | |
| download | emacs-ddff5d3d879d23f0684b8abe7d923fce4f86ec2e.tar.gz emacs-ddff5d3d879d23f0684b8abe7d923fce4f86ec2e.zip | |
Some minor Tramp changes
* doc/lispref/os.texi (Timers): Speak about `remote-file-error'.
* doc/misc/tramp.texi (Frequently Asked Questions): Speak about
`remote-file-error'.
(External packages): New subsection "Timers".
* lisp/net/tramp-adb.el (tramp-adb-handle-make-process):
* lisp/net/tramp-sh.el (tramp-sh-handle-make-process): Adapt error
function. Handle coding.
* lisp/net/tramp.el (tramp-handle-make-process): Adapt error function.
| -rw-r--r-- | doc/lispref/os.texi | 13 | ||||
| -rw-r--r-- | doc/misc/tramp.texi | 52 | ||||
| -rw-r--r-- | lisp/net/tramp-adb.el | 8 | ||||
| -rw-r--r-- | lisp/net/tramp-sh.el | 13 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 2 |
5 files changed, 76 insertions, 12 deletions
diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi index bc602205f5d..85f930d1897 100644 --- a/doc/lispref/os.texi +++ b/doc/lispref/os.texi | |||
| @@ -2106,6 +2106,19 @@ run while waiting. If a timer function needs to perform an action | |||
| 2106 | after a certain time has elapsed, it can do this by scheduling a new | 2106 | after a certain time has elapsed, it can do this by scheduling a new |
| 2107 | timer. | 2107 | timer. |
| 2108 | 2108 | ||
| 2109 | If a timer function performs a remote file operation, it can be in | ||
| 2110 | conflict with an already running remote file operation of the same | ||
| 2111 | connection. Such conflicts are detected, and they result in a | ||
| 2112 | @code{remote-file-error} error (@pxref{Standard Errors}). This should | ||
| 2113 | be protected by wrapping the timer function body with | ||
| 2114 | |||
| 2115 | @lisp | ||
| 2116 | @group | ||
| 2117 | (ignore-error 'remote-file-error | ||
| 2118 | @dots{}) | ||
| 2119 | @end group | ||
| 2120 | @end lisp | ||
| 2121 | |||
| 2109 | If a timer function calls functions that can change the match data, | 2122 | If a timer function calls functions that can change the match data, |
| 2110 | it should save and restore the match data. @xref{Saving Match Data}. | 2123 | it should save and restore the match data. @xref{Saving Match Data}. |
| 2111 | 2124 | ||
diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index 59b8bdbdf37..0557ca54695 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi | |||
| @@ -2508,7 +2508,7 @@ whatever shell is installed on the device with this setting: | |||
| 2508 | @lisp | 2508 | @lisp |
| 2509 | @group | 2509 | @group |
| 2510 | (add-to-list 'tramp-connection-properties | 2510 | (add-to-list 'tramp-connection-properties |
| 2511 | (list (regexp-quote "192.168.0.26") "remote-shell" "sh")) | 2511 | (list (regexp-quote "192.168.0.26") "remote-shell" "sh")) |
| 2512 | @end group | 2512 | @end group |
| 2513 | @end lisp | 2513 | @end lisp |
| 2514 | 2514 | ||
| @@ -2560,7 +2560,7 @@ the previous example, fix the connection properties as follows: | |||
| 2560 | @lisp | 2560 | @lisp |
| 2561 | @group | 2561 | @group |
| 2562 | (add-to-list 'tramp-connection-properties | 2562 | (add-to-list 'tramp-connection-properties |
| 2563 | (list (regexp-quote "android") "remote-shell" "sh")) | 2563 | (list (regexp-quote "android") "remote-shell" "sh")) |
| 2564 | @end group | 2564 | @end group |
| 2565 | @end lisp | 2565 | @end lisp |
| 2566 | 2566 | ||
| @@ -4341,9 +4341,9 @@ configure @file{~/.ssh/config} on the proxy host: | |||
| 4341 | @example | 4341 | @example |
| 4342 | @group | 4342 | @group |
| 4343 | Host * | 4343 | Host * |
| 4344 | ControlMaster auto | 4344 | ControlMaster auto |
| 4345 | ControlPath tramp.%C | 4345 | ControlPath tramp.%C |
| 4346 | ControlPersist no | 4346 | ControlPersist no |
| 4347 | @end group | 4347 | @end group |
| 4348 | @end example | 4348 | @end example |
| 4349 | 4349 | ||
| @@ -4878,6 +4878,25 @@ In case you have installed it from its Git repository, @ref{Recompilation}. | |||
| 4878 | 4878 | ||
| 4879 | 4879 | ||
| 4880 | @item | 4880 | @item |
| 4881 | I get an error @samp{Remote file error: Forbidden reentrant call of Tramp} | ||
| 4882 | |||
| 4883 | Timers, process filters and sentinels, and other event based functions | ||
| 4884 | can run at any time, when a remote file operation is still running. | ||
| 4885 | This can cause @value{tramp} to block. When such a situation is | ||
| 4886 | detected, this error is triggered. It shall be fixed in the | ||
| 4887 | respective function (an error report will help), but for the time | ||
| 4888 | being you can suppress this error by the following code in your | ||
| 4889 | @file{~/.emacs}: | ||
| 4890 | |||
| 4891 | @lisp | ||
| 4892 | @group | ||
| 4893 | (setq debug-ignored-errors | ||
| 4894 | (cons 'remote-file-error debug-ignored-errors)) | ||
| 4895 | @end group | ||
| 4896 | @end lisp | ||
| 4897 | |||
| 4898 | |||
| 4899 | @item | ||
| 4881 | How to disable other packages from calling @value{tramp}? | 4900 | How to disable other packages from calling @value{tramp}? |
| 4882 | 4901 | ||
| 4883 | There are packages that call @value{tramp} without the user ever | 4902 | There are packages that call @value{tramp} without the user ever |
| @@ -4982,7 +5001,7 @@ handlers. | |||
| 4982 | 5001 | ||
| 4983 | @node External packages | 5002 | @node External packages |
| 4984 | @section Integrating with external Lisp packages | 5003 | @section Integrating with external Lisp packages |
| 4985 | @subsection File name completion. | 5004 | @subsection File name completion |
| 4986 | 5005 | ||
| 4987 | @vindex non-essential | 5006 | @vindex non-essential |
| 4988 | Sometimes, it is not convenient to open a new connection to a remote | 5007 | Sometimes, it is not convenient to open a new connection to a remote |
| @@ -5000,7 +5019,7 @@ bind it to non-@code{nil} value. | |||
| 5000 | @end lisp | 5019 | @end lisp |
| 5001 | 5020 | ||
| 5002 | 5021 | ||
| 5003 | @subsection File attributes cache. | 5022 | @subsection File attributes cache |
| 5004 | 5023 | ||
| 5005 | Keeping a local cache of remote file attributes in sync with the | 5024 | Keeping a local cache of remote file attributes in sync with the |
| 5006 | remote host is a time-consuming operation. Flushing and re-querying | 5025 | remote host is a time-consuming operation. Flushing and re-querying |
| @@ -5040,6 +5059,25 @@ root-directory, it is most likely sufficient to make the | |||
| 5040 | @code{default-directory} of the process buffer as the root directory. | 5059 | @code{default-directory} of the process buffer as the root directory. |
| 5041 | 5060 | ||
| 5042 | 5061 | ||
| 5062 | @subsection Timers | ||
| 5063 | |||
| 5064 | Timers run asynchronously at any time when Emacs is waiting for | ||
| 5065 | sending a string to a process, or waiting for process output. They | ||
| 5066 | can run any remote file operation, which would conflict with the | ||
| 5067 | already running remote file operation, if the same connection is | ||
| 5068 | affected. @value{tramp} detects this situation, and raises the | ||
| 5069 | @code{remote-file-error} error. A timer function shall avoid this | ||
| 5070 | situation. At least, it shall protect itself against this error, by | ||
| 5071 | wrapping the timer function body with | ||
| 5072 | |||
| 5073 | @lisp | ||
| 5074 | @group | ||
| 5075 | (ignore-error 'remote-file-error | ||
| 5076 | @dots{}) | ||
| 5077 | @end group | ||
| 5078 | @end lisp | ||
| 5079 | |||
| 5080 | |||
| 5043 | @node Traces and Profiles | 5081 | @node Traces and Profiles |
| 5044 | @chapter How to Customize Traces | 5082 | @chapter How to Customize Traces |
| 5045 | @vindex tramp-verbose | 5083 | @vindex tramp-verbose |
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index f6e89339b68..9ea72668e7b 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el | |||
| @@ -929,7 +929,7 @@ alternative implementation will be used." | |||
| 929 | (unless (or (null sentinel) (functionp sentinel)) | 929 | (unless (or (null sentinel) (functionp sentinel)) |
| 930 | (signal 'wrong-type-argument (list #'functionp sentinel))) | 930 | (signal 'wrong-type-argument (list #'functionp sentinel))) |
| 931 | (unless (or (null stderr) (bufferp stderr) (stringp stderr)) | 931 | (unless (or (null stderr) (bufferp stderr) (stringp stderr)) |
| 932 | (signal 'wrong-type-argument (list #'stringp stderr))) | 932 | (signal 'wrong-type-argument (list #'bufferp stderr))) |
| 933 | (when (and (stringp stderr) (tramp-tramp-file-p stderr) | 933 | (when (and (stringp stderr) (tramp-tramp-file-p stderr) |
| 934 | (not (tramp-equal-remote default-directory stderr))) | 934 | (not (tramp-equal-remote default-directory stderr))) |
| 935 | (signal 'file-error (list "Wrong stderr" stderr))) | 935 | (signal 'file-error (list "Wrong stderr" stderr))) |
| @@ -981,7 +981,11 @@ alternative implementation will be used." | |||
| 981 | ;; otherwise we might be interrupted by | 981 | ;; otherwise we might be interrupted by |
| 982 | ;; `verify-visited-file-modtime'. | 982 | ;; `verify-visited-file-modtime'. |
| 983 | (let ((buffer-undo-list t) | 983 | (let ((buffer-undo-list t) |
| 984 | (inhibit-read-only t)) | 984 | (inhibit-read-only t) |
| 985 | (coding-system-for-write | ||
| 986 | (if (symbolp coding) coding (car coding))) | ||
| 987 | (coding-system-for-read | ||
| 988 | (if (symbolp coding) coding (cdr coding)))) | ||
| 985 | (clear-visited-file-modtime) | 989 | (clear-visited-file-modtime) |
| 986 | (narrow-to-region (point-max) (point-max)) | 990 | (narrow-to-region (point-max) (point-max)) |
| 987 | ;; We call `tramp-adb-maybe-open-connection', | 991 | ;; We call `tramp-adb-maybe-open-connection', |
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index f4a93c840cf..e30fe61de43 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el | |||
| @@ -2871,7 +2871,7 @@ implementation will be used." | |||
| 2871 | (unless (or (null sentinel) (functionp sentinel)) | 2871 | (unless (or (null sentinel) (functionp sentinel)) |
| 2872 | (signal 'wrong-type-argument (list #'functionp sentinel))) | 2872 | (signal 'wrong-type-argument (list #'functionp sentinel))) |
| 2873 | (unless (or (null stderr) (bufferp stderr) (stringp stderr)) | 2873 | (unless (or (null stderr) (bufferp stderr) (stringp stderr)) |
| 2874 | (signal 'wrong-type-argument (list #'stringp stderr))) | 2874 | (signal 'wrong-type-argument (list #'bufferp stderr))) |
| 2875 | (when (and (stringp stderr) (tramp-tramp-file-p stderr) | 2875 | (when (and (stringp stderr) (tramp-tramp-file-p stderr) |
| 2876 | (not (tramp-equal-remote default-directory stderr))) | 2876 | (not (tramp-equal-remote default-directory stderr))) |
| 2877 | (signal 'file-error (list "Wrong stderr" stderr))) | 2877 | (signal 'file-error (list "Wrong stderr" stderr))) |
| @@ -2985,7 +2985,11 @@ implementation will be used." | |||
| 2985 | ;; `verify-visited-file-modtime'. | 2985 | ;; `verify-visited-file-modtime'. |
| 2986 | (let ((buffer-undo-list t) | 2986 | (let ((buffer-undo-list t) |
| 2987 | (inhibit-read-only t) | 2987 | (inhibit-read-only t) |
| 2988 | (mark (point-max))) | 2988 | (mark (point-max)) |
| 2989 | (coding-system-for-write | ||
| 2990 | (if (symbolp coding) coding (car coding))) | ||
| 2991 | (coding-system-for-read | ||
| 2992 | (if (symbolp coding) coding (cdr coding)))) | ||
| 2989 | (clear-visited-file-modtime) | 2993 | (clear-visited-file-modtime) |
| 2990 | (narrow-to-region (point-max) (point-max)) | 2994 | (narrow-to-region (point-max) (point-max)) |
| 2991 | ;; We call `tramp-maybe-open-connection', in | 2995 | ;; We call `tramp-maybe-open-connection', in |
| @@ -6139,4 +6143,9 @@ function cell is returned to be applied on a buffer." | |||
| 6139 | ;; | 6143 | ;; |
| 6140 | ;; * Implement `:stderr' of `make-process' as pipe process. | 6144 | ;; * Implement `:stderr' of `make-process' as pipe process. |
| 6141 | 6145 | ||
| 6146 | ;; * One interesting solution (with other applications as well) would | ||
| 6147 | ;; be to stipulate, as a directory or connection-local variable, an | ||
| 6148 | ;; additional rc file on the remote machine that is sourced every | ||
| 6149 | ;; time Tramp connects. <https://emacs.stackexchange.com/questions/62306> | ||
| 6150 | |||
| 6142 | ;;; tramp-sh.el ends here | 6151 | ;;; tramp-sh.el ends here |
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 70bf1eee26b..a4865ec4f22 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -3788,7 +3788,7 @@ It does not support `:stderr'." | |||
| 3788 | (unless (or (null sentinel) (functionp sentinel)) | 3788 | (unless (or (null sentinel) (functionp sentinel)) |
| 3789 | (signal 'wrong-type-argument (list #'functionp sentinel))) | 3789 | (signal 'wrong-type-argument (list #'functionp sentinel))) |
| 3790 | (unless (or (null stderr) (bufferp stderr)) | 3790 | (unless (or (null stderr) (bufferp stderr)) |
| 3791 | (signal 'wrong-type-argument (list #'stringp stderr))) | 3791 | (signal 'wrong-type-argument (list #'bufferp stderr))) |
| 3792 | 3792 | ||
| 3793 | (let* ((buffer | 3793 | (let* ((buffer |
| 3794 | (if buffer | 3794 | (if buffer |