unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Compiling in mingw-ucrt runtime
@ 2024-02-22  0:01 Arthur Miller
  2024-02-22  6:24 ` Po Lu via Emacs development discussions.
                   ` (2 more replies)
  0 siblings, 3 replies; 27+ messages in thread
From: Arthur Miller @ 2024-02-22  0:01 UTC (permalink / raw)
  To: emacs-devel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: 0001-Check-for-actuall-errno-ignore-EINTR.patch --]
[-- Type: text/x-patch, Size: 1524 bytes --]

From ffa8edca7bb60ed06f23f769a5fac723b3bc020d Mon Sep 17 00:00:00 2001
From: Arthur Miller <arthur.miller@live.com>
Date: Thu, 22 Feb 2024 00:02:51 +0100
Subject: [PATCH] Check for actuall errno && ignore EINTR

---
 nt/cmdproxy.c | 3 +++
 src/sysdep.c  | 7 +++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/nt/cmdproxy.c b/nt/cmdproxy.c
index 0500b653bb2..82592404d4c 100644
--- a/nt/cmdproxy.c
+++ b/nt/cmdproxy.c
@@ -38,6 +38,9 @@ #define DEFER_MS_W32_H
 #include <string.h>  /* strlen */
 #include <ctype.h>   /* isspace, isalpha */
 
+#ifdef _UCRT
+#define _snprintf snprintf
+#endif
 /* We don't want to include stdio.h because we are already duplicating
    lots of it here */
 extern int _snprintf (char *buffer, size_t count, const char *format, ...);
diff --git a/src/sysdep.c b/src/sysdep.c
index 3a6829dd27a..5d294ca1bdf 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -2981,7 +2981,7 @@ close_output_streams (void)
   fflush (stderr);
   fflush (stdout);
 #else /* !__ANDROID__ */
-  if (close_stream (stdout) != 0)
+  if (close_stream (stdout) != 0 && errno && (errno != EINTR))
     {
       emacs_perror ("Write error to standard output");
       _exit (EXIT_FAILURE);
@@ -2993,7 +2993,10 @@ close_output_streams (void)
   if (err | (ADDRESS_SANITIZER
 	     ? fflush (stderr) != 0 || ferror (stderr)
 	     : close_stream (stderr) != 0))
-    _exit (EXIT_FAILURE);
+    {
+      if (errno && (errno != EINTR))
+	_exit (EXIT_FAILURE);
+    }
 #endif /* __ANDROID__ */
 }
 \f
-- 
2.43.2


[-- Attachment #2: Type: text/plain, Size: 1420 bytes --]


I was a bit curios what is going on there. It turnes out, at least as I
understand, that the errors were not real errors, in most cases, so it seems
*almost* legit to brush them under carpet.

I printed out errors and what I saw were endless

"Write error to standard output: no error"

messages when native compiler run its batch jobs (amongst other).

Seems like close_stream in ucrt runtime does not return real errno but something
else.

Just checking if errno was set reduced almost everything; and I found that
comment in posix_close aboutt EINTR.

However; I am still not able to build emacs wihtout trolling away exit on
failure, because temacs fails. I get this error:

cp -f temacs.exe bootstrap-emacs.exe
rm -f bootstrap-emacs.pdmp
./temacs --batch  -l loadup --temacs=pbootstrap \
        --bin-dest /ucrt64/bin/ --eln-dest /ucrt64/lib/emacs/30.0.50/
C:\Users\arthu\repos\emsrc\ucrt-02-21\src\temacs.exe: Write error to standard output: No such file or directory
make[2]: *** [Makefile:1014: bootstrap-emacs.pdmp] Error 1

Question is which file or directory? Dump file? Bad path? Bad encoding?
Something in loadup.el or elsewhere?

If I comment away exit on failure as they do in mingw patch, than everything
builds and seemnigly works. However I have experienced one crash where system
killed Emacs, similar as those I have seen with the version from gnu ftp
(29.2_1).

How do I debug temacs bootstrap?



^ permalink raw reply related	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2024-04-03 13:09 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-22  0:01 Compiling in mingw-ucrt runtime Arthur Miller
2024-02-22  6:24 ` Po Lu via Emacs development discussions.
2024-02-22  7:14 ` Eli Zaretskii
2024-02-23  7:58   ` Arthur Miller
2024-02-23  8:24     ` Eli Zaretskii
2024-02-23 11:32       ` Arthur Miller
2024-02-23 12:02         ` Eli Zaretskii
2024-02-24  9:13           ` Arthur Miller
2024-02-24 10:24             ` Eli Zaretskii
2024-02-24 23:11               ` Arthur Miller
2024-02-25  5:56                 ` Po Lu
2024-02-25  6:33                 ` Eli Zaretskii
2024-02-25 10:19                   ` Arthur Miller
2024-02-25 10:48                     ` Eli Zaretskii
2024-02-25 11:40                       ` Arthur Miller
2024-02-25 12:15                         ` Eli Zaretskii
2024-02-25 14:11                           ` Bruno Haible
2024-02-25 14:29                             ` Eli Zaretskii
2024-02-25 15:05                               ` Bruno Haible
2024-02-25 15:14                                 ` Eli Zaretskii
2024-02-25 15:32                                   ` Bruno Haible
2024-02-25 16:02                                     ` Eli Zaretskii
2024-04-02 15:30                                       ` Arthur Miller
2024-04-02 16:28                                         ` Eli Zaretskii
2024-04-03 13:09                                           ` Arthur Miller
2024-02-23 14:47 ` Benjamin Riefenstahl
2024-02-23 15:03   ` Benjamin Riefenstahl

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).