From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Pip Cet Newsgroups: gmane.emacs.devel Subject: Re: MPS: Win64 testers? Date: Tue, 06 Aug 2024 14:18:28 +0000 Message-ID: <874j7xvioe.fsf@protonmail.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31888"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , emacs-devel@gnu.org To: Quang Kien Nguyen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Aug 06 16:55:50 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 1sbLbK-00084k-Hq for ged-emacs-devel@m.gmane-mx.org; Tue, 06 Aug 2024 16:55:50 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sbLai-00074u-6W; Tue, 06 Aug 2024 10:55:12 -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 1sbL1b-0000sr-Nb for emacs-devel@gnu.org; Tue, 06 Aug 2024 10:18:56 -0400 Original-Received: from mail-4322.protonmail.ch ([185.70.43.22]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sbL1Z-0004Lu-JK; Tue, 06 Aug 2024 10:18:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1722953930; x=1723213130; bh=MxArCN5OTQThgLTkyJNU9j7LDPcKhg5ISVGK+KHYXUg=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=wRbk4/AD7YsLRdfegGTVJzxQxl85csCtuOBtAJ+Y0vOU5r9n8EMpBVn24gDiRba9K JcUmr28pDd7/ZlV0QdK+WyD+4y5KbeXWSEan0Ct4CtvXLL5S7KXFf/c92SQwZl7r+w sTEXN08lp5U20RHdnm9nJ8n4UPGAJkjXn/bnt6F0SivYbCtqSy98LZWSQMspxQQaq2 GtDoZVScYLThQrzDS7KGvxA1AjipNgYgSqwPfd7GggZOZwboo8H2SWRHUFgIeuMmmx 0LdKnDDtD3cgvZPzB28LrAZ5w/uaZJDUA88Pm29GW3MSPiWhWIR5UX8smT+ENqG7FE 38yMoZphsGwdw== In-Reply-To: Feedback-ID: 112775352:user:proton X-Pm-Message-ID: 078a2d223bf140fdcb41726ea9f9e20d221469eb Received-SPF: pass client-ip=185.70.43.22; envelope-from=pipcet@protonmail.com; helo=mail-4322.protonmail.ch 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Tue, 06 Aug 2024 10:55:10 -0400 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:322444 Archived-At: "Quang Kien Nguyen" writes: >> > As for the code in question, if I understand it correctly, the current >> > Windows idiom would be simply (I assume _open_osfhandle clears the fla= g?): >> > >> > SetHandleInformation (GetStdHandle (STD_INPUT_HANDLE), HANDLE_FLAG_INH= ERIT, >> > 0); >> >> I'm not sure you can do this without closing the stream, since the >> program has already started by that time. And SetHandleInformation is >> only available since Windows 2K, so we'd need to call it through a >> function pointer. > I think using the SetHandleInformation here should be appropriate. > The implementation of _fdopen in ucrt is similar to Wine, it starts > looking from ` _IOB_ENTRIES` (=3D=3D 3) stream. Here is the extracted sou= rce > code https://github.com/huangqinjin/ucrt/blob/master/stdio/stream.cpp#L12 Thanks! > So, once we close the `stdin/out/err`, there's noone who get assigned > back to those streams, and then the final close in `sys_dep.c` will fail > for UCRT. Indeed, that's what I'm seeing with wine, too. BTW, the Wine issue has been fixed and it now faithfully emulates the MSVCRT behavior when pretending to be ancient Windows. > I have tested with my own UCRT64 build of Emacs at > https://github.com/kiennq/emacs-build/releases/tag/v31.276.20240805.2332f= 50, > With the patch of > https://github.com/kiennq/emacs-build/edit/main/patches/0001-init_winntpr= oc-Use-SetHandleInformation-to-set-NOINH.patch https://github.com/kiennq/emacs-build/blob/main/patches/0001-init_winntproc= -Use-SetHandleInformation-to-set-NOINH.patch is visible here. > The SetHandleInformation returns no error even without streams being > closed. We still need to call it through a function pointer to support Windows 98/95, right? And, of course, once we've done that, we need to find testers for most or all Windows versions to verify the streams are indeed not being inherited. Would you be willing and able to help with that, maybe? Pip