From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Paul Pogonyshev Newsgroups: gmane.emacs.bugs Subject: bug#57800: TRAMP insert-file-contents now fails for regions Date: Wed, 14 Sep 2022 14:11:00 +0200 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000005b708205e8a20614" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17456"; mail-complaints-to="usenet@ciao.gmane.io" To: 57800@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Sep 14 15:13:03 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oYSCM-0004Jo-Lf for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 14 Sep 2022 15:13:02 +0200 Original-Received: from localhost ([::1]:39008 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oYSCL-0003nK-Ga for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 14 Sep 2022 09:13:01 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45816) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oYRFL-0003b3-F2 for bug-gnu-emacs@gnu.org; Wed, 14 Sep 2022 08:12:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:37083) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oYRFK-00043N-Q6 for bug-gnu-emacs@gnu.org; Wed, 14 Sep 2022 08:12:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oYRFK-0007um-C5 for bug-gnu-emacs@gnu.org; Wed, 14 Sep 2022 08:12:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Paul Pogonyshev Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 14 Sep 2022 12:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 57800 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.166315747930364 (code B ref -1); Wed, 14 Sep 2022 12:12:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 14 Sep 2022 12:11:19 +0000 Original-Received: from localhost ([127.0.0.1]:54015 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oYREc-0007tf-Ky for submit@debbugs.gnu.org; Wed, 14 Sep 2022 08:11:18 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:59892) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oYREb-0007tY-CP for submit@debbugs.gnu.org; Wed, 14 Sep 2022 08:11:17 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49070) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oYREa-0002gB-Ly for bug-gnu-emacs@gnu.org; Wed, 14 Sep 2022 08:11:16 -0400 Original-Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]:45980) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oYREY-0003tS-Rt for bug-gnu-emacs@gnu.org; Wed, 14 Sep 2022 08:11:16 -0400 Original-Received: by mail-ej1-x62c.google.com with SMTP id dv25so34161696ejb.12 for ; Wed, 14 Sep 2022 05:11:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date; bh=aeYOGzFKcwe4TYdkuhyJ0Ro2PsWHr99gcshRt3kTYkc=; b=KigwxUIwglHQol/MWZY3LGYxHmFdy+cXo2oFh2xlOYBXjG6fGsK5mH1koqk/uCMgUg WUmKtZ+/xu/TYiuVKw7T9yCMp3sTgtuo9QVn1Xube0ZgHL3pQ7K2JKSAA4QR+jvQ/MzM M6V1Pryq79F2CLmsJEOvyMAWl1v4csx4h5hg/YiGd4e5AXKhdGa2W5w27j4z3ri3o7F0 mHqOj7kquD+JICg7iY8HZHtZ2uh0ZJ9EdUwVVldt6VJUehYNoC7lV3voD5uh9MW1LJGg kapoXS8gxPunTbFRZsPCRjjJwXfbcNx9r/HnEdGknuC/6tPV3Dt/ez4/sAgqHtDr9mu4 +lpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date; bh=aeYOGzFKcwe4TYdkuhyJ0Ro2PsWHr99gcshRt3kTYkc=; b=RDV5uPFmsETtW5vGdFbrRQPWYoeVFlxQxBvhYm5poCXIjEqXmTg/ZOOrQiefZxLfgy ubTTz19+ZgtJ9nJn32M6KDnQM5pcFpyIcvwA+3uKhfQtEl4CUaO062dbaXsCFgAz3TRP buvKORTAbZrosFSvcOJzdGEIpyMMiTndrPj/L3WbbJKN/20kYegJhuLSLtfs5iH+Wtpx Bhj/yvmhoc5B+XNCze0DP6mzGZz9gXP73QscVuTbLQ5dFq/neWA4VudjTumXoMzU6usd oduevLcZx1Svazpg2WxRO6mg6VT07fWLEkRhDvm03UkdC8812GDcYWnx2BPM/AoVrBWS 1euQ== X-Gm-Message-State: ACgBeo3MoSHC+16IbxcSXXTYvVN1v9O4+jsaEOW6+4DyhvhHMzL56E+V 6JXroyHhQx8u9kKX9wpludeH/08BxtzkQO3VTJ70Mxg5dg== X-Google-Smtp-Source: AA6agR78nZPwbtf2k1ipfIm4pJ3o2mcfpeBpQLVaNglgM09W0AUwBryJTGa7GQPH+Wcg4xy4+9L/Kb5cQiGkXDYQJmU= X-Received: by 2002:a17:907:7b95:b0:731:113a:d7a2 with SMTP id ne21-20020a1709077b9500b00731113ad7a2mr24491630ejc.377.1663157472553; Wed, 14 Sep 2022 05:11:12 -0700 (PDT) Received-SPF: pass client-ip=2a00:1450:4864:20::62c; envelope-from=pogonyshev@gmail.com; helo=mail-ej1-x62c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:242452 Archived-At: --0000000000005b708205e8a20614 Content-Type: text/plain; charset="UTF-8" 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 --0000000000005b708205e8a20614 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Git commit fd1ee05977.

Open any fil= e with TRAMP. From this buffer, evaluate:

=C2=A0 = =C2=A0 (let ((file buffer-file-name)) (with-temp-buffer (insert-file-conten= ts file nil)))

This works fine. However, if yo= u use a region:

=C2=A0 =C2=A0 (let ((file buffer-f= ile-name)) (with-temp-buffer (insert-file-contents file nil 1 10)))

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

=C2=A0 =C2=A0 Debugger entered--Li= sp error: (file-missing "/ssh:...")
=C2=A0 =C2=A0 =C2=A0 signa= l(file-missing ("/ssh:..."))
=C2=A0 =C2=A0 =C2=A0 tramp-error(= (tramp-file-name "ssh" "..." nil "..." "= ..." "..." nil) file-missing "/ssh:...")
=C2=A0= =C2=A0 =C2=A0 tramp-handle-insert-file-contents("/ssh:..." nil 1= 10 nil)
=C2=A0 =C2=A0 =C2=A0 apply(tramp-handle-insert-file-contents (&= quot;/ssh:..." nil 1 10 nil))
=C2=A0 =C2=A0 =C2=A0 tramp-sh-file-na= me-handler(insert-file-contents "/ssh:..." nil 1 10 nil)
=C2= =A0 =C2=A0 =C2=A0 apply(tramp-sh-file-name-handler insert-file-contents (&q= uot;/ssh:..." nil 1 10 nil))
=C2=A0 =C2=A0 =C2=A0 tramp-file-name-h= andler(insert-file-contents "/ssh:..." nil 1 10 nil)
=C2=A0 = =C2=A0 =C2=A0 insert-file-contents("/ssh:..." nil 1 10)
=C2=A0= =C2=A0 =C2=A0 (progn (insert-file-contents file nil 1 10))
<= br>
Please add some automated tests for this.

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

Paul
--0000000000005b708205e8a20614--