GNU bug report logs - #60011
30.0.50; git commit from *vc-diff* does not work over tramp

Previous Next

Package: emacs;

Reported by: sds <at> gnu.org

Date: Mon, 12 Dec 2022 16:33:02 UTC

Severity: normal

Found in version 30.0.50

Fixed in version 29.0.60

Done: Juri Linkov <juri <at> linkov.net>

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 60011 in the body.
You can then email your comments to 60011 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#60011; Package emacs. (Mon, 12 Dec 2022 16:33:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to sds <at> gnu.org:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 12 Dec 2022 16:33:02 GMT) Full text and rfc822 format available.

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

From: Sam Steingold <sds <at> gnu.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.0.50; git commit from *vc-diff* does not work over tramp
Date: Mon, 12 Dec 2022 11:31:48 -0500
I run Emacs locally (macosx laptop) and edit remote (Amazon Linux "cloud
desktop") files using tramp (scp).
I can commit files using vc/git just fine.
However, when I edit *vc-diff* and hit C-v v v (vc-next-action), and
then edit the commit message abd hit C-c C-c, I get this error:

--8<---------------cut here---------------start------------->8---
Debugger entered--Lisp error: (error "Failed (status 128): git --no-pager apply --cached...")
  signal(error ("Failed (status 128): git --no-pager apply --cached..."))
  error("Failed (%s): %s" "status 128" "git --no-pager apply --cached /var/folders/20/__3t...")
  vc-do-command("*vc*" 0 "git" "/var/folders/20/__3tt7vx6wg51x8xvqdc1cmw0000gr/T/g..." "--no-pager" "apply" "--cached")
  apply(vc-do-command "*vc*" 0 "git" "/var/folders/20/__3tt7vx6wg51x8xvqdc1cmw0000gr/T/g..." ("--no-pager" "apply" "--cached"))
  vc-git-command(nil 0 "/var/folders/20/__3tt7vx6wg51x8xvqdc1cmw0000gr/T/g..." "apply" "--cached")
  vc-git-checkin(nil #("Summary: TEE: split pairs_mx into make_da2mt_mx an..." ...
  vc-git-checkin-patch(#("diff --git a/TEE/lucindex.py b/TEE/lucindex.py\nind..." ...
  apply(vc-git-checkin-patch (#("diff --git a/TEE/lucindex.py b/TEE/lucindex.py\nind..." ...
  vc-call-backend(Git checkin-patch #("diff --git a/TEE/lucindex.py b/TEE/lucindex.py\nind..." ...
  #f(compiled-function (files comment) #<bytecode 0x1dfec5afeaefa0a0>) ...
  vc-finish-logentry()
  funcall-interactively(vc-finish-logentry)
  call-interactively(vc-finish-logentry)
  log-edit-done()
  funcall-interactively(log-edit-done)
  call-interactively(log-edit-done nil nil)
  command-execute(log-edit-done)
--8<---------------cut here---------------end--------------->8---


and *vc* says

--8<---------------cut here---------------start------------->8---
error: can't open patch '/var/folders/20/__3tt7vx6wg51x8xvqdc1cmw0000gr/T/git-patchAWaImM': No such file or directory
--8<---------------cut here---------------end--------------->8---

this is a _local_ directory - it exists on the laptop but not on the
"cloud desktop".




In GNU Emacs 30.0.50 (build 2, x86_64-apple-darwin21.6.0, NS
 appkit-2113.60 Version 12.6.1 (Build 21G217)) of 2022-12-12 built on
 3c22fb11fdab.ant.amazon.com
Repository revision: 5325d815af43a36ea8571851e272c3d39bc19252
Repository branch: master
Windowing system distributor 'Apple', version 10.3.2113
System Description:  macOS 12.6.1

Configured using:
 'configure --with-imagemagick --with-mailutils --with-ns
 PKG_CONFIG_PATH='

Configured features:
ACL GIF GMP GNUTLS IMAGEMAGICK JPEG JSON LCMS2 LIBXML2 MODULES NOTIFY
KQUEUE NS PDUMPER PNG SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS WEBP XIM
ZLIB

Important settings:
  value of $LC_MESSAGES: C
  value of $LANG: C
  locale-coding-system: utf-8-unix

Major mode: ELisp/l

Minor modes in effect:
  shell-dirtrack-mode: t
  bug-reference-prog-mode: t
  pyvenv-mode: t
  global-edit-server-edit-mode: t
  server-mode: t
  winner-mode: t
  which-function-mode: t
  url-handler-mode: t
  desktop-save-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-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
  column-number-mode: t
  line-number-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  abbrev-mode: t

Load-path shadows:
None found.

Features:
(shadow sort bbdb-message mailalias cookie1 mail-extr gnus-msg emacsbug
cl-print debug backtrace log-edit vc-src vc-sccs vc-svn vc-cvs vc-rcs
log-view pcvs-util smerge-mode diff misearch multi-isearch skeleton
dabbrev url-http url-auth url-gw nsm ein-jupyter ein-dev ein-notebook
ein-python-send ein-traceback ein-pytools ein-pager ein-completer
ein-notification ein-scratchsheet ein-worksheet poly-ein quail polymode
poly-lock polymode-base polymode-weave polymode-export polymode-compat
polymode-methods polymode-core polymode-classes eieio-custom eieio-base
color ein-kill-ring ein-cell ein-shared-output ein-output-area
ein-kernelinfo ein-kernel ein-ipdb ein-events ein-websocket websocket
bindat ein-file ein-node ein-notebooklist shortdoc ein-contents-api
ein-query ein-log ein-classes ein-core request autorevert anaphora
ein-utils deferred dash cc-mode cc-fonts cc-guess cc-menus cc-cmds
cc-styles cc-align cc-engine cc-vars cc-defs ein display-line-numbers
add-log vc-hg vc-bzr tramp-cache time-stamp tramp-sh tramp
tramp-loaddefs trampver tramp-integration tramp-compat shell ls-lisp
remember score-mode conf-mode bug-reference flyspell ispell
display-fill-column-indicator org-element org-persist org-id org-refile
avl-tree oc-basic ol-eww eww xdg url-queue mm-url ol-rmail ol-mhe ol-irc
ol-info ol-gnus nnselect gnus-art mm-uu mml2015 mm-view mml-smime smime
gnutls dig gnus-sum shr pixel-fill kinsoku url-file svg dom browse-url
url url-proxy url-privacy url-expand url-methods url-history url-cookie
generate-lisp-file url-domsuf url-util gnus-group gnus-undo gnus-start
gnus-dbus dbus xml gnus-cloud nnimap nnmail mail-source utf7 nnoo
parse-time gnus-spec gnus-int gnus-range message sendmail mailcap
yank-media puny rfc822 mml mml-sec epa derived epg rfc6068 epg-config
mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045
ietf-drums gmm-utils mailheader gnus-win ol-docview doc-view filenotify
jka-compr image-mode exif ol-bibtex bibtex iso8601 ol-bbdb ol-w3m ol-doi
org-link-doi org ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro
org-src ob-comint org-pcomplete pcomplete org-list org-footnote
org-faces org-entities noutline outline ob-emacs-lisp ob-core ob-eval
org-cycle org-table ol org-fold org-fold-core org-keys oc org-loaddefs
find-func cal-x view cal-china cal-bahai cal-islam holidays
holiday-loaddefs bbdb-anniv cal-iso cal-hebrew lunar cal-julian solar
cal-dst appt diary-lib diary-loaddefs cal-menu calendar cal-loaddefs
org-version org-compat org-macs format-spec vc-dir ewoc vc sh-script
smie executable vc-git vc-dispatcher company-oddmuse company-keywords
company-etags company-gtags company-dabbrev-code company-dabbrev
company-files company-clang company-template company-cmake company-bbdb
yasnippet-snippets cl-extra yasnippet flymake-proc flymake thingatpt
company-capf company help-fns radix-tree help-mode elpy elpy-rpc pyvenv
eshell esh-cmd esh-ext esh-opt esh-proc esh-io esh-arg esh-module
esh-groups esh-util cus-start elpy-shell elpy-profile elpy-django s
elpy-refactor diff-mode easy-mmode ido hideshow grep compile files-x
etags fileloop generator xref python rx project compat compat-macs
treesit comint ansi-osc ansi-color dired-aux midnight dired
dired-loaddefs cus-edit pp warnings icons gnus nnheader gnus-util
text-property-search time-date mail-utils range mm-util mail-prsvr
wid-edit bbdb-mua bbdb-com crm mailabbrev bbdb bbdb-site timezone
modus-vivendi-theme modus-themes pcase edit-server advice server winner
ring which-func imenu url-handlers url-parse auth-source cl-seq eieio
eieio-core cl-macs password-cache json subr-x map byte-opt gv bytecomp
byte-compile url-vars help-at-pt desktop frameset cl-loaddefs cl-lib
cus-load info fb2-reader-autoloads async-autoloads f-autoloads
ein-autoloads bbdb-autoloads yaml-mode-autoloads with-editor-autoloads
dash-autoloads request-autoloads yasnippet-snippets-autoloads
compat-autoloads websearch-autoloads elpy-autoloads s-autoloads
company-autoloads polymode-autoloads edit-server-autoloads
markdown-mode-autoloads rmc iso-transl tooltip cconv eldoc paren
electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode 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 lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow
isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax
font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine 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 emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads kqueue cocoa ns lcms2
multi-tty make-network-process emacs)

Memory information:
((conses 16 691472 82991)
 (symbols 48 40963 6)
 (strings 32 262476 9487)
 (string-bytes 1 7246730)
 (vectors 16 110814)
 (vector-slots 8 2207864 131822)
 (floats 8 1153 347)
 (intervals 56 17739 877)
 (buffers 976 105))

-- 
Sam Steingold (https://aphar.dreamwidth.org/) on darwin Ns 10.3.2113
https://lastingimpactpsychology.com https://steingoldpsychology.com
https://iris.org.il https://fairforall.org http://think-israel.org
A bullet affects the way the brain functions even when it hits the butt.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60011; Package emacs. (Mon, 12 Dec 2022 18:32:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Sam Steingold <sds <at> gnu.org>
Cc: 60011 <at> debbugs.gnu.org
Subject: Re: bug#60011: 30.0.50; git commit from *vc-diff* does not work
 over tramp
Date: Mon, 12 Dec 2022 20:29:09 +0200
> I run Emacs locally (macosx laptop) and edit remote (Amazon Linux "cloud
> desktop") files using tramp (scp).
> I can commit files using vc/git just fine.
> However, when I edit *vc-diff* and hit C-v v v (vc-next-action), and
> then edit the commit message abd hit C-c C-c, I get this error:
>
> Debugger entered--Lisp error: (error "Failed (status 128): git --no-pager apply --cached...")
>   signal(error ("Failed (status 128): git --no-pager apply --cached..."))
>   error("Failed (%s): %s" "status 128" "git --no-pager apply --cached /var/folders/20/__3t...")
>   vc-do-command("*vc*" 0 "git" "/var/folders/20/__3tt7vx6wg51x8xvqdc1cmw0000gr/T/g..." "--no-pager" "apply" "--cached")
>   apply(vc-do-command "*vc*" 0 "git" "/var/folders/20/__3tt7vx6wg51x8xvqdc1cmw0000gr/T/g..." ("--no-pager" "apply" "--cached"))
>   vc-git-command(nil 0 "/var/folders/20/__3tt7vx6wg51x8xvqdc1cmw0000gr/T/g..." "apply" "--cached")
>   vc-git-checkin(nil #("Summary: TEE: split pairs_mx into make_da2mt_mx an..." ...

The problem is in these lines that create a temporary file
on a local directory only:

      (let ((patch-file (make-temp-file "git-patch")))
        (with-temp-file patch-file
          (insert vc-git-patch-string))
        (unwind-protect
            (vc-git-command nil 0 patch-file "apply" "--cached")
          (delete-file patch-file)))

I'm not yet sure whether using make-nearby-temp-file could help
to create a temporary file on a remote directory, need to try.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60011; Package emacs. (Tue, 13 Dec 2022 17:30:03 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: Sam Steingold <sds <at> gnu.org>, 60011 <at> debbugs.gnu.org
Subject: Re: bug#60011: 30.0.50; git commit from *vc-diff* does not work
 over tramp
Date: Tue, 13 Dec 2022 19:16:17 +0200
[Message part 1 (text/plain, inline)]
Hi Michael,

Could you please confirm that I correctly implemented support for
Tramp in the following patch.

>> I run Emacs locally (macosx laptop) and edit remote (Amazon Linux "cloud
>> desktop") files using tramp (scp).
>> I can commit files using vc/git just fine.
>> However, when I edit *vc-diff* and hit C-v v v (vc-next-action), and
>> then edit the commit message abd hit C-c C-c, I get this error:
>> Debugger entered--Lisp error: (error "Failed (status 128): git --no-pager apply --cached...")
>
> The problem is in these lines that create a temporary file
> on a local directory only:

[tramp-vc-git-checkin.patch (text/x-diff, inline)]
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 83138a6d107..65604e84d0e 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -103,6 +103,7 @@
 (require 'vc-dispatcher)
 (eval-when-compile
   (require 'subr-x) ; for string-trim-right
+  (require 'tramp)
   (require 'vc)
   (require 'vc-dir))
 
@@ -1048,7 +1049,13 @@ vc-git-checkin
                         (string-replace file-diff "" vc-git-patch-string))
                 (user-error "Index not empty"))
               (setq pos (point))))))
-      (let ((patch-file (make-temp-file "git-patch")))
+      (let ((patch-file
+             (if (file-remote-p default-directory)
+                 (with-parsed-tramp-file-name
+                     (expand-file-name default-directory) nil
+                   (tramp-make-tramp-file-name
+                    v (with-no-warnings (tramp-make-tramp-temp-file v))))
+               (make-temp-file "git-patch"))))
         (with-temp-file patch-file
           (insert vc-git-patch-string))
         (unwind-protect

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60011; Package emacs. (Tue, 13 Dec 2022 18:34:01 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Juri Linkov <juri <at> linkov.net>
Cc: Sam Steingold <sds <at> gnu.org>, 60011 <at> debbugs.gnu.org
Subject: Re: bug#60011: 30.0.50; git commit from *vc-diff* does not work
 over tramp
Date: Tue, 13 Dec 2022 19:33:25 +0100
Juri Linkov <juri <at> linkov.net> writes:

> Hi Michael,

Hi Juri,

> Could you please confirm that I correctly implemented support for
> Tramp in the following patch.

No.

> diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
> index 83138a6d107..65604e84d0e 100644
> --- a/lisp/vc/vc-git.el
> +++ b/lisp/vc/vc-git.el
> @@ -103,6 +103,7 @@
>  (require 'vc-dispatcher)
>  (eval-when-compile
>    (require 'subr-x) ; for string-trim-right
> +  (require 'tramp)
>    (require 'vc)
>    (require 'vc-dir))
>
> @@ -1048,7 +1049,13 @@ vc-git-checkin
>                          (string-replace file-diff "" vc-git-patch-string))
>                  (user-error "Index not empty"))
>                (setq pos (point))))))
> -      (let ((patch-file (make-temp-file "git-patch")))
> +      (let ((patch-file
> +             (if (file-remote-p default-directory)
> +                 (with-parsed-tramp-file-name
> +                     (expand-file-name default-directory) nil
> +                   (tramp-make-tramp-file-name
> +                    v (with-no-warnings (tramp-make-tramp-temp-file v))))
> +               (make-temp-file "git-patch"))))
>          (with-temp-file patch-file
>            (insert vc-git-patch-string))
>          (unwind-protect

Please don't use Tramp internal functions. As somebody else said in
this thread, make-nearby-temp-file should be good enough.

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60011; Package emacs. (Wed, 14 Dec 2022 08:07:01 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: Sam Steingold <sds <at> gnu.org>, 60011 <at> debbugs.gnu.org
Subject: Re: bug#60011: 30.0.50; git commit from *vc-diff* does not work
 over tramp
Date: Wed, 14 Dec 2022 10:06:18 +0200
close 60011 29.0.60
thanks

> Please don't use Tramp internal functions. As somebody else said in
> this thread, make-nearby-temp-file should be good enough.

Thanks for confirming.  I was not sure that the fix is so much simple.




bug marked as fixed in version 29.0.60, send any further explanations to 60011 <at> debbugs.gnu.org and sds <at> gnu.org Request was from Juri Linkov <juri <at> linkov.net> to control <at> debbugs.gnu.org. (Wed, 14 Dec 2022 08:07:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60011; Package emacs. (Wed, 14 Dec 2022 21:59:01 GMT) Full text and rfc822 format available.

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

From: Sam Steingold <sds <at> gnu.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: Michael Albinus <michael.albinus <at> gmx.de>, 60011 <at> debbugs.gnu.org
Subject: Re: bug#60011: 30.0.50;
 git commit from *vc-diff* does not work over tramp
Date: Wed, 14 Dec 2022 16:58:24 -0500
Juri, thank you very much for fixing the bug.
Alas, I don't see your fix in the master - do you mind merging it there also?
Thank you again!

On Wed, 14 Dec 2022 at 03:06, Juri Linkov <juri <at> linkov.net> wrote:
>
> close 60011 29.0.60
> thanks
>
> > Please don't use Tramp internal functions. As somebody else said in
> > this thread, make-nearby-temp-file should be good enough.
>
> Thanks for confirming.  I was not sure that the fix is so much simple.



-- 
Sam Steingold <http://sds.podval.org> <http://www.childpsy.net>
<http://steingoldpsychology.com>




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60011; Package emacs. (Thu, 15 Dec 2022 07:32:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Sam Steingold <sds <at> gnu.org>
Cc: Michael Albinus <michael.albinus <at> gmx.de>, 60011 <at> debbugs.gnu.org
Subject: Re: bug#60011: 30.0.50; git commit from *vc-diff* does not work
 over tramp
Date: Thu, 15 Dec 2022 09:27:19 +0200
> Juri, thank you very much for fixing the bug.
> Alas, I don't see your fix in the master - do you mind merging it there also?

Sorry, we need to wait until someone will merge the changes from the
emacs-29 branch to master.  I'm not confident doing this myself since
the merging script often breaks the NEWS file and omits some commits.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60011; Package emacs. (Fri, 16 Dec 2022 07:53:01 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Sam Steingold <sds <at> gnu.org>
Cc: Michael Albinus <michael.albinus <at> gmx.de>, 60011 <at> debbugs.gnu.org
Subject: Re: bug#60011: 30.0.50; git commit from *vc-diff* does not work
 over tramp
Date: Fri, 16 Dec 2022 09:52:11 +0200
>> Juri, thank you very much for fixing the bug.
>> Alas, I don't see your fix in the master - do you mind merging it there also?
>
> Sorry, we need to wait until someone will merge the changes from the
> emacs-29 branch to master.  I'm not confident doing this myself since
> the merging script often breaks the NEWS file and omits some commits.

Now the fix arrived to master, please try again.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 13 Jan 2023 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 213 days ago.

Previous Next


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