From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: MPS: Win64 testers? Date: Sun, 28 Jul 2024 08:25:45 +0300 Message-ID: <867cd61412.fsf@gnu.org> References: <86zfq31cvc.fsf@gnu.org> <86ttgb1186.fsf@gnu.org> <86le1m24tx.fsf@gnu.org> <86jzh622p4.fsf@gnu.org> <86h6ca1xfz.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20704"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Pip Cet Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Jul 28 07:26:34 2024 Return-path: Envelope-to: ged-emacs-devel@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 1sXwQT-0005Es-96 for ged-emacs-devel@m.gmane-mx.org; Sun, 28 Jul 2024 07:26:33 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sXwPm-0003YJ-4q; Sun, 28 Jul 2024 01:25:50 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sXwPk-0003WT-A0 for emacs-devel@gnu.org; Sun, 28 Jul 2024 01:25:48 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sXwPi-0004Ls-Sy; Sun, 28 Jul 2024 01:25:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=yXXpQtt6X+q8W+SJvs0z5z7cLA0CuUhL43GHsLvGkx0=; b=oPomB++3yoIH jmSBS32jBax2rDV3GSdQiETUgGwQV90B70suAfw3zNdKmyf1eZxE4L1/zT7xFJEDCNXXFPxbG3Txj 3mBTy4awRuIksfelcvvC76AmsFTQAnFumXFOp80OinwhUYbJWZhpWKaAZ5tds4uS+NlzwAIdqLhUs 0vMKYWW4uqzT8r+cfbHKSOVVxAlGp8W6+BJT7a8K4zRmmohBxhgn/LlxJC/ICSqZxShgtY5mC1APk 42RrF1zqJEb1gvPvLJgOwRhGnI8DigNqCdafOC35ksqIel2PZj17eRTC7eCjXE9ztN1zx5DgVAyez zTAO//Jru2yX0vwB/RPG8Q==; In-Reply-To: (message from Pip Cet on Sat, 27 Jul 2024 20:22:34 +0000) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:322153 Archived-At: > Date: Sat, 27 Jul 2024 20:22:34 +0000 > From: Pip Cet > Cc: emacs-devel@gnu.org > > On Saturday, July 27th, 2024 at 18:50, Eli Zaretskii wrote: > > > Date: Sat, 27 Jul 2024 18:27:43 +0000 > > > > > From: Pip Cet pipcet@protonmail.com > > > Cc: emacs-devel@gnu.org > > > > > > On Saturday, July 27th, 2024 at 16:56, Eli Zaretskii eliz@gnu.org wrote: > > > > > > > then stepping through this code I see that fd is first assigned zero, > > > > then 1, then 2. As expected, because any decent emulation of Posix > > > > file descriptors must keep this semantics: file descriptors are reused > > > > starting from the lowest available slot. > > > > > > > > Do you see something different in your build? > > > > > > _open_osfhandle returns 0 for the first FD, but _fdopen returns 0x7b281160, while stdin is 0x7b281100. > > > > > > Not on my system. Here _fdopen returns a pointer to the same FILE > > object as the original std* streams. And it is also expected, since > > the source code of MSVCRT explicitly shows that _fdopen calls a > > routine that looks up a vacant stream slot, and that routine examines > > the _iob[] array in the ascending order of indices, from zero to max, > > until it finds an unused slot. > > Wine does the same thing, except it starts at index 3: > > for (i = 3; i < MSVCRT_max_streams; i++) > { > file = msvcrt_get_file(i); > if (!file) > return NULL; > > if (file->_flag == 0) > { > if (i == MSVCRT_stream_idx) > { > CRITICAL_SECTION *cs = file_get_cs(file); > if (cs) > { > InitializeCriticalSectionEx(cs, 0, RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO); > cs->DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": file_crit.crit"); > } > MSVCRT_stream_idx++; > } > return file; > } > } > > It's been that way since 2004, if the git history is to be believed. I guess they have some unsolved issues with the standard streams, which is why they don't dare reusing their slots. Which means closing these standard streams is a no-no on Wine. But if this is what Wine does, then what do you get from the various fprintf debugging code in Emacs? For example, if you build with the "--enable-checking='yes,glyphs'" option, you get the trace-redisplay command which outputs debugging information about redisplay to stderr, and also the dump-glyph-matrix command which prints the glyph matrix to stderr. Do these print-outs still work although stderr was closed in init_ntproc? Or maybe under Wine closing a standard stream has no effect, and the stream remains open? But then why does close_output_streams reports errors?