unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#26996: 25.1; doc-view-revert-buffer doesn't detect file change while using tramp
@ 2017-05-19 12:35 Iakov Davydov
  2019-09-29 12:59 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: Iakov Davydov @ 2017-05-19 12:35 UTC (permalink / raw)
  To: 26996

[-- Attachment #1: Type: text/plain, Size: 7269 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 8707 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#26996: 25.1; doc-view-revert-buffer doesn't detect file change while using tramp
  2017-05-19 12:35 bug#26996: 25.1; doc-view-revert-buffer doesn't detect file change while using tramp Iakov Davydov
@ 2019-09-29 12:59 ` Lars Ingebrigtsen
  2019-11-01 20:07   ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Lars Ingebrigtsen @ 2019-09-29 12:59 UTC (permalink / raw)
  To: Iakov Davydov; +Cc: 26996

Iakov Davydov <dav02.davs@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





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#26996: 25.1; doc-view-revert-buffer doesn't detect file change while using tramp
  2019-09-29 12:59 ` Lars Ingebrigtsen
@ 2019-11-01 20:07   ` Stefan Monnier
  2019-11-02 14:56     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2019-11-01 20:07 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Iakov Davydov, 26996

>> 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







^ permalink raw reply related	[flat|nested] 5+ messages in thread

* bug#26996: 25.1; doc-view-revert-buffer doesn't detect file change while using tramp
  2019-11-01 20:07   ` Stefan Monnier
@ 2019-11-02 14:56     ` Lars Ingebrigtsen
  2019-11-02 14:58       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: Lars Ingebrigtsen @ 2019-11-02 14:56 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Iakov Davydov, 26996

Stefan Monnier <monnier@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





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#26996: 25.1; doc-view-revert-buffer doesn't detect file change while using tramp
  2019-11-02 14:56     ` Lars Ingebrigtsen
@ 2019-11-02 14:58       ` Lars Ingebrigtsen
  0 siblings, 0 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2019-11-02 14:58 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Iakov Davydov, 26996

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Stefan Monnier <monnier@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





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-11-02 14:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-19 12:35 bug#26996: 25.1; doc-view-revert-buffer doesn't detect file change while using tramp Iakov Davydov
2019-09-29 12:59 ` Lars Ingebrigtsen
2019-11-01 20:07   ` Stefan Monnier
2019-11-02 14:56     ` Lars Ingebrigtsen
2019-11-02 14:58       ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).