public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Takashi Yano <takashi.yano@nifty.ne.jp>
To: cygwin@cygwin.com
Subject: Re: stdin pipe rename in 3.2.0
Date: Sun, 21 Mar 2021 12:59:09 +0900	[thread overview]
Message-ID: <20210321125909.3c09b43e7899e0c1f9d43b8f@nifty.ne.jp> (raw)
In-Reply-To: <YFSgAJdS7uSp/NwM@calimero.vinschen.de>

On Fri, 19 Mar 2021 13:58:40 +0100
Corinna Vinschen wrote:
> > 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?

You are right. If get_output_handle_cyg() is returned, OPOST
processing and charset conversion does not work. Thanks!
As for input, get_handle_cyg() should be returned rather than
get_handle() because reading from get_handle() will fail because
master writes input to cygwin handle for cygwin process.

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>

      reply	other threads:[~2021-03-21  3:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-18 20:28 Christoph Reiter
2021-03-19  3:46 ` Brian Inglis
2021-03-19  7:53   ` Christoph Reiter
2021-03-19 11:30     ` Brian Inglis
2021-03-19 10:08 ` Takashi Yano
2021-03-19 10:16   ` Takashi Yano
2021-03-19 11:17   ` Christoph Reiter
2021-03-19 12:05   ` Takashi Yano
2021-03-19 12:58     ` Corinna Vinschen
2021-03-21  3:59       ` Takashi Yano [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210321125909.3c09b43e7899e0c1f9d43b8f@nifty.ne.jp \
    --to=takashi.yano@nifty.ne.jp \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).