public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
* [PATCH v2] Cygwin: dtable: Delete old kludge code for /dev/tty.
@ 2023-07-04 10:03 Takashi Yano
  2023-07-04 14:36 ` Corinna Vinschen
  0 siblings, 1 reply; 4+ messages in thread
From: Takashi Yano @ 2023-07-04 10:03 UTC (permalink / raw)
  To: cygwin-patches; +Cc: Takashi Yano, Bruce Jerrick, Corinna Vinschen

This old kludge code assigns fhandler_console for /dev/tty even
if the CTTY is not a console when stat() has been called. Due to
this, the problem reported in
https://cygwin.com/pipermail/cygwin/2023-June/253888.html
occurs after the commit 3721a756b0d8 ("Cygwin: console: Make the
console accessible from other terminals.").

This patch fixes the issue by dropping the old kludge code.

Though the exact reason why the kludge code was necessary is not
clear enough, this kluge code has no longer seemed to be necessary
after the commit 6ae28c22639d. This is because even when /dev/tty
is not opened, /dev/tty became able to be refered via last_tty_dev,
which was introduced by the commit 6ae28c22639d.

Fixes: 23771fa1f7028 ("dtable.cc (fh_alloc): Make different decisions
  when generating fhandler for not-opened devices. Add kludge to deal
  with opening /dev/tty.")
Reported-by: Bruce Jerrick <bmj001@gmail.com>
Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
---
 winsup/cygwin/dtable.cc | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc
index 18e0f3097..9427e238e 100644
--- a/winsup/cygwin/dtable.cc
+++ b/winsup/cygwin/dtable.cc
@@ -598,12 +598,7 @@ fh_alloc (path_conv& pc)
 	  fh = cnew (fhandler_mqueue);
 	  break;
 	case FH_TTY:
-	  if (!pc.isopen ())
-	    {
-	      fhraw = cnew_no_ctor (fhandler_console, -1);
-	      debug_printf ("not called from open for /dev/tty");
-	    }
-	  else if (!CTTY_IS_VALID (myself->ctty) && last_tty_dev
+	  if (!CTTY_IS_VALID (myself->ctty) && last_tty_dev
 		   && !myself->set_ctty (fh_last_tty_dev, 0))
 	    debug_printf ("no /dev/tty assigned");
 	  else if (CTTY_IS_VALID (myself->ctty))
-- 
2.39.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] Cygwin: dtable: Delete old kludge code for /dev/tty.
  2023-07-04 10:03 [PATCH v2] Cygwin: dtable: Delete old kludge code for /dev/tty Takashi Yano
@ 2023-07-04 14:36 ` Corinna Vinschen
  2023-07-07  3:30   ` Takashi Yano
  0 siblings, 1 reply; 4+ messages in thread
From: Corinna Vinschen @ 2023-07-04 14:36 UTC (permalink / raw)
  To: cygwin-patches

On Jul  4 19:03, Takashi Yano wrote:
> This old kludge code assigns fhandler_console for /dev/tty even
> if the CTTY is not a console when stat() has been called. Due to
> this, the problem reported in
> https://cygwin.com/pipermail/cygwin/2023-June/253888.html
> occurs after the commit 3721a756b0d8 ("Cygwin: console: Make the
> console accessible from other terminals.").
> 
> This patch fixes the issue by dropping the old kludge code.
> 
> Though the exact reason why the kludge code was necessary is not
> clear enough, this kluge code has no longer seemed to be necessary
                                ^^^^^^^^^^^^^^^^^^^^
I'm not a native speaker myself, but

				no longer seems

might be better here.

Anyway, this is GTG.


Thanks,
Corinna

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] Cygwin: dtable: Delete old kludge code for /dev/tty.
  2023-07-04 14:36 ` Corinna Vinschen
@ 2023-07-07  3:30   ` Takashi Yano
  2023-07-07  9:34     ` Corinna Vinschen
  0 siblings, 1 reply; 4+ messages in thread
From: Takashi Yano @ 2023-07-07  3:30 UTC (permalink / raw)
  To: cygwin-patches

Hi Corinna,

On Tue, 4 Jul 2023 16:36:26 +0200
Corinna Vinschen wrote:
> On Jul  4 19:03, Takashi Yano wrote:
> > This old kludge code assigns fhandler_console for /dev/tty even
> > if the CTTY is not a console when stat() has been called. Due to
> > this, the problem reported in
> > https://cygwin.com/pipermail/cygwin/2023-June/253888.html
> > occurs after the commit 3721a756b0d8 ("Cygwin: console: Make the
> > console accessible from other terminals.").
> > 
> > This patch fixes the issue by dropping the old kludge code.
> > 
> > Though the exact reason why the kludge code was necessary is not
> > clear enough, this kluge code has no longer seemed to be necessary
>                                 ^^^^^^^^^^^^^^^^^^^^
> I'm not a native speaker myself, but
> 
> 				no longer seems
> 
> might be better here.
> 
> Anyway, this is GTG.

I think I understand correctly the concept of cnew_no_ctor macro in
dtable.cc now. cnew_no_ctor calls fhandler_console(void *) instead of
fhandler_console(fh_devices) to omits initialization of instance for
stat() call. This might make stat() slightly faster.

Based on this understanding, I would like to withdraw the previous
patch, and propose new patch series.

Could you please review the patch seriese?

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] Cygwin: dtable: Delete old kludge code for /dev/tty.
  2023-07-07  3:30   ` Takashi Yano
@ 2023-07-07  9:34     ` Corinna Vinschen
  0 siblings, 0 replies; 4+ messages in thread
From: Corinna Vinschen @ 2023-07-07  9:34 UTC (permalink / raw)
  To: cygwin-patches

On Jul  7 12:30, Takashi Yano wrote:
> Hi Corinna,
> 
> On Tue, 4 Jul 2023 16:36:26 +0200
> Corinna Vinschen wrote:
> > On Jul  4 19:03, Takashi Yano wrote:
> > > This old kludge code assigns fhandler_console for /dev/tty even
> > > if the CTTY is not a console when stat() has been called. Due to
> > > this, the problem reported in
> > > https://cygwin.com/pipermail/cygwin/2023-June/253888.html
> > > occurs after the commit 3721a756b0d8 ("Cygwin: console: Make the
> > > console accessible from other terminals.").
> > > 
> > > This patch fixes the issue by dropping the old kludge code.
> > > 
> > > Though the exact reason why the kludge code was necessary is not
> > > clear enough, this kluge code has no longer seemed to be necessary
> >                                 ^^^^^^^^^^^^^^^^^^^^
> > I'm not a native speaker myself, but
> > 
> > 				no longer seems
> > 
> > might be better here.
> > 
> > Anyway, this is GTG.
> 
> I think I understand correctly the concept of cnew_no_ctor macro in
> dtable.cc now. cnew_no_ctor calls fhandler_console(void *) instead of
> fhandler_console(fh_devices) to omits initialization of instance for
> stat() call. This might make stat() slightly faster.
> 
> Based on this understanding, I would like to withdraw the previous
> patch, and propose new patch series.
> 
> Could you please review the patch seriese?

Great, will do!


Thanks,
Corinna

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-07-07  9:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-04 10:03 [PATCH v2] Cygwin: dtable: Delete old kludge code for /dev/tty Takashi Yano
2023-07-04 14:36 ` Corinna Vinschen
2023-07-07  3:30   ` Takashi Yano
2023-07-07  9:34     ` Corinna Vinschen

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).