emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MPS: Win64 testers?


From: Eli Zaretskii
Subject: Re: MPS: Win64 testers?
Date: Tue, 06 Aug 2024 14:40:56 +0300

> From: Quang Kien Nguyen <kien.n.quang@gmail.com>
> Date: Mon, 5 Aug 2024 20:04:33 -0700
> Cc: emacs-devel@gnu.org, pipcet@protonmail.com
> 
> > > As for the code in question, if I understand it correctly, the current 
> > > Windows idiom would be simply (I assume _open_osfhandle clears the flag?):
> > > 
> > > SetHandleInformation (GetStdHandle (STD_INPUT_HANDLE), 
> > > HANDLE_FLAG_INHERIT, 
> > > 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` (== 3) stream. Here is the extracted source
> code https://github.com/huangqinjin/ucrt/blob/master/stdio/stream.cpp#L12
> 
> 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.
> 
> I have tested with my own UCRT64 build of Emacs at
> https://github.com/kiennq/emacs-build/releases/tag/v31.276.20240805.2332f50,
> With the patch of
> https://github.com/kiennq/emacs-build/edit/main/patches/0001-init_winntproc-Use-SetHandleInformation-to-set-NOINH.patch
> 
> The SetHandleInformation returns no error even without streams being
> closed.

Thanks, noted.

What we need next is (a) a clean patch, and (b) thorough testing that
the standard handles are indeed not inherited by sub-processes of
Emacs when the patch is applied.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]