GNU bug report logs - #26996
25.1; doc-view-revert-buffer doesn't detect file change while using tramp

Previous Next

Package: emacs;

Reported by: Iakov Davydov <dav02.davs <at> myths.ru>

Date: Fri, 19 May 2017 15:08:01 UTC

Severity: minor

Tags: fixed

Found in version 25.1

Fixed in version 27.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 26996 in the body.
You can then email your comments to 26996 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#26996; Package emacs. (Fri, 19 May 2017 15:08:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Iakov Davydov <dav02.davs <at> myths.ru>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 19 May 2017 15:08:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Iakov Davydov <dav02.davs <at> myths.ru>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.1;
 doc-view-revert-buffer doesn't detect file change while using tramp
Date: Fri, 19 May 2017 12:35:58 +0000
[Message part 1 (text/plain, inline)]
Hi,
I have problem with reverting buffer when opening pdf via tramp.
This happens in emacs 24 and emacs 25, with different version of tramp.

Steps to reproduce are like this:
1. Open pdf with tramp over ssh -> DocView mode.
2. Update the pdf somehow on the server.
3. Press 'g' to revert buffer (doc-view-revert-buffer) -> "yes".

If the pdf was updated, I expect to see an updated pdf. Instead I see an
old pdf.

On tramp-mailing list I was told that this is a bug in
doc-view-revert-buffer and therefore I have to report is as emacs bug.

Here's a response from Michael Albinus:
<===>
I've checked doc-view-revert-buffer. It works over
doc-view--buffer-file-name. So it doesn't detect a changed pdf, see its
docstring:

--8<---------------cut here---------------start------------->8---
doc-view--buffer-file-name is a variable defined in ‘doc-view.el’.
Its value is "/tmp/docview1000/123.pdf"
Local in buffer 123.pdf</ssh:host:>; global value is nil

Documentation:
Only used internally.
The file name used for conversion. Normally it’s the same as
‘buffer-file-name’, but for remote files, compressed files and
files inside an archive it is a temporary copy of
the (uncompressed, extracted) file residing in
‘doc-view-cache-directory’.
--8<---------------cut here---------------end--------------->8---

Nothing Tramp could do. I recommend to write an Emacs bug.
<===>

Is there a way to correct this behavior?

Thank you,
Iakov





In GNU Emacs 25.1.2 (x86_64-pc-linux-gnu, GTK+ Version 3.18.9)
of 2016-09-29 built on lcy01-19
Windowing system distributor 'The X.Org Foundation', version 11.0.11804000
System Description: Ubuntu 16.04.2 LTS

Configured using:
'configure --build=x86_64-linux-gnu --prefix=/usr
'--includedir=${prefix}/include' '--mandir=${prefix}/share/man'
'--infodir=${prefix}/share/info' --sysconfdir=/etc --localstatedir=/var
--disable-silent-rules '--libdir=${prefix}/lib/x86_64-linux-gnu'
'--libexecdir=${prefix}/lib/x86_64-linux-gnu' --disable-maintainer-mode
--disable-dependency-tracking --prefix=/usr --sharedstatedir=/var/lib
--program-suffix=25 --with-modules --with-x=yes --with-x-toolkit=gtk3
'CFLAGS=-g -O2 -fstack-protector-strong -Wformat
-Werror=format-security' 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2'
'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro''

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS
NOTIFY LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 MODULES

Important settings:
value of $LC_MONETARY: en_US.UTF-8
value of $LC_NUMERIC: en_US.UTF-8
value of $LC_TIME: en_US.UTF-8
value of $LANG: en_US.UTF-8
locale-coding-system: utf-8-unix

Major mode: DocView

Minor modes in effect:
helm-mode: t
shell-dirtrack-mode: t
async-bytecomp-package-mode: t
show-paren-mode: t
tooltip-mode: t
global-eldoc-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
buffer-read-only: t
line-number-mode: t
transient-mark-mode: t


Load-path shadows:
/usr/share/emacs/site-lisp/dictionaries-common/flyspell hides
/usr/share/emacs/25.1/lisp/textmodes/flyspell
/usr/share/emacs/site-lisp/dictionaries-common/ispell hides
/usr/share/emacs/25.1/lisp/textmodes/ispell
/usr/share/emacs/site-lisp/latex-cjk-thai/thai-word hides
/usr/share/emacs/25.1/lisp/language/thai-word

