Subject: bug#26996: 25.1; doc-view-revert-buffer doesn't detect file change while using tramp

From: Iakov Davydov <[email-masked]>
Date: Fri, 19 May 2017 12:35:58 +0000

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