]> git.eshelyaron.com Git - emacs.git/commitdiff
Don't warn the user about large files if they are unreadable
authorLars Ingebrigtsen <larsi@gnus.org>
Sun, 15 Apr 2018 19:03:34 +0000 (21:03 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Sun, 15 Apr 2018 19:03:34 +0000 (21:03 +0200)
* lisp/files.el (abort-if-file-too-large): There's no point in
warning the user about a too-large file if we're not able to read
it (bug#29549).  Hopefully this doesn't introduce a race condition
between this test and the `file-readable-p' test later.

lisp/files.el

index 67a9abfa7640855bbef8e4ebf53daeb459ee1d85..d98d09bb1e31865f4ccf956189a55a99bd82852f 100644 (file)
@@ -2019,6 +2019,8 @@ think it does, because \"free\" is pretty hard to define in practice."
 OP-TYPE specifies the file operation being performed (for message to user)."
   (when (and large-file-warning-threshold size
             (> size large-file-warning-threshold)
+             ;; No point in warning if we can't read it.
+             (file-readable-p filename)
             (not (y-or-n-p (format "File %s is large (%s), really %s? "
                                    (file-name-nondirectory filename)
                                    (file-size-human-readable size) op-type))))