From: Michael Albinus <michael.albinus@gmx.de>
To: Robert Marshall <robert.marshall@codethink.co.uk>
Cc: 26011@debbugs.gnu.org
Subject: bug#26011: 26.0.50; tramp should respect large-file-warning-threshold
Date: Tue, 07 Mar 2017 17:57:17 +0100 [thread overview]
Message-ID: <87y3whnhxu.fsf@detlef> (raw)
In-Reply-To: <87pohtuq0e.fsf@ctlt579.codethink.co.uk> (Robert Marshall's message of "Tue, 07 Mar 2017 14:21:05 +0000")
Robert Marshall <robert.marshall@codethink.co.uk> writes:
Hi Robert,
> If from dired you attempt to copy a file to a tramp ssh dired (I have
> dired-dwim-target set to t) and that file is very large, emacs will pause
> for some time and eventually stop with:
>
> tramp-file-name-handler: Memory exhausted--use C-x s then exit and
> restart Emacs
>
> If tramp is going to open the file and it is large I think it should
> warn the user (respecting large-file-warning-threshold?) rather than
> going ahead without confirmation and erroring with an alarming message!
Well, this happens in case Tramp inserts the file into a temporary
buffer. What about this patch:
--8<---------------cut here---------------start------------->8---
diff --git a/lisp/tramp-sh.el b/lisp/tramp-sh.el
index 071ef79..8561962 100644
--- a/lisp/tramp-sh.el
+++ b/lisp/tramp-sh.el
@@ -2147,6 +2147,11 @@ file names."
First arg OP is either `copy' or `rename' and indicates the operation.
FILENAME is the source file, NEWNAME the target file.
KEEP-DATE is non-nil if NEWNAME should have the same timestamp as FILENAME."
+ ;; Check, whether file is too large. Emacs checks in `insert-file-1'
+ ;; and `find-file-noselect', but that's not called here.
+ (abort-if-file-too-large
+ (tramp-compat-file-attribute-size (file-attributes (file-truename filename)))
+ (symbol-name op) filename)
;; We must disable multibyte, because binary data shall not be
;; converted. We don't want the target file to be compressed, so we
;; let-bind `jka-compr-inhibit' to t. `epa-file-handler' shall not
--8<---------------cut here---------------end--------------->8---
> Robert
Best regards, Michael.
next prev parent reply other threads:[~2017-03-07 16:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-07 14:21 bug#26011: 26.0.50; tramp should respect large-file-warning-threshold Robert Marshall
2017-03-07 16:57 ` Michael Albinus [this message]
2017-03-08 12:46 ` Robert Marshall
2017-03-08 16:38 ` Michael Albinus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y3whnhxu.fsf@detlef \
--to=michael.albinus@gmx.de \
--cc=26011@debbugs.gnu.org \
--cc=robert.marshall@codethink.co.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.