stdin pipe rename in 3.2.0

Corinna Vinschen corinna-cygwin@cygwin.com
Fri Mar 19 12:58:40 GMT 2021


On Mar 19 21:05, Takashi Yano via Cygwin wrote:
> On Fri, 19 Mar 2021 19:08:07 +0900
> Takashi Yano wrote:
> > Corinna, is it possble to apply the patch for 3.2.0 release?

That's what release testing is for :)

> By the way, duaring testing https://github.com/k-takata/ptycheck,
> I noticed _get_osfhandle() does not work properly for stdout and
> stderr. Shouldn't this
> 
> extern "C" long
> _get_osfhandle (int fd)
> {
>   long res;
> 
>   cygheap_fdget cfd (fd);
>   if (cfd >= 0)
>     res = (long) cfd->get_handle ();
>   else
>     res = -1;
> 
>   syscall_printf ("%R = get_osfhandle(%d)", res, fd);
>   return res;
> }
> 
> be
> 
> extern "C" long
> _get_osfhandle (int fd)
> {
>   long res;
> 
>   cygheap_fdget cfd (fd);
>   if (cfd >= 0)
>     {
>       if (fd == 1 || fd == 2)
>         res = (long) cfd->get_output_handle_cyg ();
>       else
>         res = (long) cfd->get_handle_cyg ();
>     }
>   else
>     res = -1;
> 
>   syscall_printf ("%R = get_osfhandle(%d)", res, fd);
>   return res;
> }
> 
> ?

Maybe.  You introduced the "_cyg" handles, so you should know ;)

On a more serious note, this is, of course, a compatibility
problem.  While _get_osfhandle is called by a Cygwin application,
nobody knows what dubious actions that application will perform
on this handle.  In all likelyhood, it fetched the handle to call
Windows functions.  And *if* it does, wouldn't it make more sense
if the non-Cygwin handle is returned?


Thanks,
Corinna


More information about the Cygwin mailing list