unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#74352: 29.4; emerge-files with tramp + local file fails
@ 2024-11-13 19:11 Jörg Sommer
  2024-11-14  7:05 ` Eli Zaretskii
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Jörg Sommer @ 2024-11-13 19:11 UTC (permalink / raw)
  To: 74352

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

Hi,

when running `emerge-files` with `/ssh:remote:file` and `~/local-file` I get
the buffer `*emerge-diff-errors*` with:

```
diff: /tmp/tramp.wlcRNL: No such file or directory
diff: /home/joerg/local-file: No such file or directory
```

This change solves the problem:

```diff
diff --git lisp/vc/emerge.el lisp/vc/emerge.el
index ca48f2f3c7b..562041e4232 100644
--- lisp/vc/emerge.el
+++ lisp/vc/emerge.el
@@ -581,6 +581,7 @@ emerge-make-diff-list
   (setq emerge-diff-buffer (get-buffer-create "*emerge-diff*"))
   (with-current-buffer
       emerge-diff-buffer
+    (setq default-directory (file-name-directory file-A))
     (erase-buffer)
     (shell-command
      (format "%s %s %s %s"
```

Regards Jörg

In GNU Emacs 29.4 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.42, cairo
 version 1.18.0) of 2024-06-30, modified by Debian built on sbuild
System Description: Debian GNU/Linux trixie/sid

Configured using:
 'configure --build x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib
 --libexecdir=/usr/libexec --localstatedir=/var/lib
 --infodir=/usr/share/info --mandir=/usr/share/man --with-libsystemd
 --with-pop=yes
 --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/29.4/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/29.4/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils
 --with-native-compilation --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/libexec
 --localstatedir=/var/lib --infodir=/usr/share/info --mandir=/usr/share/man
 --with-libsystemd --with-pop=yes
 --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/29.4/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/29.4/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils
 --with-native-compilation --with-pgtk 'CFLAGS=-g -O2
 -Werror=implicit-function-declaration
 -ffile-prefix-map=/build/reproducible-path/emacs-29.4+1=.
 -fstack-protector-strong -fstack-clash-protection -Wformat
 -Werror=format-security -fcf-protection -Wall' 'CPPFLAGS=-Wdate-time
 -D_FORTIFY_SOURCE=2' LDFLAGS=-Wl,-z,relro'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG JSON
LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY
INOTIFY PDUMPER PGTK PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM GTK3 ZLIB

Important settings:
  value of $LANG: de_DE.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Shell-script

Minor modes in effect:
  async-bytecomp-package-mode: t
  sh-electric-here-document-mode: t
  treemacs-filewatch-mode: t
  treemacs-follow-mode: t
  treemacs-git-mode: t
  treemacs-fringe-indicator-mode: t
  desktop-save-mode: t
  global-whitespace-mode: t
  which-key-mode: t
  recentf-mode: t
  global-git-commit-mode: t
  shell-dirtrack-mode: t
  server-mode: t
  global-hl-todo-mode: t
  hl-todo-mode: t
  override-global-mode: t
  company-statistics-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  TeX-PDF-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  size-indication-mode: t
  column-number-mode: t
  line-number-mode: t
  auto-fill-function: #[128 \304\300\301\x03#\207 [yas--auto-fill #[128 \301\302\300!\x02"\207 [auto-fill-function apply default-value] 4 

(fn &rest ARGS)] :around nil apply] 5 advice]
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  abbrev-mode: t

Load-path shadows:
/usr/share/emacs/site-lisp/elpa/devscripts-40/pbuilder-mode hides /usr/share/emacs/site-lisp/elpa-src/devscripts-40/pbuilder-mode
/usr/share/emacs/site-lisp/elpa/devscripts-40/devscripts hides /usr/share/emacs/site-lisp/elpa-src/devscripts-40/devscripts
/usr/share/emacs/site-lisp/elpa/devscripts-40/devscripts-autoloads hides /usr/share/emacs/site-lisp/elpa-src/devscripts-40/devscripts-autoloads
/usr/share/emacs/site-lisp/elpa/devscripts-40/devscripts-pkg hides /usr/share/emacs/site-lisp/elpa-src/devscripts-40/devscripts-pkg
/usr/share/emacs/site-lisp/elpa/devscripts-40/pbuilder-log-view-mode hides /usr/share/emacs/site-lisp/elpa-src/devscripts-40/pbuilder-log-view-mode
/usr/share/emacs/site-lisp/elpa/mutt-alias-1.4/mutt-alias-autoloads hides /usr/share/emacs/site-lisp/elpa-src/mutt-alias-1.4/mutt-alias-autoloads
/usr/share/emacs/site-lisp/elpa/mutt-alias-1.4/mutt-alias-pkg hides /usr/share/emacs/site-lisp/elpa-src/mutt-alias-1.4/mutt-alias-pkg
/usr/share/emacs/site-lisp/elpa/mutt-alias-1.4/mutt-alias hides /usr/share/emacs/site-lisp/elpa-src/mutt-alias-1.4/mutt-alias
/usr/share/emacs/site-lisp/elpa/muttrc-mode-1.2.1/muttrc-mode-autoloads hides /usr/share/emacs/site-lisp/elpa-src/muttrc-mode-1.2.1/muttrc-mode-autoloads
/usr/share/emacs/site-lisp/elpa/muttrc-mode-1.2.1/muttrc-mode-pkg hides /usr/share/emacs/site-lisp/elpa-src/muttrc-mode-1.2.1/muttrc-mode-pkg
/usr/share/emacs/site-lisp/elpa/muttrc-mode-1.2.1/muttrc-mode hides /usr/share/emacs/site-lisp/elpa-src/muttrc-mode-1.2.1/muttrc-mode
/usr/share/emacs/site-lisp/elpa/pod-mode-1.3/pod-mode-pkg hides /usr/share/emacs/site-lisp/elpa-src/pod-mode-1.3/pod-mode-pkg
/usr/share/emacs/site-lisp/elpa/pod-mode-1.3/pod-mode hides /usr/share/emacs/site-lisp/elpa-src/pod-mode-1.3/pod-mode
/usr/share/emacs/site-lisp/elpa/pod-mode-1.3/pod-mode-autoloads hides /usr/share/emacs/site-lisp/elpa-src/pod-mode-1.3/pod-mode-autoloads
/home/joerg/.config/emacs/elpa/transient-20240918.1138/transient hides /usr/share/emacs/29.4/lisp/transient
/home/joerg/.config/emacs/elpa/csharp-mode-20221126.2005/csharp-mode hides /usr/share/emacs/29.4/lisp/progmodes/csharp-mode
/home/joerg/.config/emacs/elpa/project-0.11.1/project hides /usr/share/emacs/29.4/lisp/progmodes/project
/home/joerg/.config/emacs/elpa/xref-1.7.0/xref hides /usr/share/emacs/29.4/lisp/progmodes/xref

Features:
(shadow sort mail-extr emacsbug ibuffer ibuffer-loaddefs apropos mule-util
helpful cc-langs trace info-look elisp-refs bug-reference emerge help-fns
radix-tree cl-print expand-region text-mode-expansions cc-mode-expansions
python-el-fgallina-expansions latex-mode-expansions js2-mode-expansions
js-mode-expansions html-mode-expansions css-mode-expansions
er-basic-expansions expand-region-core expand-region-custom misearch
multi-isearch helm-x-files helm-for-files helm-bookmark helm-adaptive
treemacs-bookmarks treemacs-tags magit-bookmark bookmark pp helm-external
helm-net css-mode sgml-mode facemenu eww url-queue shr pixel-fill kinsoku
url-file svg mm-url gnus nnheader range winner minibuffer-complete-cycle
tramp-archive tramp-gvfs helm-command helm-elisp helm-eval edebug debug
backtrace helm-info helm-mode helm-misc helm-files image-dired
image-dired-tags image-dired-external image-dired-util xdg image-mode exif
helm-buffers helm-occur helm-tags helm-locate helm-grep helm-regexp
helm-utils helm-types helm-help helm helm-global-bindings helm-easymenu
helm-core async-bytecomp helm-source helm-multi-match helm-lib async systemd
conf-mode make-mode view lsp-zig lsp-yang lsp-yaml lsp-xml lsp-wgsl
lsp-volar lsp-vimscript lsp-vhdl lsp-vetur lsp-html lsp-verilog lsp-vala
lsp-v lsp-typeprof lsp-ttcn3 lsp-trunk lsp-toml lsp-tilt lsp-tex
lsp-terraform lsp-svelte lsp-steep lsp-sqls lsp-sql lsp-sorbet lsp-solidity
lsp-solargraph lsp-semgrep lsp-rust lsp-ruff lsp-ruby-syntax-tree
lsp-ruby-lsp lsp-rubocop lsp-roslyn lsp-rf lsp-remark lsp-racket lsp-r
lsp-qml lsp-pylsp lsp-pyls lsp-pwsh lsp-purescript lsp-pls lsp-php
lsp-perlnavigator lsp-perl lsp-openscad lsp-ocaml lsp-nushell lsp-nix
lsp-nim lsp-nginx lsp-move lsp-mojo lsp-mint lsp-meson lsp-mdx lsp-marksman
lsp-markdown lsp-magik lsp-lua lsp-lisp lsp-kotlin lsp-json lsp-jq
lsp-javascript lsp-idris lsp-haxe lsp-hack lsp-groovy lsp-graphql
lsp-golangci-lint lsp-glsl lsp-gleam lsp-gdscript lsp-fsharp lsp-fortran
lsp-eslint lsp-erlang lsp-emmet lsp-elm lsp-elixir lsp-earthly
lsp-dockerfile lsp-dhall lsp-d lsp-cypher lsp-cucumber lsp-css lsp-csharp
gnutls lsp-crystal lsp-credo lsp-cobol lsp-cmake lsp-clojure lsp-clangd
lsp-bufls lsp-go lsp-beancount lsp-bash lsp-awk lsp-autotools lsp-astro
lsp-asm lsp-ansible lsp-angular lsp-ada lsp-semantic-tokens lsp-actionscript
python sh-script smie executable lsp-treemacs lsp-treemacs-generic
lsp-treemacs-themes treemacs-treelib treemacs treemacs-header-line
treemacs-compatibility treemacs-mode treemacs-interface treemacs-persistence
treemacs-filewatch-mode treemacs-follow-mode treemacs-rendering
treemacs-annotations treemacs-async treemacs-workspaces treemacs-dom
treemacs-visuals treemacs-fringe-indicator pulse treemacs-faces
treemacs-icons treemacs-scope treemacs-themes treemacs-core-utils pfuture
hl-line treemacs-logging treemacs-customization treemacs-macros lsp-ui
lsp-ui-flycheck lsp-ui-imenu lsp-ui-peek lsp-ui-sideline lsp-ui-doc
goto-addr lsp-ui-util face-remap lsp-modeline lsp-headerline lsp-icons
lsp-diagnostics flycheck lsp-completion lsp-origami origami origami-parsers
lsp-mode lsp-protocol spinner network-stream nsm lv inline ht f ewoc
js2-mode js c-ts-common treesit cc-mode cc-fonts cc-guess cc-menus cc-cmds
jka-compr company-emoji company-emoji-list company-math math-symbol-lists
company-oddmuse company-keywords company-etags etags fileloop generator xref
company-gtags company-dabbrev-code company-dabbrev company-files
company-clang company-capf company-cmake company-semantic company-template
company-bbdb guess-language find-func flyspell ispell typo markdown-mode
color noutline outline desktop frameset disp-table whitespace diminish
which-key use-package-diminish dom tramp-cache time-stamp tramp-sh tramp
tramp-loaddefs trampver tramp-integration files-x tramp-compat parse-time
iso8601 recentf tree-widget wid-edit MRU-yank randomsig cl magit-submodule
magit-blame magit-stash magit-reflog magit-bisect magit-push magit-pull
magit-fetch magit-clone magit-remote magit-commit magit-sequence magit-notes
magit-worktree magit-tag magit-merge magit-branch magit-reset magit-files
magit-refs magit-status magit magit-repos magit-apply magit-wip magit-log
which-func imenu magit-diff smerge-mode diff git-commit log-edit message
sendmail yank-media puny rfc822 mml mml-sec epa epg rfc6068 epg-config
gnus-util time-date mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047
rfc2045 mm-util ietf-drums mail-prsvr mailabbrev mail-utils gmm-utils
mailheader pcvs-util add-log magit-core magit-autorevert autorevert
filenotify magit-margin magit-transient magit-process with-editor comp
comp-cstr shell pcomplete server magit-mode transient benchmark magit-git
magit-base magit-section format-spec cursor-sensor hl-todo compat compat-30
compat-macs dokuwiki-mode derived diff-mode use-package-bind-key bind-key
company-statistics company-auctex react-snippets yasnippet-snippets
yasnippet company latex easy-mmode edmacro kmacro latex-flymake flymake-proc
flymake project compile text-property-search warnings icons thingatpt
tex-ispell tex-style tex dbus xml crm texmathp cc-styles cc-align cc-engine
cc-vars cc-defs bitbake dash s mmm-mode mmm-univ mmm-class mmm-region
mmm-auto mmm-vars mmm-utils mmm-compat comint ansi-osc ring ansi-color
cl-extra help-mode use-package-core tty-dark-theme finder-inf advice
bitbake-autoloads cmake-font-lock-autoloads cmake-mode-autoloads
color-theme-modern-autoloads auctex-autoloads tex-site
company-emoji-autoloads company-fuzzy-autoloads company-autoloads
csv-mode-autoloads dpkg-dev-el-autoloads debian-el-autoloads debian-el dired
dired-loaddefs expand-region-autoloads flycheck-rust-autoloads
go-guru-autoloads go-mode-autoloads guess-language-autoloads
helm-c-yasnippet-autoloads helm-autoloads helm-core-autoloads
async-autoloads helpful-autoloads elisp-refs-autoloads hl-todo-autoloads
jenkinsfile-mode-autoloads groovy-mode-autoloads jq-mode-autoloads
jq-ts-mode-autoloads json-mode-autoloads kconfig-mode-autoloads
know-your-http-well-autoloads lsp-origami-autoloads lsp-treemacs-autoloads
lsp-ui-autoloads lsp-mode-autoloads lua-mode-autoloads magit-autoloads pcase
magit-section-autoloads mmm-mode-autoloads move-text-autoloads
multiple-cursors-autoloads nginx-mode-autoloads php-mode-autoloads
po-mode-autoloads restclient-test-autoloads restclient-autoloads
js2-mode-autoloads rustic-autoloads flycheck-autoloads project-autoloads
markdown-mode-autoloads f-autoloads rust-mode-autoloads
smartparens-autoloads rx test-simple-autoloads transient-autoloads
treemacs-autoloads posframe-autoloads dash-autoloads
visual-fill-column-autoloads wfnames-autoloads which-key-autoloads
with-editor-autoloads info compat-autoloads xref-autoloads
yaml-mode-autoloads yasnippet-snippets-autoloads yasnippet-autoloads
devscripts-autoloads mutt-alias-autoloads muttrc-mode-autoloads
pod-mode-autoloads package browse-url url url-proxy url-privacy url-expand
url-methods url-history url-cookie generate-lisp-file url-domsuf url-util
mailcap 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
cl-loaddefs cl-lib rmc iso-transl tooltip cconv eldoc paren electric
uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/pgtk-win
pgtk-win term/common-win pgtk-dnd 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 dbusbind inotify dynamic-setting
system-font-setting font-render-setting cairo gtk pgtk lcms2 multi-tty
make-network-process native-compile emacs)

Memory information:
((conses 16 1166425 809726)
 (symbols 48 69186 1)
 (strings 32 377226 108544)
 (string-bytes 1 11859790)
 (vectors 16 151735)
 (vector-slots 8 3622097 737749)
 (floats 8 922 3217)
 (intervals 56 223573 4049)
 (buffers 984 62))

-- 
Hügelschäfer's Law (http://www.bruhaha.de/laws.html):
Beiträge werden dort gepostet, wo sie den größten Widerstand hervorrufen.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* bug#74352: 29.4; emerge-files with tramp + local file fails
  2024-11-13 19:11 bug#74352: 29.4; emerge-files with tramp + local file fails Jörg Sommer
@ 2024-11-14  7:05 ` Eli Zaretskii
  2024-11-14 17:27   ` Jörg Sommer
  2024-11-14  8:10 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-11-16 12:21 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2 siblings, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2024-11-14  7:05 UTC (permalink / raw)
  To: Jörg Sommer; +Cc: 74352

> Date: Wed, 13 Nov 2024 20:11:10 +0100
> From: Jörg Sommer <joerg@jo-so.de>
> 
> when running `emerge-files` with `/ssh:remote:file` and `~/local-file` I get
> the buffer `*emerge-diff-errors*` with:
> 
> ```
> diff: /tmp/tramp.wlcRNL: No such file or directory
> diff: /home/joerg/local-file: No such file or directory
> ```
> 
> This change solves the problem:
> 
> ```diff
> diff --git lisp/vc/emerge.el lisp/vc/emerge.el
> index ca48f2f3c7b..562041e4232 100644
> --- lisp/vc/emerge.el
> +++ lisp/vc/emerge.el
> @@ -581,6 +581,7 @@ emerge-make-diff-list
>    (setq emerge-diff-buffer (get-buffer-create "*emerge-diff*"))
>    (with-current-buffer
>        emerge-diff-buffer
> +    (setq default-directory (file-name-directory file-A))

Thanks, but why file-A?  Isn't the problem symmetric wrt the two
files?  Or what am I missing?





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

* bug#74352: 29.4; emerge-files with tramp + local file fails
  2024-11-13 19:11 bug#74352: 29.4; emerge-files with tramp + local file fails Jörg Sommer
  2024-11-14  7:05 ` Eli Zaretskii
@ 2024-11-14  8:10 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-11-16 12:21 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2 siblings, 0 replies; 11+ messages in thread
From: Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-11-14  8:10 UTC (permalink / raw)
  To: Jörg Sommer; +Cc: 74352

Jörg Sommer <joerg@jo-so.de> writes:

> Hi,

Hi Joerg,

> when running `emerge-files` with `/ssh:remote:file` and `~/local-file` I get
> the buffer `*emerge-diff-errors*` with:
>
> ```
> diff: /tmp/tramp.wlcRNL: No such file or directory
> diff: /home/joerg/local-file: No such file or directory
> ```

Thanks for the report. There is also bug#6850 about the same topic, I've
merged both.

> This change solves the problem:
>
> ```diff
> diff --git lisp/vc/emerge.el lisp/vc/emerge.el
> index ca48f2f3c7b..562041e4232 100644
> --- lisp/vc/emerge.el
> +++ lisp/vc/emerge.el
> @@ -581,6 +581,7 @@ emerge-make-diff-list
>    (setq emerge-diff-buffer (get-buffer-create "*emerge-diff*"))
>    (with-current-buffer
>        emerge-diff-buffer
> +    (setq default-directory (file-name-directory file-A))
>      (erase-buffer)
>      (shell-command
>       (format "%s %s %s %s"
> ```

Unfortunately, nobody felt comfortable to work on this over the
years. I'll take the stab, and check your patch next days. So we should
fix this after so many years.

> Regards Jörg

Thanks for the heads-up, and best regards, Michael.





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

* bug#74352: 29.4; emerge-files with tramp + local file fails
  2024-11-14  7:05 ` Eli Zaretskii
@ 2024-11-14 17:27   ` Jörg Sommer
  0 siblings, 0 replies; 11+ messages in thread
From: Jörg Sommer @ 2024-11-14 17:27 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 74352

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

Eli Zaretskii schrieb am Do 14. Nov, 09:05 (+0200):
> > Date: Wed, 13 Nov 2024 20:11:10 +0100
> > From: Jörg Sommer <joerg@jo-so.de>
> > 
> > when running `emerge-files` with `/ssh:remote:file` and `~/local-file` I get
> > the buffer `*emerge-diff-errors*` with:
> > 
> > ```
> > diff: /tmp/tramp.wlcRNL: No such file or directory
> > diff: /home/joerg/local-file: No such file or directory
> > ```
> > 
> > This change solves the problem:
> > 
> > ```diff
> > diff --git lisp/vc/emerge.el lisp/vc/emerge.el
> > index ca48f2f3c7b..562041e4232 100644
> > --- lisp/vc/emerge.el
> > +++ lisp/vc/emerge.el
> > @@ -581,6 +581,7 @@ emerge-make-diff-list
> >    (setq emerge-diff-buffer (get-buffer-create "*emerge-diff*"))
> >    (with-current-buffer
> >        emerge-diff-buffer
> > +    (setq default-directory (file-name-directory file-A))
> 
> Thanks, but why file-A?  Isn't the problem symmetric wrt the two
> files?  Or what am I missing?

In *emerge-setup* above is this code:

```
	 ;; create the merge buffer from buffer A, so it inherits buffer A's
	 ;; default directory, etc.
	 (merge-buffer (with-current-buffer
			   buffer-A
			 (get-buffer-create merge-buffer-name))))
```

But I think it doesn't matter if A or B. The problem is that
emerge-diff-buffer has the remote directory and shell command tries to
execute the command on the remote side even through file-A and file-B were
copied to local side in *emerge-files-internal*.


Kind regards, Jörg

-- 
Die am Lautesten reden, haben stets am wenigsten zu sagen.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* bug#74352: 29.4; emerge-files with tramp + local file fails
  2024-11-13 19:11 bug#74352: 29.4; emerge-files with tramp + local file fails Jörg Sommer
  2024-11-14  7:05 ` Eli Zaretskii
  2024-11-14  8:10 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-11-16 12:21 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-11-17 10:10   ` Jörg Sommer
  2 siblings, 1 reply; 11+ messages in thread
From: Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-11-16 12:21 UTC (permalink / raw)
  To: Jörg Sommer; +Cc: 74352

Jörg Sommer <joerg@jo-so.de> writes:

> Hi,

Hi Jörg,

> when running `emerge-files` with `/ssh:remote:file` and `~/local-file` I get
> the buffer `*emerge-diff-errors*` with:
>
> ```
> diff: /tmp/tramp.wlcRNL: No such file or directory
> diff: /home/joerg/local-file: No such file or directory
> ```

I can reproduce the problem if file-A is remote, and file-B is
local. Also, if both file-A and file-B are remote.

If both files are local, or file-A is local and file-B is remote, emerge
works as exptected.

The crucial point seems to be that file-A is a remote one.

> This change solves the problem:
>
> ```diff
> diff --git lisp/vc/emerge.el lisp/vc/emerge.el
> index ca48f2f3c7b..562041e4232 100644
> --- lisp/vc/emerge.el
> +++ lisp/vc/emerge.el
> @@ -581,6 +581,7 @@ emerge-make-diff-list
>    (setq emerge-diff-buffer (get-buffer-create "*emerge-diff*"))
>    (with-current-buffer
>        emerge-diff-buffer
> +    (setq default-directory (file-name-directory file-A))
>      (erase-buffer)
>      (shell-command
>       (format "%s %s %s %s"
> ```

The point is, that emerge calls the 'diff' program for either the file
itself (if local), or a local copy of the file (if remote). A consistent
solution is therefore to set a local default directory, like

--8<---------------cut here---------------start------------->8---
    (setq default-directory temporary-file-directory)
--8<---------------cut here---------------end--------------->8---

instead of your change. Would you like to check?

However, this won't be a complete solution. There are other places in
emerge.el, where the temporary buffer for calling 'diff' must have a
local default directory. I'm not an emerge aficionado (haven't used it
until now). Would you like to produce a complete patch, based on my
proposal above?

> Regards Jörg

Best regards, Michael.





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

* bug#74352: 29.4; emerge-files with tramp + local file fails
  2024-11-16 12:21 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-11-17 10:10   ` Jörg Sommer
  2024-11-17 10:32     ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 11+ messages in thread
From: Jörg Sommer @ 2024-11-17 10:10 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 74352

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

Michael Albinus schrieb am Sa 16. Nov, 13:21 (+0100):
> Jörg Sommer <joerg@jo-so.de> writes:
> > This change solves the problem:
> >
> > ```diff
> > diff --git lisp/vc/emerge.el lisp/vc/emerge.el
> > index ca48f2f3c7b..562041e4232 100644
> > --- lisp/vc/emerge.el
> > +++ lisp/vc/emerge.el
> > @@ -581,6 +581,7 @@ emerge-make-diff-list
> >    (setq emerge-diff-buffer (get-buffer-create "*emerge-diff*"))
> >    (with-current-buffer
> >        emerge-diff-buffer
> > +    (setq default-directory (file-name-directory file-A))
> >      (erase-buffer)
> >      (shell-command
> >       (format "%s %s %s %s"
> > ```
> 
> The point is, that emerge calls the 'diff' program for either the file
> itself (if local), or a local copy of the file (if remote). A consistent
> solution is therefore to set a local default directory, like
> 
> --8<---------------cut here---------------start------------->8---
>     (setq default-directory temporary-file-directory)
> --8<---------------cut here---------------end--------------->8---
> 
> instead of your change. Would you like to check?

This works.

But in the context of *emerge-make-diff-list* it is not very apparent why
*temporary-file-directory* is used. Maybe a comment should say that
*emerge-files-internal* copied the files there by *file-local-copy*.

> However, this won't be a complete solution. There are other places in
> emerge.el, where the temporary buffer for calling 'diff' must have a
> local default directory.

Are you sure? I see only one usage of emerge-diff-program in emerge.el.

> I'm not an emerge aficionado

Out of curiosity: Is there a better tool?



-- 
"The future is here. It's just not widely distributed yet."
                                       (William Gibson)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* bug#74352: 29.4; emerge-files with tramp + local file fails
  2024-11-17 10:10   ` Jörg Sommer
@ 2024-11-17 10:32     ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2025-01-10  8:14       ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 11+ messages in thread
From: Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-11-17 10:32 UTC (permalink / raw)
  To: Jörg Sommer; +Cc: 74352

Jörg Sommer <joerg@jo-so.de> writes:

Hi Joerg,

>> The point is, that emerge calls the 'diff' program for either the file
>> itself (if local), or a local copy of the file (if remote). A consistent
>> solution is therefore to set a local default directory, like
>> 
>> --8<---------------cut here---------------start------------->8---
>>     (setq default-directory temporary-file-directory)
>> --8<---------------cut here---------------end--------------->8---
>> 
>> instead of your change. Would you like to check?
>
> This works.
>
> But in the context of *emerge-make-diff-list* it is not very apparent why
> *temporary-file-directory* is used. Maybe a comment should say that
> *emerge-files-internal* copied the files there by *file-local-copy*.

Sure, it doesn't hurt :-)

My patch is rather a proof of concept. It could be improved in all directions.

>> However, this won't be a complete solution. There are other places in
>> emerge.el, where the temporary buffer for calling 'diff' must have a
>> local default directory.
>
> Are you sure? I see only one usage of emerge-diff-program in emerge.el.

There is also emerge-diff3-program, used in emerge-make-diff3-list.

And there are also emerge-rcs-ci-program and emerge-rcs-co-program, used
at different places. But I don't know whether they need special care.

>> I'm not an emerge aficionado
>
> Out of curiosity: Is there a better tool?

ediff-files, ediff-directories and ediff-revision. Because I use them
all days, I've rebound some keys in my .emacs:

--8<---------------cut here---------------start------------->8---
(require 'dired)
(define-key dired-mode-map "=" 'ediff-files)
(define-key dired-mode-map "\M-=" 'ediff-directories)

(require 'vc)
(define-key vc-prefix-map "=" 'ediff-revision)
(setq ediff-diff-options "-a")

(add-hook 'vc-dir-mode-hook
	  (lambda () (define-key vc-dir-mode-map "=" 'ediff-revision)))
--8<---------------cut here---------------end--------------->8---

Best regards, Michael.





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

* bug#74352: 29.4; emerge-files with tramp + local file fails
  2024-11-17 10:32     ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2025-01-10  8:14       ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2025-01-12  7:13         ` Jörg Sommer
  0 siblings, 1 reply; 11+ messages in thread
From: Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2025-01-10  8:14 UTC (permalink / raw)
  To: Jörg Sommer; +Cc: 74352

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

Hi Joerg,

>>> The point is, that emerge calls the 'diff' program for either the file
>>> itself (if local), or a local copy of the file (if remote). A consistent
>>> solution is therefore to set a local default directory, like
>>>
>>> --8<---------------cut here---------------start------------->8---
>>>     (setq default-directory temporary-file-directory)
>>> --8<---------------cut here---------------end--------------->8---
>>>
>>> instead of your change. Would you like to check?
>>
>> This works.
>>
>> But in the context of *emerge-make-diff-list* it is not very apparent why
>> *temporary-file-directory* is used. Maybe a comment should say that
>> *emerge-files-internal* copied the files there by *file-local-copy*.
>
> Sure, it doesn't hurt :-)
>
> My patch is rather a proof of concept. It could be improved in all directions.
>
>>> However, this won't be a complete solution. There are other places in
>>> emerge.el, where the temporary buffer for calling 'diff' must have a
>>> local default directory.
>>
>> Are you sure? I see only one usage of emerge-diff-program in emerge.el.
>
> There is also emerge-diff3-program, used in emerge-make-diff3-list.
>
> And there are also emerge-rcs-ci-program and emerge-rcs-co-program, used
> at different places. But I don't know whether they need special care.

I lost control. Are you still working on a patch?

Best regards, Michael.





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

* bug#74352: 29.4; emerge-files with tramp + local file fails
  2025-01-10  8:14       ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2025-01-12  7:13         ` Jörg Sommer
  2025-01-12  9:39           ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 11+ messages in thread
From: Jörg Sommer @ 2025-01-12  7:13 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 74352

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

Michael Albinus schrieb am Fr 10. Jan, 09:14 (+0100):
> Michael Albinus <michael.albinus@gmx.de> writes:
> >>> The point is, that emerge calls the 'diff' program for either the file
> >>> itself (if local), or a local copy of the file (if remote). A consistent
> >>> solution is therefore to set a local default directory, like
> >>>
> >>> --8<---------------cut here---------------start------------->8---
> >>>     (setq default-directory temporary-file-directory)
> >>> --8<---------------cut here---------------end--------------->8---
> >>>
> >>> instead of your change. Would you like to check?
> >>
> >> This works.
> >>
> >> But in the context of *emerge-make-diff-list* it is not very apparent why
> >> *temporary-file-directory* is used. Maybe a comment should say that
> >> *emerge-files-internal* copied the files there by *file-local-copy*.
> >
> > Sure, it doesn't hurt :-)
> >
> > My patch is rather a proof of concept. It could be improved in all directions.
> >
> >>> However, this won't be a complete solution. There are other places in
> >>> emerge.el, where the temporary buffer for calling 'diff' must have a
> >>> local default directory.
> >>
> >> Are you sure? I see only one usage of emerge-diff-program in emerge.el.
> >
> > There is also emerge-diff3-program, used in emerge-make-diff3-list.
> >
> > And there are also emerge-rcs-ci-program and emerge-rcs-co-program, used
> > at different places. But I don't know whether they need special care.
> 
> I lost control. Are you still working on a patch?

Hi Michael,

me, too. I was trying to setup tests and tried to extract the tramp
functions from test/lisp/net/tramp-tests.el, but got lost. I'm not so
familiar with elisp.

I saw your name on top of tramp-tests.el. Could you create for me a template
for the emerge tests, where I can add the function calls and expectations?

Such a “template” would also help me to reproduce some other bugs (in
yasnippet and magit) related to tramp.


Bye, Jörg

-- 
A valid expression in Java: x = new A().new B();

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* bug#74352: 29.4; emerge-files with tramp + local file fails
  2025-01-12  7:13         ` Jörg Sommer
@ 2025-01-12  9:39           ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2025-01-12 15:03             ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 11+ messages in thread
From: Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2025-01-12  9:39 UTC (permalink / raw)
  To: Jörg Sommer; +Cc: 74352

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

Jörg Sommer <joerg@jo-so.de> writes:

> Hi Michael,

Hi Jörg,

> I was trying to setup tests and tried to extract the tramp
> functions from test/lisp/net/tramp-tests.el, but got lost. I'm not so
> familiar with elisp.

Well, tramp-tests.el is very special, so it might be hard to extract
something. Perhaps, it is easier to inspect other test files using
Tramp. See test/README, it lists them when it comes to
$REMOTE_TEMPORARY_FILE_DIRECTORY.

> I saw your name on top of tramp-tests.el. Could you create for me a template
> for the emerge tests, where I can add the function calls and expectations?
>
> Such a “template” would also help me to reproduce some other bugs (in
> yasnippet and magit) related to tramp.

I've added a short version of emerge-tests.el I've just written from
scratch. I don't know emerge.el in detail, so I have done the checks
naïvely. You will use your own logic.

The heart of this is the existence of ert-remote-temporary-file-directory.
We cannot write Tramp tests with real remote hosts, this wouldn't be a
generic solution. Therefore, this variable provides a mock-up "remote"
directory "/mock::/tmp/", which can be used. If you want to test with a
real remote host, set the environmen variable
REMOTE_TEMPORARY_FILE_DIRECTORY like

--8<---------------cut here---------------start------------->8---
# env REMOTE_TEMPORARY_FILE_DIRECTORY=/ssh:somewhere:/tmp \
    make -C test emerge-test
--8<---------------cut here---------------end--------------->8---

In case of any problem, just ask!

> Bye, Jörg

Best regards, Michael.


[-- Attachment #2: emerge-tests.el --]
[-- Type: text/plain, Size: 2191 bytes --]

;;; emerge-tests.el --- Tests of shadowfile  -*- lexical-binding:t -*-

(require 'tramp)
(require 'ert-x)
(require 'emerge)

(setq auth-source-save-behavior nil
      password-cache-expiry nil
      ;; When the remote user id is 0, Tramp refuses unsafe temporary files.
      tramp-allow-unsafe-temporary-files
      (or tramp-allow-unsafe-temporary-files noninteractive)
      tramp-cache-read-persistent-data t ;; For auth-sources.
      tramp-persistency-file-name nil
      tramp-verbose 0
      ;; On macOS, `temporary-file-directory' is a symlinked directory.
      temporary-file-directory (file-truename temporary-file-directory)
      ert-remote-temporary-file-directory
      (ignore-errors (file-truename ert-remote-temporary-file-directory)))

(ert-deftest emerge-test-files ()
  "Check emerge for two files."
  (skip-when (memq system-type '(windows-nt ms-dos)))
  (skip-unless (file-remote-p ert-remote-temporary-file-directory))

  (let (;; Remote file.
        (file1
	 (make-temp-name
	  (expand-file-name "emerge-tests" ert-remote-temporary-file-directory)))
        ;; Local file.
	(file2
	 (make-temp-name
	  (expand-file-name "emerge-tests" temporary-file-directory)))
        ;; Output.
        (file3
	 (make-temp-name
	  (expand-file-name "emerge-tests" temporary-file-directory))))

    (unwind-protect
        (progn
          ;; Write initial text.
          (write-region "foo" nil file1)
          (write-region "foo" nil file2)

          ;; Run emerge.
          (should (emerge-files nil file1 file2 file3))
	  (cl-letf (((symbol-function #'y-or-n-p) #'always))
            (emerge-quit nil))

          ;; Check result.
          (with-temp-buffer
            (insert-file-contents file3)
            (should (string-equal "foo" (buffer-string)))))

      ;; Cleanup.
      (ignore-errors (delete-file file1))
      (ignore-errors (delete-file file2))
      (ignore-errors (delete-file file3)))))

(defun emerge-test-all (&optional interactive)
  "Run all tests for `emerge-*'."
  (interactive "p")
  (if interactive
      (ert-run-tests-interactively "^emerge-")
    (ert-run-tests-batch "^emerge-")))

(provide 'emerge-tests)
;;; emerge-tests.el ends here

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

* bug#74352: 29.4; emerge-files with tramp + local file fails
  2025-01-12  9:39           ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2025-01-12 15:03             ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 11+ messages in thread
From: Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2025-01-12 15:03 UTC (permalink / raw)
  To: Jörg Sommer; +Cc: 74352

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

Hi Jörg,

> In case of any problem, just ask!

Another point. I've just checked the status of copyright assignment at
FSF. It looks like you haven't signed (yet) an agreement, to copyright
your contributions to FSF.

It might be not a problem for your changes in emerge.el (minor changes
are accepted w/o such an assignment). But for emerge-tests.el, this
won't work.

Are you willing to assign your copyright to the FSF for your
contributions to Emacs?

Best regards, Michael.





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

end of thread, other threads:[~2025-01-12 15:03 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-13 19:11 bug#74352: 29.4; emerge-files with tramp + local file fails Jörg Sommer
2024-11-14  7:05 ` Eli Zaretskii
2024-11-14 17:27   ` Jörg Sommer
2024-11-14  8:10 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-16 12:21 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-17 10:10   ` Jörg Sommer
2024-11-17 10:32     ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2025-01-10  8:14       ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2025-01-12  7:13         ` Jörg Sommer
2025-01-12  9:39           ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2025-01-12 15:03             ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors

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