GNU bug report logs - #36090
26.1; Tramp hanging when writing version-controlled file

Previous Next

Package: emacs;

Reported by: Norman Gray <Norman.Gray <at> glasgow.ac.uk>

Date: Tue, 4 Jun 2019 14:23:01 UTC

Severity: normal

Tags: patch

Found in version 26.1

Fixed in version 27.1

Done: Michael Albinus <michael.albinus <at> gmx.de>

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 36090 in the body.
You can then email your comments to 36090 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#36090; Package emacs. (Tue, 04 Jun 2019 14:23:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Norman Gray <Norman.Gray <at> glasgow.ac.uk>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 04 Jun 2019 14:23:02 GMT) Full text and rfc822 format available.

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

From: Norman Gray <Norman.Gray <at> glasgow.ac.uk>
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: 26.1; Tramp hanging when writing version-controlled file
Date: Tue, 4 Jun 2019 13:12:15 +0000
Tramp consistently hangs, for me, when opening or writing a remote
version-controlled file. None of the ‘why is Tramp hanging...?’
resources I've found seem to address my situation.

It seems specific to version-controlled remote files (I use Mercurial; I
haven't tested with git or others).  I'm pretty sure, but can't
guarantee, that this (ie, emacs+tramp and these machines) used to work 
OK,
so it may be a regression in something.  I'm afraid I can't put my 
finger on
specific versions here.

I'm using:
   * emacs 26.1 (on macOS, from the Nix distribution)
   * tramp 2.4.2-pre (built from git
     https://git.savannah.gnu.org/git/tramp.git, commit
     5e9e79e2508f6f04107885a5fc0726391fe3c49f)
   * remote machines are FreeBSD 11.2 and CentOS 7.6 (same behaviour on 
each)
   * I doubt it's relevant, but the remote machines have mercurial 4.6
     and 2.6.2 respectively

I create a fresh repository on the remote machine:

     $ cd checkouts/itm
     $ mkdir test
     $ cd test
     $ hg init
     $ echo hello >hello.txt
     $ hg add
     $ hg ci -m"Initial version"
     $ echo second >second.txt

Then open /scp:helium:checkouts/itm/test/hello.txt (the remote machine
is called `helium` in this case):

     Tramp: Inserting 
‘/scp:helium:/home/norman/checkouts/itm/test/hello.txt’...
     Tramp: Encoding remote file 
‘/scp:helium:/home/norman/checkouts/itm/test/hello.txt’ with 
‘openssl enc -base64 <%s’...done
     Tramp: Decoding local file 
‘/var/folders/f5/vh0d0ls94_j5s4bv49sz90s40000gn/T/tramp.w8WmcP.txt’ 
with ‘base64-decode-region’...done
     Tramp: Inserting 
‘/scp:helium:/home/norman/checkouts/itm/test/hello.txt’...done

Then it hangs.  I `C-g`, and then get:

     Tramp: Checking ‘vc-registered’ for 
/scp:helium:/home/norman/checkouts/itm/test/hello.txt...done
     Tramp: Inserting 
‘/scp:helium:/home/norman/checkouts/itm/test/hello.txt’...done

I make a change to the file, and save it:

Saving file /scp:helium:/home/norman/checkouts/itm/test/hello.txt...

     Tramp: Checking ‘vc-registered’ for 
/scp:helium:/home/norman/checkouts/itm/test/hello.txt...
     Tramp: Opening connection for helium using scp...
     Tramp: Sending command ‘exec ssh   -o ControlMaster=auto -o 
ControlPath='tramp.%C' -o ControlPersist=no -e none helium’
     Tramp: Waiting for prompts from remote shell...done
     Tramp: Found remote shell prompt on ‘helium’
     Tramp: Opening connection for helium using scp...done
     Tramp: Checking ‘vc-registered’ for 
/scp:helium:/home/norman/checkouts/itm/test/hello.txt...done
     Saving file 
/scp:helium:/home/norman/checkouts/itm/test/hello.txt...
     Tramp: Encoding local file 
‘/var/folders/f5/vh0d0ls94_j5s4bv49sz90s40000gn/T/tramp.dMysF4.txt’ 
using ‘base64-encode-region’...done
     Tramp: Decoding remote file 
‘/scp:helium:/home/norman/checkouts/itm/test/hello.txt’ using 
‘openssl enc -d -base64 >%s’...done

It hangs again.  Again `C-g`, then:

     Wrote /scp:helium:/home/norman/checkouts/itm/test/hello.txt
     Quit

The file does save successfully.  Thus the hang/wait is happening after 
the
file has been saved to the remote machine's disk

If I create a non-version-controlled file `second.txt` beside this, and
try to open, then save, this file using Tramp, this works as expected.
That is, version-controlled hello.txt works; non-controlled second.txt 
doesn't.

The messages above and below are with tramp-verbose set to 3.  I don't
get anything significantly different that I can see, with tramp-verbose
set to 10.

The shell prompt in each case should be PS1='$ ', after the
recommended/obvious rc test of $TERM. I've set the $SHELL environment
variable to /bin/bash in the Emacs process (why not...?). I've confirmed
that I do indeed get a $ prompt, with no other junk (apart from the motd
contents, which don't count as ‘junk’), when I ssh to that machine 
with
a dumb terminal; and the debugging messages Found remote shell prompt do
seem to corroborate this.  I'm not seeing this prompt string echoed
anywhere in these messages, so can't be 100% sure I haven't messed up
something there, but I'm fairly confident that the prompt string is
non-special, and in any case if this were the problem it would affect
both hello.txt and second.txt.

I've configured connection sharing as occasionally recommended, but I do
understand that Tramp carefully ignores that (and I'm mentioning it only
to indicate that I've done my homework!).

I seem to have exhausted the suggested problems in the TrampMode section
of the Emacs wiki <https://www.emacswiki.org/emacs/TrampMode#toc7> and
the Tramp manual FAQ 
<https://www.gnu.org/software/tramp/#Frequently-Asked-Questions>.

I can see some discussion of what may be this problem from 2014
<https://lists.gnu.org/archive/html/bug-gnu-emacs/2014-10/msg01232.html>,
but that thread appears to suggest that the fix is already committed
(five years ago!). I tried (setq vc-handled-backends nil) in the hope
that this might turn off any Tramp cleverness in this area, but without
effect. The Tramp manual doesn't suggest that there is any particular
cleverness in this area, in any case.

The same happens when starting Emacs with option -Q.

I asked about this problem on stackexchange
<https://emacs.stackexchange.com/questions/50801/>.  There was a mention
in comments of a recent thread
<http://lists.gnu.org/archive/html/emacs-devel/2019-05/msg00010.html>
which would potentially be relevant, but building Tramp from the
repository, as here, would presumably have picked up the associated 
fixes.

Let me know if there's anything I can add.

Best wishes,

Norman







In GNU Emacs 26.1 (build 1, x86_64-apple-darwin17.7.0, NS appkit-1561.60 
Version 10.13.6 (Build 17G65))
  of 2019-03-01 built on nixoss-iMac.local
Windowing system distributor 'Apple', version 10.3.1671
Recent messages:
Tramp: Checking ‘vc-registered’ for 
/scp:helium:/usr/home/norman/checkouts/itm/test/second.txt...done
Tramp: Inserting 
‘/scp:helium:/home/norman/checkouts/itm/test/second.txt’...done
Saving file /scp:helium:/home/norman/checkouts/itm/test/second.txt...
Tramp: Encoding local file 
‘/var/folders/f5/vh0d0ls94_j5s4bv49sz90s40000gn/T/tramp.e6feJN.txt’ 
using ‘base64-encode-region’...done
Tramp: Decoding remote file 
‘/scp:helium:/home/norman/checkouts/itm/test/second.txt’ using 
‘openssl enc -d -base64 >%s’...done
Wrote /scp:helium:/home/norman/checkouts/itm/test/second.txt
Saving file /scp:helium:/home/norman/checkouts/itm/test/second.txt...
Tramp: Encoding local file 
‘/var/folders/f5/vh0d0ls94_j5s4bv49sz90s40000gn/T/tramp.fSrL8P.txt’ 
using ‘base64-encode-region’...done
Tramp: Decoding remote file 
‘/scp:helium:/home/norman/checkouts/itm/test/second.txt’ using 
‘openssl enc -d -base64 >%s’...done
Wrote /scp:helium:/home/norman/checkouts/itm/test/second.txt

Configured using:
  'configure
  --prefix=/nix/store/pyfdhlfcwpb6cvbbbjkp26hvp7rnkjkg-emacs-26.1
  --with-modules --with-ns --disable-ns-self-contained
  CFLAGS=-DMAC_OS_X_VERSION_MAX_ALLOWED=101200'

Configured features:
NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES THREADS

Important settings:
   value of $LC_COLLATE: POSIX
   value of $LC_TIME: en_GB.UTF-8
   value of $LANG: en_GB.UTF-8
   locale-coding-system: utf-8-unix

Major mode: Text

Minor modes in effect:
   shell-dirtrack-mode: t
   show-paren-mode: t
   global-hl-line-mode: t
   delete-selection-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
   line-number-mode: t
   auto-fill-function: do-auto-fill
   transient-mark-mode: t

Load-path shadows:
/Data/tools/tramp-git/share/emacs/site-lisp/tramp-smb hides 
/nix/store/pyfdhlfcwpb6cvbbbjkp26hvp7rnkjkg-emacs-26.1/share/emacs/26.1/lisp/net/tramp-smb
/Data/tools/tramp-git/share/emacs/site-lisp/tramp-uu hides 
/nix/store/pyfdhlfcwpb6cvbbbjkp26hvp7rnkjkg-emacs-26.1/share/emacs/26.1/lisp/net/tramp-uu
/Data/tools/tramp-git/share/emacs/site-lisp/tramp hides 
/nix/store/pyfdhlfcwpb6cvbbbjkp26hvp7rnkjkg-emacs-26.1/share/emacs/26.1/lisp/net/tramp
/Data/tools/tramp-git/share/emacs/site-lisp/tramp-adb hides 
/nix/store/pyfdhlfcwpb6cvbbbjkp26hvp7rnkjkg-emacs-26.1/share/emacs/26.1/lisp/net/tramp-adb
/Data/tools/tramp-git/share/emacs/site-lisp/tramp-sh hides 
/nix/store/pyfdhlfcwpb6cvbbbjkp26hvp7rnkjkg-emacs-26.1/share/emacs/26.1/lisp/net/tramp-sh
/Data/tools/tramp-git/share/emacs/site-lisp/trampver hides 
/nix/store/pyfdhlfcwpb6cvbbbjkp26hvp7rnkjkg-emacs-26.1/share/emacs/26.1/lisp/net/trampver
/Data/tools/tramp-git/share/emacs/site-lisp/tramp-cmds hides 
/nix/store/pyfdhlfcwpb6cvbbbjkp26hvp7rnkjkg-emacs-26.1/share/emacs/26.1/lisp/net/tramp-cmds
/Data/tools/tramp-git/share/emacs/site-lisp/tramp-cache hides 
/nix/store/pyfdhlfcwpb6cvbbbjkp26hvp7rnkjkg-emacs-26.1/share/emacs/26.1/lisp/net/tramp-cache
/Data/tools/tramp-git/share/emacs/site-lisp/tramp-compat hides 
/nix/store/pyfdhlfcwpb6cvbbbjkp26hvp7rnkjkg-emacs-26.1/share/emacs/26.1/lisp/net/tramp-compat
/Data/tools/tramp-git/share/emacs/site-lisp/tramp-ftp hides 
/nix/store/pyfdhlfcwpb6cvbbbjkp26hvp7rnkjkg-emacs-26.1/share/emacs/26.1/lisp/net/tramp-ftp
/Data/tools/tramp-git/share/emacs/site-lisp/tramp-loaddefs hides 
/nix/store/pyfdhlfcwpb6cvbbbjkp26hvp7rnkjkg-emacs-26.1/share/emacs/26.1/lisp/net/tramp-loaddefs

Features:
(shadow sort mail-extr emacsbug message rmc puny rfc822 mml mml-sec epa
epg gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mail-utils dired dired-loaddefs vc-dispatcher cc-mode
cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars
cc-defs find-func tramp-adb tramp-cache tramp-cmds tramp-ftp tramp-gvfs
zeroconf url-util dbus xml tramp-sh tramp tramp-loaddefs trampver
tramp-integration files-x tramp-compat shell pcomplete comint ansi-color
ring parse-time format-spec debug cl-extra pp cl-print thingatpt
help-fns radix-tree help-mode misearch multi-isearch vc-hg make-mode
elec-pair server paren point-stack hl-line derived mm-util mail-prsvr
ido delsel finder-inf package easymenu epg-config url-handlers url-parse
auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs
password-cache url-vars seq byte-opt gv bytecomp byte-compile cconv
cl-loaddefs cl-lib time-date tooltip eldoc electric uniquify ediff-hook
vc-hooks lisp-float-type mwheel term/ns-win ns-win ucs-normalize
mule-util term/common-win tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow isearch timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors 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 composite charscript charprop case-table epa-hook jka-cmpr-hook
help simple abbrev obarray 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 kqueue cocoa ns multi-tty make-network-process emacs)

Memory information:
((conses 16 274415 12408)
  (symbols 48 26899 1)
  (miscs 40 196 575)
  (strings 32 54260 1230)
  (string-bytes 1 1701753)
  (vectors 16 44910)
  (vector-slots 8 836892 16500)
  (floats 8 107 342)
  (intervals 56 738 0)
  (buffers 992 23))



Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36090; Package emacs. (Tue, 04 Jun 2019 16:38:01 GMT) Full text and rfc822 format available.

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

From: Norman Gray <Norman.Gray <at> glasgow.ac.uk>
To: "36090 <at> debbugs.gnu.org" <36090 <at> debbugs.gnu.org>
Subject: Update: A case where this isn't a problem
Date: Tue, 4 Jun 2019 16:10:53 +0000
Update:

Oddly, this appears not to be a problem if I use Tramp to open a file 
/scp:localhost#2222:path/to/file.txt -- this is a file on a VM (FreeBSD 
as it happens) running on localhost, and with the ssh port NATted to 
local port 2222.  In this case, file.txt can be either 
version-controlled or not.

Below, I've reverted to Tramp 2.4.1, which is the version of Tramp 
built-in to this emacs.

Relevant contents of the *Messages* buffer, with tramp-verbose set to 
10:

Tramp: Inserting 
‘/scp:localhost#2222:/home/norman/checkouts/itm/sso/misc/ldap-info-wrapper.c’...
Tramp: Encoding remote file 
‘/scp:localhost#2222:/home/norman/checkouts/itm/sso/misc/ldap-info-wrapper.c’ 
with ‘(env GZIP= gzip <%s | openssl enc -base64)’...done
Tramp: Decoding local file 
‘/var/folders/f5/vh0d0ls94_j5s4bv49sz90s40000gn/T/tramp.PQpLR4.c’ 
with ‘(lambda (beg end) (base64-decode-region beg end) (let 
((coding-system-for-write (quote binary)) (coding-system-for-read (quote 
binary))) (apply (quote tramp-call-process-region) (quote 
(tramp-file-name scp nil nil localhost 2222 
/home/norman/checkouts/itm/sso/misc/ldap-info-wrapper.c nil)) 
(point-min) (point-max) (car (split-string env GZIP= gzip -d)) t t nil 
(cdr (split-string env GZIP= gzip -d)))))’...done
Tramp: Inserting 
‘/scp:localhost#2222:/home/norman/checkouts/itm/sso/misc/ldap-info-wrapper.c’...done

Tramp: Checking ‘vc-registered’ for 
/scp:localhost#2222:/home/norman/checkouts/itm/sso/misc/ldap-info-wrapper.c...done
Tramp: Inserting 
‘/scp:localhost#2222:/home/norman/checkouts/itm/sso/misc/ldap-info-wrapper.c’...done


Just to confirm, for the other remote case, also with tramp-verbose set 
to 10...

Tramp: Opening connection for helium using scp...
Tramp: Sending command ‘exec ssh   -o ControlMaster=auto -o 
ControlPath='tramp.%C' -o ControlPersist=no -e none helium’
Tramp: Waiting for prompts from remote shell...done
Tramp: Found remote shell prompt on ‘helium’
Tramp: Opening connection for helium using scp...done
Tramp: Inserting 
‘/scp:helium:/home/norman/checkouts/itm/sso/misc/ldap-info-wrapper.c’...
Tramp: Encoding remote file 
‘/scp:helium:/home/norman/checkouts/itm/sso/misc/ldap-info-wrapper.c’ 
with ‘(env GZIP= gzip <%s | openssl enc -base64)’...done
Tramp: Decoding local file 
‘/var/folders/f5/vh0d0ls94_j5s4bv49sz90s40000gn/T/tramp.FZ1PVN.c’ 
with ‘(lambda (beg end) (base64-decode-region beg end) (let 
((coding-system-for-write (quote binary)) (coding-system-for-read (quote 
binary))) (apply (quote tramp-call-process-region) (quote 
(tramp-file-name scp nil nil helium nil 
/home/norman/checkouts/itm/sso/misc/ldap-info-wrapper.c nil)) 
(point-min) (point-max) (car (split-string env GZIP= gzip -d)) t t nil 
(cdr (split-string env GZIP= gzip -d)))))’...done
Tramp: Inserting 
‘/scp:helium:/home/norman/checkouts/itm/sso/misc/ldap-info-wrapper.c’...done

;;;; hang here, then C-g

Tramp: Checking ‘vc-registered’ for 
/scp:helium:/home/norman/checkouts/itm/sso/misc/ldap-info-wrapper.c...done
Tramp: Inserting 
‘/scp:helium:/home/norman/checkouts/itm/sso/misc/ldap-info-wrapper.c’...done

Tramp: Checking ‘vc-registered’ for 
/scp:helium:/usr/home/norman/checkouts/itm/sso/misc/ldap-info-wrapper.c...done
Tramp: Inserting 
‘/scp:helium:/home/norman/checkouts/itm/sso/misc/ldap-info-wrapper.c’...done
Quit


-- 
Norman Gray  :  https://nxg.me.uk
SUPA School of Physics and Astronomy, University of Glasgow, UK

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36090; Package emacs. (Wed, 05 Jun 2019 09:48:01 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Norman Gray <Norman.Gray <at> glasgow.ac.uk>
Cc: 36090 <at> debbugs.gnu.org
Subject: Re: bug#36090: 26.1;
 Tramp hanging when writing version-controlled file
Date: Wed, 05 Jun 2019 11:47:17 +0200
Norman Gray <Norman.Gray <at> glasgow.ac.uk> writes:

Hi Norman,

thanks for your comprehensive bug report!

>      $ cd checkouts/itm
>      $ mkdir test
>      $ cd test
>      $ hg init
>      $ echo hello >hello.txt
>      $ hg add
>      $ hg ci -m"Initial version"
>      $ echo second >second.txt

I have followed exactly your recipe on my Ubuntu 19.04 machine. It runs

--8<---------------cut here---------------start------------->8---
GNU Emacs 26.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.7)
 of 2019-04-11, modified by Debian
--8<---------------cut here---------------end--------------->8---

I have started "/usr/bin/emacs -Q", in order to avoid any interference.

> Then open /scp:helium:checkouts/itm/test/hello.txt (the remote machine
> is called `helium` in this case):
>
>      Tramp: Inserting
> ‘/scp:helium:/home/norman/checkouts/itm/test/hello.txt’...
>      Tramp: Encoding remote file
> ‘/scp:helium:/home/norman/checkouts/itm/test/hello.txt’ with
> ‘openssl enc -base64 <%s’...done
>      Tramp: Decoding local file
> ‘/var/folders/f5/vh0d0ls94_j5s4bv49sz90s40000gn/T/tramp.w8WmcP.txt’
> with ‘base64-decode-region’...done
>      Tramp: Inserting
> ‘/scp:helium:/home/norman/checkouts/itm/test/hello.txt’...done
>
> Then it hangs.  I `C-g`, and then get:
>
>      Tramp: Checking ‘vc-registered’ for
> /scp:helium:/home/norman/checkouts/itm/test/hello.txt...done
>      Tramp: Inserting
> ‘/scp:helium:/home/norman/checkouts/itm/test/hello.txt’...done

For me, it runs through:

--8<---------------cut here---------------start------------->8---
Tramp: Opening connection for localhost using scp...
Tramp: Sending command ‘exec ssh   -o ControlMaster=auto -o ControlPath='tramp.%C' -o ControlPersist=no -e none localhost’
Tramp: Waiting for prompts from remote shell...done
Tramp: Found remote shell prompt on ‘localhost’
Tramp: Opening connection for localhost using scp...done
Tramp: Inserting ‘/scp:localhost:/home/albinus/tmp/36090/hello.txt’...
Tramp: Encoding remote file ‘/scp:localhost:/home/albinus/tmp/36090/hello.txt’ with ‘base64 <%s’...done
Tramp: Decoding local file ‘/tmp/tramp.3Dk3y9.txt’ with ‘base64-decode-region’...done
Tramp: Inserting ‘/scp:localhost:/home/albinus/tmp/36090/hello.txt’...done

Tramp: Checking ‘vc-registered’ for /scp:localhost:/home/albinus/tmp/36090/hello.txt...done
Tramp: Inserting ‘/scp:localhost:/home/albinus/tmp/36090/hello.txt’...done
--8<---------------cut here---------------end--------------->8---

I have used /scp:localhost:, because there's no other machine around
with installed Mercurial.

> I make a change to the file, and save it:
>
> Saving file /scp:helium:/home/norman/checkouts/itm/test/hello.txt...
>
>      Tramp: Checking ‘vc-registered’ for
> /scp:helium:/home/norman/checkouts/itm/test/hello.txt...
>      Tramp: Opening connection for helium using scp...
>      Tramp: Sending command ‘exec ssh   -o ControlMaster=auto -o
> ControlPath='tramp.%C' -o ControlPersist=no -e none helium’
>      Tramp: Waiting for prompts from remote shell...done
>      Tramp: Found remote shell prompt on ‘helium’
>      Tramp: Opening connection for helium using scp...done
>      Tramp: Checking ‘vc-registered’ for
> /scp:helium:/home/norman/checkouts/itm/test/hello.txt...done
>      Saving file
> /scp:helium:/home/norman/checkouts/itm/test/hello.txt...
>      Tramp: Encoding local file
> ‘/var/folders/f5/vh0d0ls94_j5s4bv49sz90s40000gn/T/tramp.dMysF4.txt’
> using ‘base64-encode-region’...done
>      Tramp: Decoding remote file
> ‘/scp:helium:/home/norman/checkouts/itm/test/hello.txt’ using
> ‘openssl enc -d -base64 >%s’...done
>
> It hangs again.  Again `C-g`, then:
>
>      Wrote /scp:helium:/home/norman/checkouts/itm/test/hello.txt
>      Quit

Also no problem here:

--8<---------------cut here---------------start------------->8---
Saving file /scp:localhost:/home/albinus/tmp/36090/hello.txt...
Tramp: Encoding local file ‘/tmp/tramp.nN5pim.txt’ using ‘base64-encode-region’...done
Tramp: Decoding remote file ‘/scp:localhost:/home/albinus/tmp/36090/hello.txt’ using ‘base64 -d -i >%s’...done
Wrote /scp:localhost:/home/albinus/tmp/36090/hello.txt
--8<---------------cut here---------------end--------------->8---

> The file does save successfully.  Thus the hang/wait is happening after
> the
> file has been saved to the remote machine's disk

Well, I haven't used a higher tramp-verbose level, so there are less
messages. But it looks like the problem is in vc-registered (ie,
tramp-sh-handle-vc-registered in Tramp). This is called after the file
is saved.

> If I create a non-version-controlled file `second.txt` beside this, and
> try to open, then save, this file using Tramp, this works as expected.
> That is, version-controlled hello.txt works; non-controlled second.txt
> doesn't.

sigh.

> The messages above and below are with tramp-verbose set to 3.  I don't
> get anything significantly different that I can see, with tramp-verbose
> set to 10.

Tramp doesn't write more verbose output to the *Messages* buffer. But if
you increase tramp-verbose to greater than 3, a Tramp debug buffer
*debug tramp/scp helium* will appear, which tells us everything.

> I can see some discussion of what may be this problem from 2014
> <https://lists.gnu.org/archive/html/bug-gnu-emacs/2014-10/msg01232.html>,
> but that thread appears to suggest that the fix is already committed
> (five years ago!).

Doesn't look related, but who knows...

> The same happens when starting Emacs with option -Q.

As said above, it works for me.

> Let me know if there's anything I can add.

Please rerun your test with tramp-verbose 10. Show the debug
buffer. Wait a little bit before you quit via C-g, in order to see it in
the traces when it happens.

> Best wishes,
>
> Norman

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36090; Package emacs. (Wed, 05 Jun 2019 09:51:02 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Norman Gray <Norman.Gray <at> glasgow.ac.uk>
Cc: "36090 <at> debbugs.gnu.org" <36090 <at> debbugs.gnu.org>
Subject: Re: bug#36090: Update: A case where this isn't a problem
Date: Wed, 05 Jun 2019 11:50:33 +0200
Norman Gray <Norman.Gray <at> glasgow.ac.uk> writes:

> Update:
>
> Oddly, this appears not to be a problem if I use Tramp to open a file
> /scp:localhost#2222:path/to/file.txt -- this is a file on a VM (FreeBSD
> as it happens) running on localhost, and with the ssh port NATted to
> local port 2222.  In this case, file.txt can be either
> version-controlled or not.

Hmm, maybe it isn't a Tramp problem, but due to options when calling hg?
A pager or so?

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36090; Package emacs. (Mon, 10 Jun 2019 13:10:02 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Norman Gray <Norman.Gray <at> glasgow.ac.uk>
Cc: "36090 <at> debbugs.gnu.org" <36090 <at> debbugs.gnu.org>
Subject: Re: bug#36090: 26.1;
 Tramp hanging when writing version-controlled file
Date: Mon, 10 Jun 2019 15:09:02 +0200
Norman Gray <Norman.Gray <at> glasgow.ac.uk> writes:

> Michael, hello.

Hi Norman,

> I've narrowed down the problem: it's with 'pager=less' in the remote
> .hgrc.  See details below.
>
> helium:~> cat .hgrc
> [ui]
> username = Norman Gray <norman.gray <at> glasgow.ac.uk>
> [pager]
> pager = less
> helium:~>
>
> Then:
>
>> C-x C-f /scp:helium:checkouts/test/vc.txt
>
> hangs until
>
>> C-g

Well, this is what I've supposed. A pager in the way.

The problem was discussed already in <https://debbugs.gnu.org/18940>.
I've patched vc-hg.el to set HGPLAIN=1, and this works at least
partly. See tramp-notes-debug-4.txt:

> 12:04:29.776000 tramp-send-command (6) # _echo( cd /home/norman/checkouts/test/ && env LANGUAGE\=C HGPLAIN\=1 hg --config alias.status\=status --config defaults.status\= status -A vc.txt </dev/null; echo tramp_exit_status $? )_echo
> 12:04:29.902872 tramp-wait-for-regexp (6) #
> M vc.txt
> tramp_exit_status 0
> ///2df5766235934cbe1e41dec56521114c#$

This "hg status" command works, w/o any problem. But then there is a "hg
log" command, which hangs, because HGPLAIN is not set:

> 12:04:29.937969 tramp-send-command (6) # _echo( cd /usr/home/norman/checkouts/test/ && env LC_MESSAGES\=C hg log -r . -l1 --template \{if\(bookmarks\,sub\(\'\ \'\,\'\,\'\,bookmarks\)\,if\(phabdiff\,phabdiff\,shortest\(node\,6\)\)\)\} </dev/null; echo tramp_exit_status $? )_echo
> 12:04:30.107049 tramp-accept-process-output (10) # *tramp/scp helium* nil run t
> WARNING: terminal is not fully functional
> -  (press RETURN)
> 12:04:35.825130 tramp-file-name-handler (1) # Interrupt received in operation (process-file hg nil t nil log -r . -l1 --template {if(bookmarks,sub(' ',',',bookmarks),if(phabdiff,phabdiff,shortest(node,6)))})

Well, we could try to patch vc-hg.el, again. But there is a more elegant
solution, set HGPLAIN=1 yourself in Tramp. This is even explained in the
Tramp manual, for a good reason :-) See (info "(tramp) Remote processes")

Alternatively, you could try to set in .hgrc

pager = LESS='FRX' less -d

as proposed in <https://mercurial.selenic.com/wiki/PagerExtension> for
Tramp. I haven't tested this, 'tho.

Best regards, Michael.




Added tag(s) notabug. Request was from Michael Albinus <michael.albinus <at> gmx.de> to control <at> debbugs.gnu.org. (Mon, 10 Jun 2019 13:27:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36090; Package emacs. (Mon, 10 Jun 2019 14:17:02 GMT) Full text and rfc822 format available.

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

From: Norman Gray <Norman.Gray <at> glasgow.ac.uk>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: "36090 <at> debbugs.gnu.org" <36090 <at> debbugs.gnu.org>
Subject: Re: bug#36090: 26.1; Tramp hanging when writing version-controlled
 file
Date: Mon, 10 Jun 2019 11:19:00 +0000
[Message part 1 (text/plain, inline)]
Michael, hello.

I've narrowed down the problem: it's with 'pager=less' in the remote 
.hgrc.  See details below.

To reproduce:

helium:checkouts> mkdir test
helium:checkouts> cd test
helium:test> hg init
helium:test> echo 'This file is version-controlled' >vc.txt
helium:test> echo 'This file is not version-controlled' >vc-no.txt
helium:test> hg add vc.txt
helium:test> hg ci -m"Initial"
helium:test> hg st
? vc-no.txt
helium:~> cat .hgrc
[ui]
username = Norman Gray <norman.gray <at> glasgow.ac.uk>
[pager]
pager = less
helium:~>

Then:

> C-x C-f /scp:helium:checkouts/test/vc.txt

hangs until

> C-g

Then edited this file, and saved it.

> C-x C-s

This again hung until C-g.  The non-version-controlled file, vc-no.txt 
worked as expected.

The contents of the *Messages* and *debug* buffers, with tramp-version 
set to 10, for this case, are attached, in

tramp-notes-messages-4.txt
tramp-notes-debug-4.txt

Then I edit .hgrc:

helium:~> cat .hgrc
[ui]
username = Norman Gray <norman.gray <at> glasgow.ac.uk>
helium:~>

...and edit and save (C-x C-s) vc.txt, and it works.  The contents of 
the *Messages* and *debug* buffers, for this case, are in

tramp-notes-messages-5.txt
tramp-notes-debug-5.txt

As before, this is tramp 2.4.2-pre, in the same git version as before.

The remote version of less is:

> helium:~> less --version
> less 530 (POSIX regular expressions)
> Copyright (C) 1984-2017  Mark Nudelman

My initial pager setting was 'pager = LESS=-FRX less'.  That might be 
overdone (I can't remember offhand why I've selected those options), but 
not particularly unreasonable.  I don't want to simply omit setting from 
my .hgrc.  It might be that amending the remote hg command by adding 
'--config pager.pager=' will override the relevant invocation of remote 
hg -- I haven't tested this.

Thanks for your continued labours here.

Best wishes,

Norman

[tramp-notes-debug-4.txt (text/plain, attachment)]
[tramp-notes-messages-4.txt (text/plain, attachment)]
[tramp-notes-debug-5.txt (text/plain, attachment)]
[tramp-notes-messages-5.txt (text/plain, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36090; Package emacs. (Mon, 24 Jun 2019 16:22:02 GMT) Full text and rfc822 format available.

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

From: Norman Gray <Norman.Gray <at> glasgow.ac.uk>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: "36090 <at> debbugs.gnu.org" <36090 <at> debbugs.gnu.org>
Subject: Re: bug#36090: 26.1; Tramp hanging when writing version-controlled
 file
Date: Mon, 24 Jun 2019 16:21:14 +0000
Michael, hello.

Sorry for the delay in responding to your last message, and thanks for 
your thoughtful response.

On 10 Jun 2019, at 14:09, Michael Albinus wrote:

> The problem was discussed already in <https://debbugs.gnu.org/18940>.
> I've patched vc-hg.el to set HGPLAIN=1, and this works at least
> partly. See tramp-notes-debug-4.txt:

I've now read the discussion in that bug report.

> Well, we could try to patch vc-hg.el, again.

Myself, I think that setting HGPLAIN=1 in the hg invocation within 
vc-hg.el is by far the most elegant/straightforward/robust solution.

The hg(1) manpage explicitly documents HGPLAIN as being the preferred 
way to disable 'any configuration settings that might change Mercurial's 
default output' and notes that '[t]his can be useful when scripting 
against Mercurial in the face of existing user configuration.'  Also, 
`hg help scripting` goes further, and says of HGPLAIN 'It is highly 
recommended for machines to set this variable when invoking "hg" 
processes.'

That is, this seems to clearly indicate that, in all non-interactive 
invocations of Mercurial, HGPLAIN should be set; indeed, that this is 
set could almost be regarded as an integral part of Mercurial's 
scripting interface.  I suggest that _any_ invocation of 'hg' within 
vc-hg.el, local or remote, which does not ensure this is set, should be 
reported as a bug!  Might this require a lot more than adjusting 
vc-hg-command at the end of vc-hg.el? (possibly -- I'm not clear on just 
how/where vc-hg.el interacts with Tramp).

Re:

> But there is a more elegant
> solution, set HGPLAIN=1 yourself in Tramp. This is even explained in 
> the
> Tramp manual, for a good reason :-) See (info "(tramp) Remote 
> processes")

[and...]

> Alternatively, you could try to set in .hgrc
>
> pager = LESS='FRX' less -d
>
> as proposed in <https://mercurial.selenic.com/wiki/PagerExtension> for
> Tramp. I haven't tested this, 'tho.

I don't think it really works to resolve this by requiring specific user 
behaviour, as a large fraction of users will fail to do this (I 
deliberately avoid customising my environment too much, but even I felt 
it useful to customise this bit of Mercurial).

Similarly, I don't think it works to require users to modify their 
`process-environment` or `tramp-remote-process-environment`.  I'm a 
reasonably sophisticated emacs user -- I've written small amounts of 
elisp, but no more, and I have fairly deliberately avoided excess 
cleverness in my init.el -- and I'd have to think twice to work out how 
to do this.

Best wishes,

Norman


-- 
Norman Gray  :  https://nxg.me.uk
SUPA School of Physics and Astronomy, University of Glasgow, UK

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36090; Package emacs. (Tue, 16 Jul 2019 14:45:02 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Norman Gray <Norman.Gray <at> glasgow.ac.uk>
Cc: "36090 <at> debbugs.gnu.org" <36090 <at> debbugs.gnu.org>,
 Dmitry Gutov <dgutov <at> yandex.ru>
Subject: Re: bug#36090: 26.1; Tramp hanging when writing version-controlled
 file
Date: Tue, 16 Jul 2019 16:44:03 +0200
[Message part 1 (text/plain, inline)]
Norman Gray <Norman.Gray <at> glasgow.ac.uk> writes:

> Michael, hello.

Hi Norman,

>> The problem was discussed already in <https://debbugs.gnu.org/18940>.
>> I've patched vc-hg.el to set HGPLAIN=1, and this works at least
>> partly. See tramp-notes-debug-4.txt:
>
> I've now read the discussion in that bug report.
>
>> Well, we could try to patch vc-hg.el, again.
>
> Myself, I think that setting HGPLAIN=1 in the hg invocation within
> vc-hg.el is by far the most elegant/straightforward/robust solution.
>
> The hg(1) manpage explicitly documents HGPLAIN as being the preferred
> way to disable 'any configuration settings that might change Mercurial's
> default output' and notes that '[t]his can be useful when scripting
> against Mercurial in the face of existing user configuration.'  Also,
> `hg help scripting` goes further, and says of HGPLAIN 'It is highly
> recommended for machines to set this variable when invoking "hg"
> processes.'
>
> That is, this seems to clearly indicate that, in all non-interactive
> invocations of Mercurial, HGPLAIN should be set; indeed, that this is
> set could almost be regarded as an integral part of Mercurial's
> scripting interface.  I suggest that _any_ invocation of 'hg' within
> vc-hg.el, local or remote, which does not ensure this is set, should be
> reported as a bug!  Might this require a lot more than adjusting
> vc-hg-command at the end of vc-hg.el? (possibly -- I'm not clear on just
> how/where vc-hg.el interacts with Tramp).

I'm not familiar with vc-hg.el. The appended patch tries to set HGPLAIN
wherever "hg" is called. Could you pls check, whether it works for you
as expected?

And in case of, Dmitry might decide, whether the patch is applicable to
vc-hg.el.

> Best wishes,
>
> Norman

Best regards, Michael.

[Message part 2 (text/plain, attachment)]

Removed tag(s) notabug. Request was from Michael Albinus <michael.albinus <at> gmx.de> to control <at> debbugs.gnu.org. (Mon, 22 Jul 2019 11:37:02 GMT) Full text and rfc822 format available.

Added tag(s) patch. Request was from Michael Albinus <michael.albinus <at> gmx.de> to control <at> debbugs.gnu.org. (Mon, 22 Jul 2019 11:38:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36090; Package emacs. (Thu, 15 Aug 2019 12:44:02 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: Norman Gray <Norman.Gray <at> glasgow.ac.uk>,
 "36090 <at> debbugs.gnu.org" <36090 <at> debbugs.gnu.org>
Subject: Re: bug#36090: 26.1; Tramp hanging when writing version-controlled
 file
Date: Thu, 15 Aug 2019 14:43:41 +0200
Michael Albinus <michael.albinus <at> gmx.de> writes:

Hi,

> I'm not familiar with vc-hg.el. The appended patch tries to set HGPLAIN
> wherever "hg" is called. Could you pls check, whether it works for you
> as expected?
>
> And in case of, Dmitry might decide, whether the patch is applicable to
> vc-hg.el.

No News for several weeks. I'll push it to master within some days, if
nobody objects.

Best regards, Michael.




Reply sent to Michael Albinus <michael.albinus <at> gmx.de>:
You have taken responsibility. (Sun, 08 Sep 2019 10:04:01 GMT) Full text and rfc822 format available.

Notification sent to Norman Gray <Norman.Gray <at> glasgow.ac.uk>:
bug acknowledged by developer. (Sun, 08 Sep 2019 10:04:02 GMT) Full text and rfc822 format available.

Message #40 received at 36090-done <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: Norman Gray <Norman.Gray <at> glasgow.ac.uk>, 36090-done <at> debbugs.gnu.org
Subject: Re: bug#36090: 26.1; Tramp hanging when writing version-controlled
 file
Date: Sun, 08 Sep 2019 12:03:24 +0200
Version: 27.1

Michael Albinus <michael.albinus <at> gmx.de> writes:

>> I'm not familiar with vc-hg.el. The appended patch tries to set HGPLAIN
>> wherever "hg" is called. Could you pls check, whether it works for you
>> as expected?
>>
>> And in case of, Dmitry might decide, whether the patch is applicable to
>> vc-hg.el.
>
> No News for several weeks. I'll push it to master within some days, if
> nobody objects.

Pushed, closing the bug.

Best regards, Michael.




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

This bug report was last modified 5 years and 255 days ago.

Previous Next


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