GNU bug report logs - #42431
28.0.50; browse-url-of-dired-file confusing messaging

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Lars Ingebrigtsen <larsi@HIDDEN>; merged with #42433; dated Sun, 19 Jul 2020 19:35:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Merged 42431 42433. Request was from Lars Ingebrigtsen <larsi@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 42431 <at> debbugs.gnu.org:


Received: (at 42431) by debbugs.gnu.org; 9 Aug 2020 14:09:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Aug 09 10:09:11 2020
Received: from localhost ([127.0.0.1]:33218 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1k4m0d-0003mO-NC
	for submit <at> debbugs.gnu.org; Sun, 09 Aug 2020 10:09:11 -0400
Received: from quimby.gnus.org ([95.216.78.240]:36746)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1k4m0b-0003mB-JA
 for 42431 <at> debbugs.gnu.org; Sun, 09 Aug 2020 10:09:10 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=XsqF/diiQKbqo1nOwGOCb7+jMOQCS5zD2zAdiSdsxFw=; b=i4Q+tz/+B8sOCw8yfTEPTPbMw/
 kFsZheVNeTgg4jPvZxKr4YfWivoh7CXGUPiijTnPUmZimtEy63BWLvvD8Y6YX27J586M2U0CyifVI
 IDMLxGQSef5QlMEQ1QizSAMEznn/bduYMNclO6taI2gU4+QAGmJ6V7o7g7rJvrep1QK0=;
Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo)
 by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1k4m0R-0002nI-RF; Sun, 09 Aug 2020 16:09:02 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#42431: 28.0.50; browse-url-of-dired-file confusing messaging
References: <87v9ijl2ol.fsf@HIDDEN> <87blk04mw8.fsf@HIDDEN>
 <83eeoh7f68.fsf@HIDDEN> <87a6z55u7j.fsf@HIDDEN>
 <83y2mp5te0.fsf@HIDDEN> <87pn80w49u.fsf@HIDDEN>
 <87lfiow3tq.fsf@HIDDEN> <83h7tb6hk5.fsf@HIDDEN>
