844 |
:type 'regexp) |
:type 'regexp) |
845 |
|
|
846 |
(defcustom tramp-password-prompt-regexp |
(defcustom tramp-password-prompt-regexp |
847 |
"^.*\\([pP]assword\\|passphrase.*\\):\^@? *" |
"^.*\\([pP]assword\\|passphrase\\).*:\^@? *" |
848 |
"*Regexp matching password-like prompts. |
"*Regexp matching password-like prompts. |
849 |
The regexp should match at end of buffer. |
The regexp should match at end of buffer. |
850 |
|
|
1364 |
checked via the following code: |
checked via the following code: |
1365 |
|
|
1366 |
(with-temp-buffer |
(with-temp-buffer |
1367 |
(let ((bytes 1000) |
(let* ((user \"xxx\") (host \"yyy\") |
1368 |
(proc (start-process (buffer-name) (current-buffer) \"wc\" \"-c\"))) |
(init 0) (step 50) |
1369 |
(process-send-string proc (make-string bytes ?x)) |
(sent init) (received init)) |
1370 |
(process-send-eof proc) |
(while (= sent received) |
1371 |
(process-send-eof proc) |
(setq sent (+ sent step)) |
1372 |
(accept-process-output proc 1) |
(erase-buffer) |
1373 |
(goto-char (point-min)) |
(let ((proc (start-process (buffer-name) (current-buffer) |
1374 |
(re-search-forward \"\\\\w+\") |
\"ssh\" \"-l\" user host \"wc\" \"-c\"))) |
1375 |
(message \"Bytes sent: %s\\tBytes received: %s\" bytes (match-string 0)))) |
(when (memq (process-status proc) '(run open)) |
1376 |
|
(process-send-string proc (make-string sent ?\\ )) |
1377 |
In the Emacs normally running Tramp, evaluate the above code. |
(process-send-eof proc) |
1378 |
You can do this, for example, by pasting it into the `*scratch*' |
(process-send-eof proc)) |
1379 |
buffer and then hitting C-j with the cursor after the last |
(while (not (progn (goto-char (point-min)) |
1380 |
closing parenthesis. |
(re-search-forward \"\\\\w+\" (point-max) t))) |
1381 |
|
(accept-process-output proc 1)) |
1382 |
If your Emacs is buggy, the sent and received numbers will be |
(when (memq (process-status proc) '(run open)) |
1383 |
different. In that case, you'll want to set this variable to |
(setq received (string-to-number (match-string 0))) |
1384 |
some number. For those people who have needed it, the value 500 |
(delete-process proc) |
1385 |
seems to have worked well. There is no way to predict what value |
(message \"Bytes sent: %s\\tBytes received: %s\" sent received) |
1386 |
you need; maybe you could just experiment a bit. |
(sit-for 0)))) |
1387 |
|
(if (> sent (+ init step)) |
1388 |
|
(message \"You should set `tramp-chunksize' to a maximum of %s\" |
1389 |
|
(- sent step)) |
1390 |
|
(message \"Test does not work\") |
1391 |
|
(display-buffer (current-buffer)) |
1392 |
|
(sit-for 30)))) |
1393 |
|
|
1394 |
|
In the Emacs normally running Tramp, evaluate the above code |
1395 |
|
(replace \"xxx\" and \"yyy\" by the remote user and host name, |
1396 |
|
respectively). You can do this, for example, by pasting it into |
1397 |
|
the `*scratch*' buffer and then hitting C-j with the cursor after the |
1398 |
|
last closing parenthesis. Note that it works only if you have configured |
1399 |
|
\"ssh\" to run without password query, see ssh-agent(1). |
1400 |
|
|
1401 |
|
You will see the number of bytes sent successfully to the remote host. |
1402 |
|
If that number exceeds 1000, you can stop the execution by hitting |
1403 |
|
C-g, because your Emacs is likely clean. |
1404 |
|
|
1405 |
|
If your Emacs is buggy, the code stops and gives you an indication |
1406 |
|
about the value `tramp-chunksize' should be set. Maybe you could just |
1407 |
|
experiment a bit, e.g. changing the values of `init' and `step' |
1408 |
|
in the third line of the code. |
1409 |
|
|
1410 |
|
When it is necessary to set `tramp-chunksize', you might consider to |
1411 |
|
use an out-of-the-band method (like \"scp\") instead of an internal one |
1412 |
|
(like \"ssh\"), because setting `tramp-chunksize' to non-nil decreases |
1413 |
|
performance. |
1414 |
|
|
1415 |
Please raise a bug report via \"M-x tramp-bug\" if your system needs |
Please raise a bug report via \"M-x tramp-bug\" if your system needs |
1416 |
this variable to be set as well." |
this variable to be set as well." |
2398 |
(buffer-name))) |
(buffer-name))) |
2399 |
(if time-list |
(if time-list |
2400 |
(tramp-run-real-handler 'set-visited-file-modtime (list time-list)) |
(tramp-run-real-handler 'set-visited-file-modtime (list time-list)) |
2401 |
(let ((f (buffer-file-name))) |
(let ((f (buffer-file-name)) |
2402 |
|
coding-system-used) |
2403 |
(with-parsed-tramp-file-name f nil |
(with-parsed-tramp-file-name f nil |
2404 |
(let* ((attr (file-attributes f)) |
(let* ((attr (file-attributes f)) |
2405 |
;; '(-1 65535) means file doesn't exists yet. |
;; '(-1 65535) means file doesn't exists yet. |
2406 |
(modtime (or (nth 5 attr) '(-1 65535)))) |
(modtime (or (nth 5 attr) '(-1 65535)))) |
2407 |
|
(when (boundp 'last-coding-system-used) |
2408 |
|
(setq coding-system-used (symbol-value 'last-coding-system-used))) |
2409 |
;; We use '(0 0) as a don't-know value. See also |
;; We use '(0 0) as a don't-know value. See also |
2410 |
;; `tramp-handle-file-attributes-with-ls'. |
;; `tramp-handle-file-attributes-with-ls'. |
2411 |
(if (not (equal modtime '(0 0))) |
(if (not (equal modtime '(0 0))) |
2420 |
(setq attr (buffer-substring (point) |
(setq attr (buffer-substring (point) |
2421 |
(progn (end-of-line) (point))))) |
(progn (end-of-line) (point))))) |
2422 |
(setq tramp-buffer-file-attributes attr)) |
(setq tramp-buffer-file-attributes attr)) |
2423 |
|
(when (boundp 'last-coding-system-used) |
2424 |
|
(set 'last-coding-system-used coding-system-used)) |
2425 |
nil))))) |
nil))))) |
2426 |
|
|
2427 |
;; CCC continue here |
;; CCC continue here |
3782 |
'insert-file-contents) |
'insert-file-contents) |
3783 |
'file-local-copy))) |
'file-local-copy))) |
3784 |
(file-local-copy filename))) |
(file-local-copy filename))) |
3785 |
(result nil)) |
coding-system-used result) |
3786 |
(when visit |
(when visit |
3787 |
(setq buffer-file-name filename) |
(setq buffer-file-name filename) |
3788 |
(set-visited-file-modtime) |
(set-visited-file-modtime) |
3791 |
multi-method method user host |
multi-method method user host |
3792 |
9 "Inserting local temp file `%s'..." local-copy) |
9 "Inserting local temp file `%s'..." local-copy) |
3793 |
(setq result (insert-file-contents local-copy nil beg end replace)) |
(setq result (insert-file-contents local-copy nil beg end replace)) |
3794 |
|
;; Now `last-coding-system-used' has right value. Remember it. |
3795 |
|
(when (boundp 'last-coding-system-used) |
3796 |
|
(setq coding-system-used (symbol-value 'last-coding-system-used))) |
3797 |
(tramp-message-for-buffer |
(tramp-message-for-buffer |
3798 |
multi-method method user host |
multi-method method user host |
3799 |
9 "Inserting local temp file `%s'...done" local-copy) |
9 "Inserting local temp file `%s'...done" local-copy) |
3800 |
(delete-file local-copy) |
(delete-file local-copy) |
3801 |
|
(when (boundp 'last-coding-system-used) |
3802 |
|
(set 'last-coding-system-used coding-system-used)) |
3803 |
(list (expand-file-name filename) |
(list (expand-file-name filename) |
3804 |
(second result)))))) |
(second result)))))) |
3805 |
|
|
3913 |
(loc-dec (tramp-get-local-decoding multi-method method user host)) |
(loc-dec (tramp-get-local-decoding multi-method method user host)) |
3914 |
(trampbuf (get-buffer-create "*tramp output*")) |
(trampbuf (get-buffer-create "*tramp output*")) |
3915 |
(modes (file-modes filename)) |
(modes (file-modes filename)) |
3916 |
|
;; We use this to save the value of `last-coding-system-used' |
3917 |
|
;; after writing the tmp file. At the end of the function, |
3918 |
|
;; we set `last-coding-system-used' to this saved value. |
3919 |
|
;; This way, any intermediary coding systems used while |
3920 |
|
;; talking to the remote shell or suchlike won't hose this |
3921 |
|
;; variable. This approach was snarfed from ange-ftp.el. |
3922 |
|
coding-system-used |
3923 |
tmpfil) |
tmpfil) |
3924 |
;; Write region into a tmp file. This isn't really needed if we |
;; Write region into a tmp file. This isn't really needed if we |
3925 |
;; use an encoding function, but currently we use it always |
;; use an encoding function, but currently we use it always |
3936 |
(if confirm ; don't pass this arg unless defined for backward compat. |
(if confirm ; don't pass this arg unless defined for backward compat. |
3937 |
(list start end tmpfil append 'no-message lockname confirm) |
(list start end tmpfil append 'no-message lockname confirm) |
3938 |
(list start end tmpfil append 'no-message lockname))) |
(list start end tmpfil append 'no-message lockname))) |
3939 |
|
;; Now, `last-coding-system-used' has the right value. Remember it. |
3940 |
|
(when (boundp 'last-coding-system-used) |
3941 |
|
(setq coding-system-used (symbol-value 'last-coding-system-used))) |
3942 |
;; The permissions of the temporary file should be set. If |
;; The permissions of the temporary file should be set. If |
3943 |
;; filename does not exist (eq modes nil) it has been renamed to |
;; filename does not exist (eq modes nil) it has been renamed to |
3944 |
;; the backup file. This case `save-buffer' handles |
;; the backup file. This case `save-buffer' handles |
4045 |
;; We must pass modtime explicitely, because filename can be different |
;; We must pass modtime explicitely, because filename can be different |
4046 |
;; from (buffer-file-name), f.e. if `file-precious-flag' is set. |
;; from (buffer-file-name), f.e. if `file-precious-flag' is set. |
4047 |
(nth 5 (file-attributes filename)))) |
(nth 5 (file-attributes filename)))) |
4048 |
|
;; Make `last-coding-system-used' have the right value. |
4049 |
|
(when (boundp 'last-coding-system-used) |
4050 |
|
(set 'last-coding-system-used coding-system-used)) |
4051 |
(when (or (eq visit t) |
(when (or (eq visit t) |
4052 |
(eq visit nil) |
(eq visit nil) |
4053 |
(stringp visit)) |
(stringp visit)) |
7040 |
;; auto-saved file belonging to another original file. This could |
;; auto-saved file belonging to another original file. This could |
7041 |
;; be a security threat. |
;; be a security threat. |
7042 |
(set-file-modes buffer-auto-save-file-name |
(set-file-modes buffer-auto-save-file-name |
7043 |
(or (file-modes bfn) #o600))))) |
(or (file-modes bfn) (tramp-octal-to-decimal "0600")))))) |
7044 |
|
|
7045 |
(unless (or (> emacs-major-version 21) |
(unless (or (> emacs-major-version 21) |
7046 |
(and (featurep 'xemacs) |
(and (featurep 'xemacs) |