From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#42431: 28.0.50; browse-url-of-dired-file confusing messaging Date: Sun, 09 Aug 2020 11:35:25 +0200 Message-ID: <87pn80w49u.fsf@gnus.org> References: <87v9ijl2ol.fsf@gnus.org> <87blk04mw8.fsf@gnus.org> <83eeoh7f68.fsf@gnu.org> <87a6z55u7j.fsf@gnus.org> <83y2mp5te0.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36115"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: michael.albinus@gmx.de, 42431@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Aug 09 11:36:10 2020 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 1k4hkQ-0009G6-P7 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 09 Aug 2020 11:36:10 +0200 Original-Received: from localhost ([::1]:50112 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k4hkP-0001LX-6n for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 09 Aug 2020 05:36:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36064) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k4hkI-0001LM-SL for bug-gnu-emacs@gnu.org; Sun, 09 Aug 2020 05:36:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48408) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k4hkI-0000Bd-JA for bug-gnu-emacs@gnu.org; Sun, 09 Aug 2020 05:36:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1k4hkI-0008F4-81 for bug-gnu-emacs@gnu.org; Sun, 09 Aug 2020 05:36:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 09 Aug 2020 09:36:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42431 X-GNU-PR-Package: emacs Original-Received: via spool by 42431-submit@debbugs.gnu.org id=B42431.159696574131652 (code B ref 42431); Sun, 09 Aug 2020 09:36:02 +0000 Original-Received: (at 42431) by debbugs.gnu.org; 9 Aug 2020 09:35:41 +0000 Original-Received: from localhost ([127.0.0.1]:59954 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k4hjx-0008ES-0n for submit@debbugs.gnu.org; Sun, 09 Aug 2020 05:35:41 -0400 Original-Received: from quimby.gnus.org ([95.216.78.240]:33772) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k4hjv-0008ED-Gb for 42431@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=; Original-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 ) id 1k4hji-0008WS-PM; Sun, 09 Aug 2020 11:35:32 +0200 In-Reply-To: <83y2mp5te0.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 08 Aug 2020 13:22:47 +0300") 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:184388 Archived-At: Eli Zaretskii writes: >> From: Lars Ingebrigtsen >> Cc: michael.albinus@gmx.de, 42431@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