Features:
(shadow sort mail-extr emacsbug message rfc822 mml mml-sec epg mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
sendmail rfc2047 rfc2045 ietf-drums mail-utils helm-command helm-elisp
helm-eval edebug doc-view jka-compr image-mode imenu ido ess-toolbar
ess-mouse mouseme ess-swv ess-noweb ess-noweb-font-lock-mode ess-bugs-l
ess-sas-d ess-sas-l ess-sas-a ess-stata-mode ess-stata-lang cc-vars
cc-defs make-regexp essd-els ess-sp6-d ess-dde ess-sp3-d ess-julia
julia-mode ess-r-mode ess-r-package ess-r-syntax ess-r-completion subr-x
ess-roxy essddr ess-rd noutline outline hideshow ess-s-lang ess-help ess
ess-mode ess-noweb-mode ess-inf ess-tracebug ess-generics ess-custom
executable ess-compat ess-utils ess-site winner tramp-sh image-file
tramp-cache expand-region text-mode-expansions er-basic-expansions
expand-region-core expand-region-custom yasnippet multiple-cursors
mc-hide-unmatched-lines-mode mc-separate-operations
rectangular-region-mode mc-mark-pop mc-mark-more mc-cycle-cursors
mc-edit-lines multiple-cursors-core rect ace-jump-mode helm-mode
helm-files rx image-dired tramp tramp-compat tramp-loaddefs trampver
ucs-normalize shell pcomplete dired-x dired-aux ffap thingatpt
helm-buffers helm-tags helm-bookmark helm-adaptive helm-info bookmark pp
helm-locate helm-grep helm-regexp helm-external helm-net browse-url xml
url url-proxy url-privacy url-expand url-methods url-history url-cookie
url-domsuf url-util url-parse auth-source gnus-util mm-util help-fns
mail-prsvr password-cache url-vars mailcap helm-utils compile comint
ansi-color ring helm-help helm-types helm helm-source helm-multi-match
helm-lib dired helm-config helm-easymenu async-bytecomp async
gruvbox-theme autothemer dash poly-R poly-markdown poly-noweb easy-mmode
polymode poly-base polymode-weave polymode-export polymode-debug
polymode-methods poly-lock polymode-compat advice polymode-classes
eieio-compat polymode-core format-spec eieio-custom wid-edit eieio-base
cl-seq eieio eieio-core cl-macs color cl finder-inf 2048-game-autoloads
epc-autoloads ctable-autoloads python-environment-autoloads info package
epg-config seq byte-opt gv bytecomp byte-compile cl-extra help-mode
easymenu cconv edmacro kmacro cl-loaddefs pcase cl-lib paren whitespace
cyril-util time-date mule-util tooltip eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel x-win term/common-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment
elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan
thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian
slovak czech european ethiopic indian cyrillic chinese charscript
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote dbusbind inotify
dynamic-setting system-font-setting font-render-setting move-toolbar gtk
x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 435367 24144)
(symbols 48 40862 0)
(miscs 40 903 433)
(strings 32 91922 13447)
(string-bytes 1 2684221)
(vectors 16 62432)
(vector-slots 8 1113780 9034)
(floats 8 1231 262)
(intervals 56 600 171)
(buffers 976 35)
(heap 1024 66505 4276))
-- 
Iakov Davydov
Postdoc, Department of Ecology and Evolution, University of Lausanne
Swiss Institute of Bioinformatics
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26996; Package emacs. (Sun, 29 Sep 2019 13:00:02 GMT) Full text and rfc822 format available.

Message #8 received at 26996 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Iakov Davydov <dav02.davs <at> myths.ru>
Cc: 26996 <at> debbugs.gnu.org
Subject: Re: bug#26996: 25.1; doc-view-revert-buffer doesn't detect file
 change while using tramp
Date: Sun, 29 Sep 2019 14:59:05 +0200
Iakov Davydov <dav02.davs <at> myths.ru> writes:

> I have problem with reverting buffer when opening pdf via tramp. 
> This happens in emacs 24 and emacs 25, with different version of tramp. 
>
> Steps to reproduce are like this: 
> 1. Open pdf with tramp over ssh -> DocView mode. 
> 2. Update the pdf somehow on the server. 
> 3. Press 'g' to revert buffer (doc-view-revert-buffer) -> "yes". 
>
> If the pdf was updated, I expect to see an updated pdf. Instead I see an 
> old pdf. 

I managed to reproduce this in Emacs 27, and it should now be fixed.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 29 Sep 2019 13:00:03 GMT) Full text and rfc822 format available.

