* [PATCH] Cygwin: dtable: Delete old kludge code for /dev/tty. @ 2023-06-27 13:28 Takashi Yano 2023-07-03 10:52 ` Corinna Vinschen 0 siblings, 1 reply; 5+ messages in thread From: Takashi Yano @ 2023-06-27 13:28 UTC (permalink / raw) To: cygwin-patches; +Cc: Takashi Yano, Bruce Jerrick 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. Reported-by: Bruce Jerrick <bmj001@gmail.com> 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] 5+ messages in thread
* Re: [PATCH] Cygwin: dtable: Delete old kludge code for /dev/tty. 2023-06-27 13:28 [PATCH] Cygwin: dtable: Delete old kludge code for /dev/tty Takashi Yano @ 2023-07-03 10:52 ` Corinna Vinschen 2023-07-04 9:58 ` Takashi Yano 0 siblings, 1 reply; 5+ messages in thread From: Corinna Vinschen @ 2023-07-03 10:52 UTC (permalink / raw) To: cygwin-patches Hi Takashi, On Jun 27 22:28, 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. > > Reported-by: Bruce Jerrick <bmj001@gmail.com> > Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp> Please add a "Fixes:" tag line. > --- > 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"); > - } This is ok-ish. The problem is that the original patch 23771fa1f7028 does not explain *why* it assigned a console fhandler if the file is not open. Given that, it's not clear what side-effects we might encounter if we change this. Do you understand the situation here can you explain why dropping this kludge will do the right thing now? If so, it would be great to have a good description of the original idea behind the code and why we don't need it anymore in the commit message. Thanks, Corinna ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Cygwin: dtable: Delete old kludge code for /dev/tty. 2023-07-03 10:52 ` Corinna Vinschen @ 2023-07-04 9:58 ` Takashi Yano 2023-07-04 15:59 ` Johannes Schindelin 0 siblings, 1 reply; 5+ messages in thread From: Takashi Yano @ 2023-07-04 9:58 UTC (permalink / raw) To: cygwin-patches Hi Corinna, Thanks for reviewing the patch. On Mon, 3 Jul 2023 12:52:25 +0200 Corinna Vinschen wrote: > Hi Takashi, > > On Jun 27 22:28, 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. > > > > Reported-by: Bruce Jerrick <bmj001@gmail.com> > > Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp> > > Please add a "Fixes:" tag line. > > > --- > > 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"); > > - } > > This is ok-ish. The problem is that the original patch 23771fa1f7028 > does not explain *why* it assigned a console fhandler if the file is not > open. Given that, it's not clear what side-effects we might encounter > if we change this. Do you understand the situation here can you explain > why dropping this kludge will do the right thing now? If so, it would > be great to have a good description of the original idea behind the > code and why we don't need it anymore in the commit message. I am not really sure the reason why the kludge code was needed. However, I noticed stat() fails before the commit 6ae28c22639d without the kludge code if the program calls setsid(). After the commit 6ae28c22639d, this does not happen. Therefore, I think this kludge code is no longer necessary. I will submit v2 patch where the commit message is updated. -- Takashi Yano <takashi.yano@nifty.ne.jp> ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Cygwin: dtable: Delete old kludge code for /dev/tty. 2023-07-04 9:58 ` Takashi Yano @ 2023-07-04 15:59 ` Johannes Schindelin 2023-07-07 3:30 ` Takashi Yano 0 siblings, 1 reply; 5+ messages in thread From: Johannes Schindelin @ 2023-07-04 15:59 UTC (permalink / raw) To: Takashi Yano; +Cc: cygwin-patches Hi Takashi, On Tue, 4 Jul 2023, Takashi Yano wrote: > On Mon, 3 Jul 2023 12:52:25 +0200 > Corinna Vinschen wrote: > > > > On Jun 27 22:28, Takashi Yano wrote: > > > > > > 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"); > > > - } > > > > This is ok-ish. The problem is that the original patch 23771fa1f7028 > > does not explain *why* it assigned a console fhandler if the file is not > > open. Given that, it's not clear what side-effects we might encounter > > if we change this. Do you understand the situation here can you explain > > why dropping this kludge will do the right thing now? If so, it would > > be great to have a good description of the original idea behind the > > code and why we don't need it anymore in the commit message. > > I am not really sure the reason why the kludge code was needed. > However, I noticed stat() fails before the commit 6ae28c22639d > without the kludge code if the program calls setsid(). After the > commit 6ae28c22639d, this does not happen. Therefore, I think > this kludge code is no longer necessary. FWIW this is the exact kind of issue I keep pointing out with these commit messages. It is quite often totally unclear what the issues are, there are sometimes links to threads where one could potentially go and hunt and guess what the outcome of that discussion was. And more often than not, these commit messages talk vaguely about "This fixes the issue by dropping a kludge" or something similar, instead of giving a clear and comprehensive description as to what the problem is, why the code was faulty, what is done instead, and what alternatives were considered and the reasons why they were rejected. This leaves a lot of room for improvement without which we're prone to repeat these increasingly frustrating exchanges. Once again, I would highly recommend to read https://github.blog/2022-06-30-write-better-commits-build-better-projects/ and craft commit messages based on the provided guidance. I promise you that you will no longer have to say "I am not really sure the reason why the kludge code was needed", like, ever again, if you follow that article's advice. Ciao, Johannes ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Cygwin: dtable: Delete old kludge code for /dev/tty. 2023-07-04 15:59 ` Johannes Schindelin @ 2023-07-07 3:30 ` Takashi Yano 0 siblings, 0 replies; 5+ messages in thread From: Takashi Yano @ 2023-07-07 3:30 UTC (permalink / raw) To: cygwin-patches On Tue, 4 Jul 2023 17:59:41 +0200 (CEST) Johannes Schindelin wrote: > Hi Takashi, > > On Tue, 4 Jul 2023, Takashi Yano wrote: > > > On Mon, 3 Jul 2023 12:52:25 +0200 > > Corinna Vinschen wrote: > > > > > > On Jun 27 22:28, Takashi Yano wrote: > > > > > > > > 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"); > > > > - } > > > > > > This is ok-ish. The problem is that the original patch 23771fa1f7028 > > > does not explain *why* it assigned a console fhandler if the file is not > > > open. Given that, it's not clear what side-effects we might encounter > > > if we change this. Do you understand the situation here can you explain > > > why dropping this kludge will do the right thing now? If so, it would > > > be great to have a good description of the original idea behind the > > > code and why we don't need it anymore in the commit message. > > > > I am not really sure the reason why the kludge code was needed. > > However, I noticed stat() fails before the commit 6ae28c22639d > > without the kludge code if the program calls setsid(). After the > > commit 6ae28c22639d, this does not happen. Therefore, I think > > this kludge code is no longer necessary. > > FWIW this is the exact kind of issue I keep pointing out with these commit > messages. > > It is quite often totally unclear what the issues are, there are sometimes > links to threads where one could potentially go and hunt and guess what > the outcome of that discussion was. > > And more often than not, these commit messages talk vaguely about "This > fixes the issue by dropping a kludge" or something similar, instead of > giving a clear and comprehensive description as to what the problem is, > why the code was faulty, what is done instead, and what alternatives were > considered and the reasons why they were rejected. > > This leaves a lot of room for improvement without which we're prone to > repeat these increasingly frustrating exchanges. > > Once again, I would highly recommend to read > https://github.blog/2022-06-30-write-better-commits-build-better-projects/ > and craft commit messages based on the provided guidance. I promise you > that you will no longer have to say "I am not really sure the reason why > the kludge code was needed", like, ever again, if you follow that > article's advice. Thanks for the advice. I will keep your adivce in mind. -- Takashi Yano <takashi.yano@nifty.ne.jp> ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-07-07 3:30 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-06-27 13:28 [PATCH] Cygwin: dtable: Delete old kludge code for /dev/tty Takashi Yano 2023-07-03 10:52 ` Corinna Vinschen 2023-07-04 9:58 ` Takashi Yano 2023-07-04 15:59 ` Johannes Schindelin 2023-07-07 3:30 ` Takashi Yano
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).