Subject: bug#58464: 28.1; browse-url-emacs doesn't work for local files on Windows

From: Paul Eggert <[email-masked]>
Date: Thu, 13 Oct 2022 09:40:54 -0700

On 2022-10-13 04:30, Lars Ingebrigtsen wrote:
> Eli Zaretskii <[email-masked]> writes:
> 
>> Thanks.  But this part:
>>
>>    -  if (NILP (handler) && !NILP (visit) && current_buffer->modtime.tv_nsec < 0)
>>    +  if (save_errno != 0)
>>
>> might cause us signal an error when VISIT is nil, something that
>> didn't happen before.

We should be OK there. If VISIT is nil, SAVE_ERRNO must be zero.

>> (I also am not sure it is 100% reliable to rely on save_errno being
>> non-zero whenever we encounter an error, especially in the
>> file-handlers case.)

Should be OK here too. In the file-handlers case, SAVE_ERRNO is zero.

I installed the attached to help document and check this.

From 10f55975d34dd7299f72fdf8d93fd8cbe2e41e25 Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email-masked]>
Date: Thu, 13 Oct 2022 09:33:46 -0700
Subject: [PATCH] Improve checks for recent "File exists" fixup

* src/fileio.c (Finsert_file_contents): Add an assertion (bug#42431).
---
 src/fileio.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/fileio.c b/src/fileio.c
index 49553f3c91..b9a57dd580 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -5003,6 +5003,7 @@ because (1) it preserves some marker positions (in unchanged portions
   if (save_errno != 0)
     {
       /* Signal an error if visiting a file that could not be opened.  */
+      eassert (!NILP (visit) && NILP (handler));
       report_file_errno ("Opening input file", orig_filename, save_errno);
     }
 
-- 
2.34.1