bug marked as fixed in version 27.1, send any further explanations to 26996 <at> debbugs.gnu.org and Iakov Davydov <dav02.davs <at> myths.ru> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 29 Sep 2019 13:00:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 28 Oct 2019 11:24:18 GMT) Full text and rfc822 format available.

bug unarchived. Request was from Stefan Monnier <monnier <at> iro.umontreal.ca> to control <at> debbugs.gnu.org. (Fri, 01 Nov 2019 20:23:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26996; Package emacs. (Fri, 01 Nov 2019 20:26:01 GMT) Full text and rfc822 format available.

Message #19 received at 26996 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Iakov Davydov <dav02.davs <at> myths.ru>, 26996 <at> debbugs.gnu.org
Subject: Re: bug#26996: 25.1; doc-view-revert-buffer doesn't detect file
 change while using tramp
Date: Fri, 01 Nov 2019 16:07:15 -0400
>> I have problem with reverting buffer when opening pdf via tramp. 
>> This happens in emacs 24 and emacs 25, with different version of tramp. 
>>
>> Steps to reproduce are like this: 
>> 1. Open pdf with tramp over ssh -> DocView mode. 
>> 2. Update the pdf somehow on the server. 
>> 3. Press 'g' to revert buffer (doc-view-revert-buffer) -> "yes". 
>>
>> If the pdf was updated, I expect to see an updated pdf. Instead I see an 
>> old pdf. 
>
> I managed to reproduce this in Emacs 27, and it should now be fixed.

Hmm... but now auto-revert loops forever:
updating the file -> triggers auto-revert -> your new code
saves the buffer to the file -> triggers auto-revert -> ...

I think the patch below is needed.

But I wonder why you added:

    (doc-view-make-safe-dir doc-view-cache-directory)

did it just seemed safer or have you found a concrete case that
needed it?


        Stefan


diff --git a/lisp/doc-view.el b/lisp/doc-view.el
index 5f9d4fcc2f..457e4325cf 100644
--- a/lisp/doc-view.el
+++ b/lisp/doc-view.el
@@ -457,9 +457,11 @@ doc-view--revert-buffer
                         (apply orig-fun args)
                         ;; Update the cached version of the pdf file,
                         ;; too.  This is the one that's used when
-                        ;; rendering.
-                        (doc-view-make-safe-dir doc-view-cache-directory)
-                        (write-region nil nil doc-view--buffer-file-name))))
+                        ;; rendering (bug#26996).
+                        (unless (equal buffer-file-name
+                                       doc-view--buffer-file-name)
+                          (doc-view-make-safe-dir doc-view-cache-directory)
+                          (write-region nil nil doc-view--buffer-file-name)))))
     (if (and (eq 'pdf doc-view-doc-type)
              (executable-find "pdfinfo"))
         ;; We don't want to revert if the PDF file is corrupted which






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26996; Package emacs. (Sat, 02 Nov 2019 14:57:02 GMT) Full text and rfc822 format available.

Message #22 received at 26996 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Iakov Davydov <dav02.davs <at> myths.ru>, 26996 <at> debbugs.gnu.org
Subject: Re: bug#26996: 25.1; doc-view-revert-buffer doesn't detect file
 change while using tramp
Date: Sat, 02 Nov 2019 15:56:21 +0100
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

> Hmm... but now auto-revert loops forever:
> updating the file -> triggers auto-revert -> your new code
> saves the buffer to the file -> triggers auto-revert -> ...
>
> I think the patch below is needed.

Sounds good; please

> But I wonder why you added:
>
>     (doc-view-make-safe-dir doc-view-cache-directory)
>
> did it just seemed safer or have you found a concrete case that
> needed it?

It been so long I barely remember.  I mean, the patch is more than a
month old.  :-)

Let's see...  Yes, I think I remember the directory having been removed
while I was playing with this stuff, so I had to make sure it existed
before writing to it.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26996; Package emacs. (Sat, 02 Nov 2019 14:59:02 GMT) Full text and rfc822 format available.

Message #25 received at 26996 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Iakov Davydov <dav02.davs <at> myths.ru>, 26996 <at> debbugs.gnu.org
Subject: Re: bug#26996: 25.1; doc-view-revert-buffer doesn't detect file
 change while using tramp
Date: Sat, 02 Nov 2019 15:58:44 +0100
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
>
>> Hmm... but now auto-revert loops forever:
>> updating the file -> triggers auto-revert -> your new code
>> saves the buffer to the file -> triggers auto-revert -> ...
>>
>> I think the patch below is needed.
>
> Sounds good; please

apply.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 01 Dec 2019 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 141 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.