Variable: tramp-chunksize
tramp-chunksize is a customizable variable defined in tramp.el.gz.
Value
nil
Documentation
If non-nil, chunksize for sending input to local process.
It is necessary only on systems which have a buggy process-send-string
implementation. The necessity, whether this variable must be set, can be
checked via the following code:
(with-temp-buffer
(let* ((user "xxx") (host "yyy")
(init 0) (step 50)
(sent init) (received init))
(while (= sent received)
(setq sent (+ sent step))
(erase-buffer)
(let ((proc (start-process (buffer-name) (current-buffer)
"ssh" "-l" user host "wc" "-c")))
(when (process-live-p proc)
(process-send-string proc (make-string sent ?\ ))
(process-send-eof proc)
(process-send-eof proc))
(while (not (progn (goto-char (point-min))
(search-forward-regexp "\\\\w+" (point-max) t)))
(accept-process-output proc 1))
(when (process-live-p proc)
(setq received (string-to-number (match-string 0)))
(delete-process proc)
(message "Bytes sent: %s\\tBytes received: %s" sent received)
(sit-for 0))))
(if (> sent (+ init step))
(message "You should set `tramp-chunksize' to a maximum of %s"
(- sent step))
(message "Test does not work")
(display-buffer (current-buffer))
(sit-for 30))))
In the Emacs normally running Tramp, evaluate the above code
(replace "xxx" and "yyy" by the remote user and host name,
respectively). You can do this, for example, by pasting it into
the *scratch* buffer and then hitting C-j with the cursor after the
last closing parenthesis. Note that it works only if you have configured
"ssh" to run without password query, see ssh-agent(1).
You will see the number of bytes sent successfully to the remote host.
If that number exceeds 1000, you can stop the execution by hitting
C-g, because your Emacs is likely clean.
When it is necessary to set tramp-chunksize, you might consider to
use an out-of-the-band method (like "scp") instead of an internal one
(like "ssh"), because setting tramp-chunksize to non-nil decreases
performance.
If your Emacs is buggy, the code stops and gives you an indication
about the value tramp-chunksize should be set. Maybe you could just
experiment a bit, e.g. changing the values of init and step
in the third line of the code.
Please raise a bug report via M-x tramp-bug (tramp-bug) if your system needs
this variable to be set as well.
Source Code
;; Defined in /usr/src/emacs/lisp/net/tramp.el.gz
;; Chunked sending kludge. We set this to 500 for black-listed constellations
;; known to have a bug in `process-send-string'; some ssh connections appear
;; to drop bytes when data is sent too quickly. There is also a connection
;; buffer local variable, which is computed depending on remote host properties
;; when `tramp-chunksize' is zero or nil.
(defcustom tramp-chunksize (when (memq system-type '(hpux)) 500)
;; Parentheses in docstring starting at beginning of line are escaped.
;; Fontification is messed up when
;; `open-paren-in-column-0-is-defun-start' set to t.
"If non-nil, chunksize for sending input to local process.
It is necessary only on systems which have a buggy `process-send-string'
implementation. The necessity, whether this variable must be set, can be
checked via the following code:
(with-temp-buffer
(let* ((user \"xxx\") (host \"yyy\")
(init 0) (step 50)
(sent init) (received init))
(while (= sent received)
(setq sent (+ sent step))
(erase-buffer)
(let ((proc (start-process (buffer-name) (current-buffer)
\"ssh\" \"-l\" user host \"wc\" \"-c\")))
(when (process-live-p proc)
(process-send-string proc (make-string sent ?\\ ))
(process-send-eof proc)
(process-send-eof proc))
(while (not (progn (goto-char (point-min))
(search-forward-regexp \"\\\\w+\" (point-max) t)))
(accept-process-output proc 1))
(when (process-live-p proc)
(setq received (string-to-number (match-string 0)))
(delete-process proc)
(message \"Bytes sent: %s\\tBytes received: %s\" sent received)
(sit-for 0))))
(if (> sent (+ init step))
(message \"You should set `tramp-chunksize' to a maximum of %s\"
(- sent step))
(message \"Test does not work\")
(display-buffer (current-buffer))
(sit-for 30))))
In the Emacs normally running Tramp, evaluate the above code
\(replace \"xxx\" and \"yyy\" by the remote user and host name,
respectively). You can do this, for example, by pasting it into
the `*scratch*' buffer and then hitting `C-j' with the cursor after the
last closing parenthesis. Note that it works only if you have configured
\"ssh\" to run without password query, see ssh-agent(1).
You will see the number of bytes sent successfully to the remote host.
If that number exceeds 1000, you can stop the execution by hitting
`C-g', because your Emacs is likely clean.
When it is necessary to set `tramp-chunksize', you might consider to
use an out-of-the-band method \(like \"scp\") instead of an internal one
\(like \"ssh\"), because setting `tramp-chunksize' to non-nil decreases
performance.
If your Emacs is buggy, the code stops and gives you an indication
about the value `tramp-chunksize' should be set. Maybe you could just
experiment a bit, e.g. changing the values of `init' and `step'
in the third line of the code.
Please raise a bug report via \\[tramp-bug] if your system needs
this variable to be set as well."
:type '(choice (const nil) integer)
:link '(tramp-info-link :tag "Tramp manual" tramp-chunksize))