Subject: bug#57800: closed (Re: bug#57800: TRAMP insert-file-contents now fails for regions)

From: [email-masked] (GNU bug Tracking System)
Date: Fri, 30 Sep 2022 19:59:02 +0000

Your bug report

#57800: TRAMP insert-file-contents now fails for regions

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
57800: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=57800
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#57800: TRAMP insert-file-contents now fails for regions
From: Michael Albinus <[email-masked]>
To: Paul Pogonyshev <[email-masked]>
Cc: [email-masked], Lars Ingebrigtsen <[email-masked]>
Date: Fri, 30 Sep 2022 21:58:35 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Version: 29.1

Michael Albinus <[email-masked]> writes:

Hi Paul,

>> Yes, that fixes the problem. Does that mean I somehow have a mixup of
>> sources from different commits (not sure how) or that the cache is
>> persistent and can survive long times? Note that I also run Emacs 28
>> from time to time. Could it be that 29 reuses cache created by 28 that
>> contains no-longer-compatible values?
>
> Could be the latter, yes. "tmpdir" is the only cache value I know of
> which has changed its meaning(*). Perhaps I shall add a test that it
> ignores cached "tmpdir" values if they are remote. But hmm, it has
> changed its meaning also in Tramp 2.5.3.2, which is distributed via GNU
> ELPA.

Pushed this change to the emacs-28 branch, it will appear in the master
branch after merge.

It will also be contained in the upcoming Tramp 2.5.3.4 on GNU
ELPA. Closing the bug.

>> Paul

Best regards, Michael.

Subject: TRAMP insert-file-contents now fails for regions
From: Paul Pogonyshev <[email-masked]>
To: [email-masked]
Date: Wed, 14 Sep 2022 14:11:00 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Git commit fd1ee05977.

Open any file with TRAMP. From this buffer, evaluate:

    (let ((file buffer-file-name)) (with-temp-buffer (insert-file-contents
file nil)))

This works fine. However, if you use a region:

    (let ((file buffer-file-name)) (with-temp-buffer (insert-file-contents
file nil 1 10)))

this fails with an obviously wrong (file is certainly there) signal:

    Debugger entered--Lisp error: (file-missing "/ssh:...")
      signal(file-missing ("/ssh:..."))
      tramp-error((tramp-file-name "ssh" "..." nil "..." "..." "..." nil)
file-missing "/ssh:...")
      tramp-handle-insert-file-contents("/ssh:..." nil 1 10 nil)
      apply(tramp-handle-insert-file-contents ("/ssh:..." nil 1 10 nil))
      tramp-sh-file-name-handler(insert-file-contents "/ssh:..." nil 1 10
nil)
      apply(tramp-sh-file-name-handler insert-file-contents ("/ssh:..." nil
1 10 nil))
      tramp-file-name-handler(insert-file-contents "/ssh:..." nil 1 10 nil)
      insert-file-contents("/ssh:..." nil 1 10)
      (progn (insert-file-contents file nil 1 10))

Please add some automated tests for this.

Also, when a command fails with `file-missing' signal, Emacs UI only prints
the filename, as that seems to be the signal data. From user point of view
that says nothing. You can only understand what's wrong (even if this is
not a bug, as above) by setting `debug-on-error' to t, which is extremely
user-unfriendly.

Paul