Date: Sun, 09 Aug 2020 16:08:58 +0200
In-Reply-To: <83h7tb6hk5.fsf@HIDDEN> (Eli Zaretskii's message of "Sun, 09 Aug
 2020 17:05:14 +0300")
Message-ID: <878senewsl.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: Eli Zaretskii <eliz@HIDDEN> writes: > Of course. And that's
 exactly what I meant when I suggested to > convert the file:// URL to a local
 file name, before calling > insert-file-contents. If we do that, the problem
 should go away. Or > [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 42431
Cc: eggert@HIDDEN, michael.albinus@HIDDEN, 42431 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Eli Zaretskii <eliz@HIDDEN> writes:

> Of course.  And that's exactly what I meant when I suggested to
> convert the file:// URL to a local file name, before calling
> insert-file-contents.  If we do that, the problem should go away.  Or
> am I missing something?

I just thought all of this was supposed to work without doing any
mangling of the "file name" -- in this case it's an URL, but presumably
there are other file handlers for non-file stuff that Emacs treats are
files that have the same problem.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#42431; Package emacs. Full text available.

Message received at 42431 <at> debbugs.gnu.org:


Received: (at 42431) by debbugs.gnu.org; 9 Aug 2020 14:05:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Aug 09 10:05:41 2020
Received: from localhost ([127.0.0.1]:33209 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1k4lxE-0003gp-V2
	for submit <at> debbugs.gnu.org; Sun, 09 Aug 2020 10:05:41 -0400
Received: from eggs.gnu.org ([209.51.188.92]:33574)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1k4lxD-0003gd-AZ
 for 42431 <at> debbugs.gnu.org; Sun, 09 Aug 2020 10:05:39 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:60289)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1k4lx7-0001kA-2L; Sun, 09 Aug 2020 10:05:33 -0400
Received: from [176.228.60.248] (port=1434 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1k4lx4-0000Ir-AR; Sun, 09 Aug 2020 10:05:32 -0400
Date: Sun, 09 Aug 2020 17:05:14 +0300
Message-Id: <83h7tb6hk5.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
In-Reply-To: <87lfiow3tq.fsf@HIDDEN> (message from Lars Ingebrigtsen on Sun, 
 09 Aug 2020 11:45:05 +0200)
Subject: Re: bug#42431: 28.0.50; browse-url-of-dired-file confusing messaging
References: <87v9ijl2ol.fsf@HIDDEN> <87blk04mw8.fsf@HIDDEN>
 <83eeoh7f68.fsf@HIDDEN> <87a6z55u7j.fsf@HIDDEN>
 <83y2mp5te0.fsf@HIDDEN> <87pn80w49u.fsf@HIDDEN> <87lfiow3tq.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 42431
Cc: eggert@HIDDEN, michael.albinus@HIDDEN, 42431 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Lars Ingebrigtsen <larsi@HIDDEN>
> Cc: michael.albinus@HIDDEN,  42431 <at> debbugs.gnu.org, Paul Eggert
>  <eggert@HIDDEN>
> Date: Sun, 09 Aug 2020 11:45:05 +0200
> 
> Lars Ingebrigtsen <larsi@HIDDEN> writes:
> 
> > It would be, but I think this points to an error in insert-file-contents
> > itself.  I'll poke around some more...
> 
> Yup.  The error signalling comes from Finsert_file_contents.  If I make
> this change, then the confusing messaging goes away:
> 
> diff --git a/src/fileio.c b/src/fileio.c
> index 37072d9b6b..05e262b201 100644
> --- a/src/fileio.c
> +++ b/src/fileio.c
> @@ -4826,7 +4826,6 @@ because (1) it preserves some marker positions and (2) it puts less data
>    if (!NILP (visit) && current_buffer->modtime.tv_nsec < 0)
>      {
>        /* Signal an error if visiting a file that could not be opened.  */
> -      report_file_errno ("Opening input file", orig_filename, save_errno);
>      }
>  

Of course.  And that's exactly what I meant when I suggested to
convert the file:// URL to a local file name, before calling
insert-file-contents.  If we do that, the problem should go away.  Or
am I missing something?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#42431; Package emacs. Full text available.

Message received at 42431 <at> debbugs.gnu.org:


Received: (at 42431) by debbugs.gnu.org; 9 Aug 2020 09:45:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Aug 09 05:45:24 2020
Received: from localhost ([127.0.0.1]:59959 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1k4htM-0008SZ-0x
	for submit <at> debbugs.gnu.org; Sun, 09 Aug 2020 05:45:24 -0400
Received: from quimby.gnus.org ([95.216.78.240]:34070)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1k4htK-0008SK-0j
 for 42431 <at> debbugs.gnu.org; Sun, 09 Aug 2020 05:45:23 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=6KzGyM6OHLj14fm1IhmqrSfITpt1126KMyAq0mgsLJY=; b=KSeGta67/GrF0uP84XbIP0lQeX
 8anG0tRLcAJT0x6Jx4Vgj/Vk2AEgt7BBdAX/aB8iH1rULBYbA/HA9C3diE1gjz1lgcgP6P051cBF9
 MKLcxpl9U1OiJVD4/ywRwjR9RFPGXv3b1O+1F/kvEjaFYL21KGmS2EWzzq2CsitDc7Io=;
Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo)
 by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1k4ht4-0000DR-M1; Sun, 09 Aug 2020 11:45:15 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#42431: 28.0.50; browse-url-of-dired-file confusing messaging
References: <87v9ijl2ol.fsf@HIDDEN> <87blk04mw8.fsf@HIDDEN>
 <83eeoh7f68.fsf@HIDDEN> <87a6z55u7j.fsf@HIDDEN>
 <83y2mp5te0.fsf@HIDDEN> <87pn80w49u.fsf@HIDDEN>
Date: Sun, 09 Aug 2020 11:45:05 +0200
In-Reply-To: <87pn80w49u.fsf@HIDDEN> (Lars Ingebrigtsen's message of "Sun,
 09 Aug 2020 11:35:25 +0200")
Message-ID: <87lfiow3tq.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview:  Lars Ingebrigtsen <larsi@HIDDEN> writes: > It would be,
 but I think this points to an error in insert-file-contents > itself. I'll
 poke around some more... Yup. The error signalling comes from
 Finsert_file_contents.
 If I make this change, then the confusing messaging goes away: 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 42431
Cc: Paul Eggert <eggert@HIDDEN>, michael.albinus@HIDDEN,
 42431 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Lars Ingebrigtsen <larsi@HIDDEN> writes:

> It would be, but I think this points to an error in insert-file-contents
> itself.  I'll poke around some more...

Yup.  The error signalling comes from Finsert_file_contents.  If I make
this change, then the confusing messaging goes away:

diff --git a/src/fileio.c b/src/fileio.c
index 37072d9b6b..05e262b201 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -4826,7 +4826,6 @@ because (1) it preserves some marker positions and (2) it puts less data
   if (!NILP (visit) && current_buffer->modtime.tv_nsec < 0)
     {
       /* Signal an error if visiting a file that could not be opened.  */
-      report_file_errno ("Opening input file", orig_filename, save_errno);
     }
 
   /* We made a lot of deletions and insertions above, so invalidate

This was apparently introduced/changed in 2019 by this patch:

commit 3a1e7624ed234bb434cdafed59515cadd037cafa
Author:     Paul Eggert <eggert@HIDDEN>
AuthorDate: Thu Oct 31 23:31:17 2019 -0700
Commit:     Paul Eggert <eggert@HIDDEN>
CommitDate: Thu Oct 31 23:32:05 2019 -0700

    Fix insert-file-contents file error regression
    
    Problem reported for dired-view-file (Bug#37950).
    * src/fileio.c (Finsert_file_contents): When visiting,
    signal an error if the file could not be opened for any reason,
    rather than signaling an error only for nonexistent files, fixing
    a bug introduced in 2019-09-16T03:17:43!eggert@HIDDEN

I've Cc'd Paul on this.  Paul, the test case is:

(browse-url-of-file "/tmp/a.txt")

This will open the file correctly (via the url-file-handler file name
handler), but Emacs will then message "File exists, but cannot be read"
because Finsert_file_contents signals an error with the error message
"Success".

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#42431; Package emacs. Full text available.

Message received at 42431 <at> debbugs.gnu.org:


Received: (at 42431) by debbugs.gnu.org; 9 Aug 2020 09:35:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Aug 09 05:35:41 2020
Received: from localhost ([127.0.0.1]:59954 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1k4hjx-0008ES-0n
	for submit <at> debbugs.gnu.org; Sun, 09 Aug 2020 05:35:41 -0400
Received: from quimby.gnus.org ([95.216.78.240]:33772)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1k4hjv-0008ED-Gb
 for 42431 <at> debbugs.gnu.org; Sun, 09 Aug 2020 05:35:40 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=8lDInASbcd/0c7DzTyTNF2dss7rjeXIpL4Pcx/6zEzY=; b=MXTpo7qWqw2byVBnAm18wHWGIs
 O0/IqBiBAICgVH7LSDIEKxpcPfcCMa3apee8qeFVU2QIx01WsUH8Hk1V6fpL88BR4GmvztduAgIt8
 nxLy8rOg577igFxPcouevwMD6nYS5FxQIi3MCi2BuRa2o71E6AlnVP/r+s9LHMr3LcEQ=;
Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo)
 by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1k4hji-0008WS-PM; Sun, 09 Aug 2020 11:35:32 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#42431: 28.0.50; browse-url-of-dired-file confusing messaging
References: <87v9ijl2ol.fsf@HIDDEN> <87blk04mw8.fsf@HIDDEN>
 <83eeoh7f68.fsf@HIDDEN> <87a6z55u7j.fsf@HIDDEN>
 <83y2mp5te0.fsf@HIDDEN>
Date: Sun, 09 Aug 2020 11:35:25 +0200
In-Reply-To: <83y2mp5te0.fsf@HIDDEN> (Eli Zaretskii's message of "Sat, 08 Aug
 2020 13:22:47 +0300")
Message-ID: <87pn80w49u.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: Eli Zaretskii <eliz@HIDDEN> writes: >> From: Lars
 Ingebrigtsen
 <larsi@HIDDEN> >> Cc: michael.albinus@HIDDEN, 42431 <at> debbugs.gnu.org >>
 Date: Sat, 08 Aug 2020 12:05:04 +0200 >> >> >> (condition-case () >> >> (let
 ((inhibit-read-only t)) [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 42431
Cc: michael.albinus@HIDDEN, 42431 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Eli Zaretskii <eliz@HIDDEN> writes:

>> From: Lars Ingebrigtsen <larsi@HIDDEN>
>> Cc: michael.albinus@HIDDEN,  42431 <at> debbugs.gnu.org
>> Date: Sat, 08 Aug 2020 12:05:04 +0200
>> 
>> >> 	  (condition-case ()
>> >> 	      (let ((inhibit-read-only t))
>> >> 		(insert-file-contents-literally filename t))
>> >> 	    (file-error
>> >> 	     (when (and (file-exists-p filename)
>> >> 			(not (file-readable-p filename)))
>> >> 	       (kill-buffer buf)
>> >> 	       (signal 'file-error (list "File is not readable"
>> >> 					 filename)))
>> >
>> > Is this because file-readable-p returns nil for file:// URLs?
>> 
>> That's the direct cause of the message, but the underlying reason is
>> that insert-file-contents-literally signalled a file-error here (after
>> inserting the contents).  I haven't yet chased down why.

My analysis here was kinda wrong -- the code above isn't what gives the
warning, because all those functions up there do the right thing, since
file-name-handler-alist is set:

  (let ((file-name-handler-alist
         (cons (cons url-handler-regexp 'url-file-handler)
               file-name-handler-alist)))
    (list (file-exists-p "file:///tmp/a.txt")
	  (file-readable-p "file:///tmp/a.txt")))
=> (t t)

The problem is that insert-file-contents signals a file-error, and the
error string is "Success".  This makes things confused, because it knows
that it has an error, but when it tests for all things that could go
wrong, it doesn't find anything, and ends up here:

(defun after-find-file (&optional error warn noauto
				  _after-find-file-from-revert-buffer
				  nomodes)
[...]
	     ((and error (file-attributes buffer-file-name))
	      (setq buffer-read-only t)
	      (if (and (file-symlink-p buffer-file-name)
		       (not (file-exists-p
			     (file-chase-links buffer-file-name))))
		  "Symbolic link that points to nonexistent file"
		"File exists, but cannot be read"))

Which is where the message itself comes from.

> So one solution would be to convert file:// URLs into local file names
> in the above snippet, before calling insert-file-contents-literally.

It would be, but I think this points to an error in insert-file-contents
itself.  I'll poke around some more...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#42431; Package emacs. Full text available.

Message received at 42431 <at> debbugs.gnu.org:


Received: (at 42431) by debbugs.gnu.org; 8 Aug 2020 10:23:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 08 06:23:01 2020
Received: from localhost ([127.0.0.1]:58173 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1k4M0D-0006ew-8F
	for submit <at> debbugs.gnu.org; Sat, 08 Aug 2020 06:23:01 -0400
Received: from eggs.gnu.org ([209.51.188.92]:54754)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1k4M0B-0006ek-N0
 for 42431 <at> debbugs.gnu.org; Sat, 08 Aug 2020 06:23:00 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:44625)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1k4M06-0007qS-0G; Sat, 08 Aug 2020 06:22:54 -0400
Received: from [176.228.60.248] (port=3290 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1k4M05-0002T4-IV; Sat, 08 Aug 2020 06:22:53 -0400
Date: Sat, 08 Aug 2020 13:22:47 +0300
Message-Id: <83y2mp5te0.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
In-Reply-To: <87a6z55u7j.fsf@HIDDEN> (message from Lars Ingebrigtsen on Sat, 
 08 Aug 2020 12:05:04 +0200)
Subject: Re: bug#42431: 28.0.50; browse-url-of-dired-file confusing messaging
References: <87v9ijl2ol.fsf@HIDDEN> <87blk04mw8.fsf@HIDDEN>
 <83eeoh7f68.fsf@HIDDEN> <87a6z55u7j.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 42431
Cc: michael.albinus@HIDDEN, 42431 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Lars Ingebrigtsen <larsi@HIDDEN>
> Cc: michael.albinus@HIDDEN,  42431 <at> debbugs.gnu.org
> Date: Sat, 08 Aug 2020 12:05:04 +0200
> 
> >> 	  (condition-case ()
> >> 	      (let ((inhibit-read-only t))
> >> 		(insert-file-contents-literally filename t))
> >> 	    (file-error
> >> 	     (when (and (file-exists-p filename)
> >> 			(not (file-readable-p filename)))
> >> 	       (kill-buffer buf)
> >> 	       (signal 'file-error (list "File is not readable"
> >> 					 filename)))
> >
> > Is this because file-readable-p returns nil for file:// URLs?
> 
> That's the direct cause of the message, but the underlying reason is
> that insert-file-contents-literally signalled a file-error here (after
> inserting the contents).  I haven't yet chased down why.

I guess that's because expand-file-name doesn't convert file:// URLs
into local file names, and then insert-file-contents chokes on the
value produced by expand-file-name.  (insert-file-contents-literally
is just a thin wrapper around insert-file-contents.)

So one solution would be to convert file:// URLs into local file names
in the above snippet, before calling insert-file-contents-literally.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#42431; Package emacs. Full text available.

Message received at 42431 <at> debbugs.gnu.org:


Received: (at 42431) by debbugs.gnu.org; 8 Aug 2020 10:05:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 08 06:05:16 2020
Received: from localhost ([127.0.0.1]:58153 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1k4Lj2-0006Fq-8R
	for submit <at> debbugs.gnu.org; Sat, 08 Aug 2020 06:05:16 -0400
Received: from quimby.gnus.org ([95.216.78.240]:49836)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1k4Lj0-0006FQ-Dd
 for 42431 <at> debbugs.gnu.org; Sat, 08 Aug 2020 06:05:14 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=/zR4vr58A2P8o5Owl/SOMrdyKjUSx9guFMEEyQG+IS0=; b=A/85yVKl+tGQTLfsu2QclrHL8I
 zRBDFYbRbxV8mn7ngy21vjZPfLWk+6ZjyjpsgWqTwhxFgmDj+kppPasR+ulpUEoi2jP9fM+InKTaS
 obI7O9+w+xLaaZDm4aPlB6e86RUrvhAHZb1lOH7Vxi/9xCcIl2grAriPwkflH9Eo2064=;
Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo)
 by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1k4Lis-0002og-3z; Sat, 08 Aug 2020 12:05:08 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#42431: 28.0.50; browse-url-of-dired-file confusing messaging
References: <87v9ijl2ol.fsf@HIDDEN> <87blk04mw8.fsf@HIDDEN>
 <83eeoh7f68.fsf@HIDDEN>
Date: Sat, 08 Aug 2020 12:05:04 +0200
In-Reply-To: <83eeoh7f68.fsf@HIDDEN> (Eli Zaretskii's message of "Sat, 08 Aug
 2020 10:46:55 +0300")
Message-ID: <87a6z55u7j.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: Eli Zaretskii <eliz@HIDDEN> writes: >> (defun
 find-file-noselect-1
 (buf filename nowarn rawfile truename number) >> >> [...] >> >>
 (condition-case
 () >> (let ((inhibit-read-only t)) >> (insert-file-contents-literally filename
 t)) >> (fi [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 42431
Cc: michael.albinus@HIDDEN, 42431 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Eli Zaretskii <eliz@HIDDEN> writes:

>> (defun find-file-noselect-1 (buf filename nowarn rawfile truename number)
>> 
>> [...]
>> 
>> 	  (condition-case ()
>> 	      (let ((inhibit-read-only t))
>> 		(insert-file-contents-literally filename t))
>> 	    (file-error
>> 	     (when (and (file-exists-p filename)
>> 			(not (file-readable-p filename)))
>> 	       (kill-buffer buf)
>> 	       (signal 'file-error (list "File is not readable"
>> 					 filename)))
>
> Is this because file-readable-p returns nil for file:// URLs?

That's the direct cause of the message, but the underlying reason is
that insert-file-contents-literally signalled a file-error here (after
inserting the contents).  I haven't yet chased down why.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#42431; Package emacs. Full text available.

Message received at 42431 <at> debbugs.gnu.org:


Received: (at 42431) by debbugs.gnu.org; 8 Aug 2020 07:47:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 08 03:47:11 2020
Received: from localhost ([127.0.0.1]:57977 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1k4JZO-0006kL-ME
	for submit <at> debbugs.gnu.org; Sat, 08 Aug 2020 03:47:11 -0400
Received: from eggs.gnu.org ([209.51.188.92]:58480)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1k4JZI-0006ji-L4
 for 42431 <at> debbugs.gnu.org; Sat, 08 Aug 2020 03:47:08 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:43377)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1k4JZC-0007wf-Pt; Sat, 08 Aug 2020 03:46:58 -0400
Received: from [176.228.60.248] (port=3879 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1k4JZB-0007Tn-P6; Sat, 08 Aug 2020 03:46:58 -0400
Date: Sat, 08 Aug 2020 10:46:55 +0300
Message-Id: <83eeoh7f68.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
In-Reply-To: <87blk04mw8.fsf@HIDDEN> (message from Lars Ingebrigtsen on Tue, 
 28 Jul 2020 00:24:23 +0200)
Subject: Re: bug#42431: 28.0.50; browse-url-of-dired-file confusing messaging
References: <87v9ijl2ol.fsf@HIDDEN> <87blk04mw8.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 42431
Cc: michael.albinus@HIDDEN, 42431 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Lars Ingebrigtsen <larsi@HIDDEN>
> Date: Tue, 28 Jul 2020 00:24:23 +0200
> Cc: Michael Albinus <michael.albinus@HIDDEN>
> 
> (browse-url-of-file "/tmp/a.txt")
> 
> The message originates from here, sort of:
> 
> (defun find-file-noselect-1 (buf filename nowarn rawfile truename number)
> 
> [...]
> 
> 	  (condition-case ()
> 	      (let ((inhibit-read-only t))
> 		(insert-file-contents-literally filename t))
> 	    (file-error
> 	     (when (and (file-exists-p filename)
> 			(not (file-readable-p filename)))
> 	       (kill-buffer buf)
> 	       (signal 'file-error (list "File is not readable"
> 					 filename)))

Is this because file-readable-p returns nil for file:// URLs?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#42431; Package emacs. Full text available.

Message received at 42431 <at> debbugs.gnu.org:


Received: (at 42431) by debbugs.gnu.org; 27 Jul 2020 22:24:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jul 27 18:24:43 2020
Received: from localhost ([127.0.0.1]:55968 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1k0BY3-0002tH-5W
	for submit <at> debbugs.gnu.org; Mon, 27 Jul 2020 18:24:43 -0400
Received: from quimby.gnus.org ([95.216.78.240]:55566)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1k0BY0-0002t1-Ep
 for 42431 <at> debbugs.gnu.org; Mon, 27 Jul 2020 18:24:41 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=nweyqw9zItZIsEL1jobdxDUTu+6geW59+lBmA+EFbbY=; b=XyFifleLKdPf+4a5Xbj1CbY7z7
 PgW23L2sMYzZrDBhpYPKe9LV9PDCurPuuAQdbPTEV08EZ5vrkvdIL8ZX0Cb9JRPSFzBOYbtsxWOdV
 AlpJJbbhU2k3pnv50G45ZYlTiEzTHBC0D75t8ag8vfLf2XmtAh+09MmSxWR2Kv9780e0=;
Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo)
 by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1k0BXl-0005UO-FP; Tue, 28 Jul 2020 00:24:34 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: 42431 <at> debbugs.gnu.org
Subject: Re: bug#42431: 28.0.50; browse-url-of-dired-file confusing messaging
References: <87v9ijl2ol.fsf@HIDDEN>
Date: Tue, 28 Jul 2020 00:24:23 +0200
In-Reply-To: <87v9ijl2ol.fsf@HIDDEN> (Lars Ingebrigtsen's message of "Sun,
 19 Jul 2020 21:34:02 +0200")
Message-ID: <87blk04mw8.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview:  Lars Ingebrigtsen <larsi@HIDDEN> writes: > Create a file
 /tmp/a.txt, and visit /tmp. > M-x browse-url-of-dired-file on the file. >
 > Emacs will say: > > File exists, but cannot be read > > and then display
 the file in a text-mode buffer. 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 42431
Cc: Michael Albinus <michael.albinus@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Lars Ingebrigtsen <larsi@HIDDEN> writes:

> Create a file /tmp/a.txt, and visit /tmp.
> M-x browse-url-of-dired-file on the file.
>
> Emacs will say:
>
> File exists, but cannot be read
>
> and then display the file in a text-mode buffer.

Here's a simpler reproduction.  Ensure that /tmp/a.txt exists, and then
eval:

(browse-url-of-file "/tmp/a.txt")

The message originates from here, sort of:

(defun find-file-noselect-1 (buf filename nowarn rawfile truename number)

[...]

	  (condition-case ()
	      (let ((inhibit-read-only t))
		(insert-file-contents-literally filename t))
	    (file-error
	     (when (and (file-exists-p filename)
			(not (file-readable-p filename)))
	       (kill-buffer buf)
	       (signal 'file-error (list "File is not readable"
					 filename)))

If we remove that condition-case, we get:

Debugger entered--Lisp error: (file-error "Opening input file" "Success")
  insert-file-contents("file:///tmp/a.txt" t)

So the insert-file-contents-literally signals a "Success" file-error
when using url-handler-mode.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#42431; Package emacs. Full text available.

Message received at 42431 <at> debbugs.gnu.org:


Received: (at 42431) by debbugs.gnu.org; 19 Jul 2020 19:37:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jul 19 15:37:51 2020
Received: from localhost ([127.0.0.1]:33075 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jxF8B-0003J5-K5
	for submit <at> debbugs.gnu.org; Sun, 19 Jul 2020 15:37:51 -0400
Received: from quimby.gnus.org ([95.216.78.240]:36754)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1jxF88-0003Iq-E9
 for 42431 <at> debbugs.gnu.org; Sun, 19 Jul 2020 15:37:49 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:To:From:Sender:Reply-To:Cc:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=O8fwq2w7ts9DiDa2AFpvhDdrlM5cnzTkoXT1sDhW12g=; b=vNRjXbcrtRKtP9RxPsKMdSspnT
 q4nh9mvCF3AK1CJ/mmpdx2T3Ro0BnI1D/rkTJ0LJKH/FFSTcAWNWu/l1nKVFakxKYMcXg4MPUcn9/
 lQKIGbOR2VSOFyYuAJ5rc2FVaiiN6TKP+r3BpJtLDlJydsBdakHaDuzXeyc7KGE7KpQs=;
Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo)
 by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>) id 1jxF7z-00047y-Bz
 for 42431 <at> debbugs.gnu.org; Sun, 19 Jul 2020 21:37:42 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: 42431 <at> debbugs.gnu.org
Subject: Re: bug#42431: 28.0.50; browse-url-of-dired-file confusing messaging
References: <87v9ijl2ol.fsf@HIDDEN>
Date: Sun, 19 Jul 2020 21:37:38 +0200
In-Reply-To: <87v9ijl2ol.fsf@HIDDEN> (Lars Ingebrigtsen's message of "Sun,
 19 Jul 2020 21:34:02 +0200")
Message-ID: <87r1t7l2il.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: Lars Ingebrigtsen <larsi@HIDDEN> writes: > All this is very
 confusing, because the doc string of the command is > > -- > In Dired, ask
 a WWW browser to display the file named on this line. > -- > > So it should
 just call `browse-url' on the [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 42431
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Lars Ingebrigtsen <larsi@HIDDEN> writes:

> All this is very confusing, because the doc string of the command is
>
> --
> In Dired, ask a WWW browser to display the file named on this line.
> --
>
> So it should just call `browse-url' on the file:// URL, and not do
> anything about these buffers?

Ah, it's because of this --

(defvar browse-url-default-handlers
  '(("\\`mailto:" . browse-url--mailto)
    ("\\`man:" . browse-url--man)
    (browse-url--non-html-file-url-p . browse-url-emacs))

browse-url on a file that doesn't have .html in it will now not open a
browser at all, but instead an Emacs buffer.

In any case, the messaging is misleading and the buffer name is
confusing.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#42431; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 19 Jul 2020 19:34:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jul 19 15:34:12 2020
Received: from localhost ([127.0.0.1]:33065 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jxF4e-0003DW-4g
	for submit <at> debbugs.gnu.org; Sun, 19 Jul 2020 15:34:12 -0400
Received: from lists.gnu.org ([209.51.188.17]:43298)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1jxF4b-0003DO-OO
 for submit <at> debbugs.gnu.org; Sun, 19 Jul 2020 15:34:10 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:34288)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <larsi@HIDDEN>) id 1jxF4b-0004Za-Hr
 for bug-gnu-emacs@HIDDEN; Sun, 19 Jul 2020 15:34:09 -0400
Received: from quimby.gnus.org ([2a01:4f9:2b:f0f::2]:54572)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <larsi@HIDDEN>) id 1jxF4Z-0007BW-T8
 for bug-gnu-emacs@HIDDEN; Sun, 19 Jul 2020 15:34:09 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:Date:Subject:To:From:
 Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID:Content-Description:
 Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:
 In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:
 List-Post:List-Owner:List-Archive;
 bh=dYwoyCPcTxIG8AoReOdVmLd7DQXy6e3+Nt8rOQXVV7w=; b=UdDBmu42IfnfF5RZv6RMD8RKBS
 j5X+e4sbp4iPb36a4ZYWbyuiDDdN4ELk+/J+wS5zSi7IVE6oXBE8qzOIxm19TVdv5FRy3B7XqbWNz
 OL8tMwIwo9ViunAIPVIWuLmus4dB9IBGBrgxcLaHNnqTaW+/Pdkf070q1Eekt5CXFcIY=;
Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo)
 by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>) id 1jxF4V-00043s-Ac
 for bug-gnu-emacs@HIDDEN; Sun, 19 Jul 2020 21:34:05 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 28.0.50; browse-url-of-dired-file confusing messaging
Date: Sun, 19 Jul 2020 21:34:02 +0200
Message-ID: <87v9ijl2ol.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview:  Create a file /tmp/a.txt,
 and visit /tmp. M-x browse-url-of-dired-file
 on the file. Emacs will say: File exists, but cannot be read 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
Received-SPF: pass client-ip=2a01:4f9:2b:f0f::2; envelope-from=larsi@HIDDEN;
 helo=quimby.gnus.org
X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache.
 That's all we know.
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, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)


Create a file /tmp/a.txt, and visit /tmp.
M-x browse-url-of-dired-file on the file.

Emacs will say:

File exists, but cannot be read

and then display the file in a text-mode buffer.

If you then go to the real a.txt buffer, Emacs will then say

/tmp/a.txt and file:///tmp/a.txt are the same file

All this is very confusing, because the doc string of the command is

--
In Dired, ask a WWW browser to display the file named on this line.
--

So it should just call `browse-url' on the file:// URL, and not do
anything about these buffers?



In GNU Emacs 28.0.50 (build 8, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0)
 of 2020-07-19 built on xo
Repository revision: 17f646128f04e9e8590f0371026a14d516f21c63
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12008000
System Description: Debian GNU/Linux bullseye/sid


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





Acknowledgement sent to Lars Ingebrigtsen <larsi@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#42431; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sat, 17 Oct 2020 09:45:02 UTC

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