[PATCH] Cygwin: sigproc.cc: fix typo in comment describing nprocs

2020-08-27 Thread Ken Brown via Cygwin-patches
nprocs is the number of children, not the number of deceased children.
The incorrect comment used to apply to a variable nzombies.  The
latter was removed in commit 8cb359d9 in 2004, but the comment was
never updated.
---
 winsup/cygwin/sigproc.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
index a5cf73bde..30c799f8c 100644
--- a/winsup/cygwin/sigproc.cc
+++ b/winsup/cygwin/sigproc.cc
@@ -44,7 +44,7 @@ char NO_COPY myself_nowait_dummy[1] = {'0'};// Flag to 
sig_send that signal goes
 #define Static static NO_COPY
 
 
-Static int nprocs; // Number of deceased children
+Static int nprocs; // Number of children
 Static char cprocs[(NPROCS + 1) * sizeof (pinfo)];// All my children info
 #define procs ((pinfo *) cprocs)   // All this just to avoid expensive
// constructor operation  at DLL startup
-- 
2.28.0



Re: [PATCH 0/3] CI update

2020-08-27 Thread Brian Inglis
On 2020-08-27 02:49, Corinna Vinschen wrote:
> On Aug 26 22:04, Jon Turney wrote:
>> Since we recently had the unpleasant surprise of discovering that Cygwin
>> doesn't build on F32 when trying to make a release, this adds some CI to
>> test that.
>>
>> Open issues: Since there don't seem to be RedHat packages for cocom, this
>> grabs a cocom package from some random 3rd party I found on the internet.

New official site V0.98 Unicode 8:

https://github.com/dino-lang/dino/blob/master/cocom.spec

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in IEC units and prefixes, physical quantities in SI.]


[PATCH] Cygwin: select: Fix a bug on closing pi->bye event.

2020-08-27 Thread Takashi Yano via Cygwin-patches
- Close event handle pi->bye only if it was created.
  Addresses:
  https://cygwin.com/pipermail/cygwin-developers/2020-August/011948.html
---
 winsup/cygwin/select.cc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc
index 9f1a8a57a..501714fa7 100644
--- a/winsup/cygwin/select.cc
+++ b/winsup/cygwin/select.cc
@@ -783,8 +783,8 @@ pipe_cleanup (select_record *, select_stuff *stuff)
   pi->stop_thread = true;
   SetEvent (pi->bye);
   pi->thread->detach ();
+  CloseHandle (pi->bye);
 }
-  CloseHandle (pi->bye);
   delete pi;
   stuff->device_specific_pipe = NULL;
 }
@@ -978,8 +978,8 @@ fifo_cleanup (select_record *, select_stuff *stuff)
   pi->stop_thread = true;
   SetEvent (pi->bye);
   pi->thread->detach ();
+  CloseHandle (pi->bye);
 }
-  CloseHandle (pi->bye);
   delete pi;
   stuff->device_specific_fifo = NULL;
 }
@@ -1344,8 +1344,8 @@ pty_slave_cleanup (select_record *me, select_stuff *stuff)
   pi->stop_thread = true;
   SetEvent (pi->bye);
   pi->thread->detach ();
+  CloseHandle (pi->bye);
 }
-  CloseHandle (pi->bye);
   delete pi;
   stuff->device_specific_ptys = NULL;
 }
-- 
2.28.0



Re: [PATCH] Cygwin: pty: Disable pseudo console if TERM is dumb or not set.

2020-08-27 Thread Corinna Vinschen
On Aug 27 17:59, Takashi Yano via Cygwin-patches wrote:
> On Thu, 27 Aug 2020 10:47:56 +0200
> Corinna Vinschen wrote:
> > On Aug 27 13:07, Takashi Yano via Cygwin-patches wrote:
> > > On Wed, 26 Aug 2020 19:36:06 +0200
> > > Corinna Vinschen wrote:
> > > > On Aug 26 21:00, Takashi Yano via Cygwin-patches wrote:
> > > > > Pseudo console generates escape sequences on execution of non-cygwin
> > > > > apps.  If the terminal does not support escape sequence, output will
> > > > > be garbled. This patch prevents garbled output in dumb terminal by
> > > > > disabling pseudo console.
> > > > 
> > > > I'm a bit puzzled by this patch.  We had code handling emacs and dumb
> > > > terminals explicitely in the early forms of the first incarnation of
> > > > the pseudo tty code, but fortunately you found a way to handle this
> > > > without hardcoding terminal types into Cygwin.  Why do you think we
> > > > have to do this now?
> > > 
> > > What previously disccussed was the problem that the clearing
> > > screen at pty startup displays garbage (^[[H^[[2J) in emacs.
> > > Finally, this was settled by eliminating clear-screen and
> > > triggering redraw-screen instead at the first execution of
> > > non-cygwin app.
> > > 
> > > However, the problem reported in
> > > https://cygwin.com/pipermail/cygwin/2020-August/245983.html
> > > still remains. 
> > > 
> > > What's worse in the new implementation, pseudo console sends
> > > ESC[6n (querying cursor position) internally on startup and
> > > waits for a response. This causes hang if pseudo console is
> > > started in dumb terminal.
> > > 
> > > This patch is for fixing this issue.
> > 
> > Would it be feasible to implement this using a timeout instead?
> > If the response isn't sent within, say, 100ms, just skip it?
> 
> Hang is caused at CreateProcessW() call, so there is no way to
> use time out. It is possible to send ESC[6n before creating
> pseudo console for a test and wait for responce with timeout,
> however, if the terminal is dumb, garbage ^[[6n will be displayed.

Doesn't sound so great either.  That would slow down process
startup on dumb terminal a lot, right?

Ok, if you don't see any other way to fix that, I'll push that patch
in a while.


Thanks,
Corinna


Re: [PATCH] Cygwin: pty: Disable pseudo console if TERM is dumb or not set.

2020-08-27 Thread Takashi Yano via Cygwin-patches
On Thu, 27 Aug 2020 10:47:56 +0200
Corinna Vinschen wrote:
> On Aug 27 13:07, Takashi Yano via Cygwin-patches wrote:
> > On Wed, 26 Aug 2020 19:36:06 +0200
> > Corinna Vinschen wrote:
> > > On Aug 26 21:00, Takashi Yano via Cygwin-patches wrote:
> > > > Pseudo console generates escape sequences on execution of non-cygwin
> > > > apps.  If the terminal does not support escape sequence, output will
> > > > be garbled. This patch prevents garbled output in dumb terminal by
> > > > disabling pseudo console.
> > > 
> > > I'm a bit puzzled by this patch.  We had code handling emacs and dumb
> > > terminals explicitely in the early forms of the first incarnation of
> > > the pseudo tty code, but fortunately you found a way to handle this
> > > without hardcoding terminal types into Cygwin.  Why do you think we
> > > have to do this now?
> > 
> > What previously disccussed was the problem that the clearing
> > screen at pty startup displays garbage (^[[H^[[2J) in emacs.
> > Finally, this was settled by eliminating clear-screen and
> > triggering redraw-screen instead at the first execution of
> > non-cygwin app.
> > 
> > However, the problem reported in
> > https://cygwin.com/pipermail/cygwin/2020-August/245983.html
> > still remains. 
> > 
> > What's worse in the new implementation, pseudo console sends
> > ESC[6n (querying cursor position) internally on startup and
> > waits for a response. This causes hang if pseudo console is
> > started in dumb terminal.
> > 
> > This patch is for fixing this issue.
> 
> Would it be feasible to implement this using a timeout instead?
> If the response isn't sent within, say, 100ms, just skip it?

Hang is caused at CreateProcessW() call, so there is no way to
use time out. It is possible to send ESC[6n before creating
pseudo console for a test and wait for responce with timeout,
however, if the terminal is dumb, garbage ^[[6n will be displayed.

-- 
Takashi Yano 


Re: [PATCH v3 3/3] winsup/doc/faq-api.xml(faq.api.timezone): explain time zone updates

2020-08-27 Thread Corinna Vinschen
On Aug 27 01:17, Brian Inglis wrote:
> based on material from t...@iana.org mailing list sources
> ---
>  winsup/doc/faq-api.xml | 40 +++-
>  1 file changed, 35 insertions(+), 5 deletions(-)

Pushed.


Thanks,
Corinna


Re: [PATCH] Cygwin: console: Replace WriteConsoleA() with WriteConsoleW().

2020-08-27 Thread Corinna Vinschen
On Aug 27 12:35, Takashi Yano via Cygwin-patches wrote:
> - To allow sending non-ASCII chars to console, all WriteConsoleA()
>   are replaced by WriteConsoleW().
>   Addresses:
>   https://cygwin.com/pipermail/cygwin-patches/2020q3/010476.html
> ---
>  winsup/cygwin/fhandler_console.cc | 89 ---
>  1 file changed, 47 insertions(+), 42 deletions(-)

Pushed.


Thanks,
Corinna


Re: [PATCH] Cygwin: fhandler_fifo::delete_client_handler: improve efficiency

2020-08-27 Thread Corinna Vinschen
On Aug 26 22:03, Ken Brown via Cygwin-patches wrote:
> Delete a client handler by swapping it with the last one in the list
> instead of calling memmove.
> ---
>  winsup/cygwin/fhandler_fifo.cc | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/winsup/cygwin/fhandler_fifo.cc b/winsup/cygwin/fhandler_fifo.cc
> index b3c4c4a25..75c8406fe 100644
> --- a/winsup/cygwin/fhandler_fifo.cc
> +++ b/winsup/cygwin/fhandler_fifo.cc
> @@ -377,14 +377,14 @@ fhandler_fifo::add_client_handler (bool 
> new_pipe_instance)
>return 0;
>  }
>  
> -/* Always called with fifo_client_lock in place. */
> +/* Always called with fifo_client_lock in place.  Delete a
> +   client_handler by swapping it with the last one in the list. */
>  void
>  fhandler_fifo::delete_client_handler (int i)
>  {
>fc_handler[i].close ();
>if (i < --nhandlers)
> -memmove (fc_handler + i, fc_handler + i + 1,
> -  (nhandlers - i) * sizeof (fc_handler[i]));
> +fc_handler[i] = fc_handler[nhandlers];
>  }
>  
>  /* Delete handlers that we will never read from.  Always called with
> -- 
> 2.28.0

Yup, please push.


Thanks,
Corinna


Re: [PATCH 0/3] CI update

2020-08-27 Thread Corinna Vinschen
On Aug 26 22:04, Jon Turney wrote:
> Since we recently had the unpleasant surprise of discovering that Cygwin
> doesn't build on F32 when trying to make a release, this adds some CI to
> test that.
> 
> Open issues: Since there don't seem to be RedHat packages for cocom, this
> grabs a cocom package from some random 3rd party I found on the internet.
> That might not be the best idea :).
> 
> This also updates other CI configurations.
> 
> Jon Turney (3):
>   Cygwin: Add .appveyor.yml
>   Cygwin: Add github action to cross-build on Fedora
>   Cygwin: Remove .drone.yml
> 
>  .appveyor.yml| 69 
>  .drone.yml   | 58 --
>  .github/workflows/cygwin.yml | 45 +++
>  3 files changed, 114 insertions(+), 58 deletions(-)
>  create mode 100644 .appveyor.yml
>  delete mode 100644 .drone.yml
>  create mode 100644 .github/workflows/cygwin.yml
> 
> -- 
> 2.28.0

Fine with me.  Please push.


Thanks,
Corinna


Re: [PATCH] Cygwin: pty: Disable pseudo console if TERM is dumb or not set.

2020-08-27 Thread Corinna Vinschen
On Aug 27 13:07, Takashi Yano via Cygwin-patches wrote:
> On Wed, 26 Aug 2020 19:36:06 +0200
> Corinna Vinschen wrote:
> > On Aug 26 21:00, Takashi Yano via Cygwin-patches wrote:
> > > Pseudo console generates escape sequences on execution of non-cygwin
> > > apps.  If the terminal does not support escape sequence, output will
> > > be garbled. This patch prevents garbled output in dumb terminal by
> > > disabling pseudo console.
> > 
> > I'm a bit puzzled by this patch.  We had code handling emacs and dumb
> > terminals explicitely in the early forms of the first incarnation of
> > the pseudo tty code, but fortunately you found a way to handle this
> > without hardcoding terminal types into Cygwin.  Why do you think we
> > have to do this now?
> 
> What previously disccussed was the problem that the clearing
> screen at pty startup displays garbage (^[[H^[[2J) in emacs.
> Finally, this was settled by eliminating clear-screen and
> triggering redraw-screen instead at the first execution of
> non-cygwin app.
> 
> However, the problem reported in
> https://cygwin.com/pipermail/cygwin/2020-August/245983.html
> still remains. 
> 
> What's worse in the new implementation, pseudo console sends
> ESC[6n (querying cursor position) internally on startup and
> waits for a response. This causes hang if pseudo console is
> started in dumb terminal.
> 
> This patch is for fixing this issue.

Would it be feasible to implement this using a timeout instead?
If the response isn't sent within, say, 100ms, just skip it?


Corinna


Re: [PATCH v2 3/3] winsup/doc/faq-api.xml(faq.api.timezone): explain time zone updates

2020-08-27 Thread Brian Inglis
On 2020-08-26 02:16, Corinna Vinschen wrote:
> On Aug 25 06:57, Brian Inglis wrote:
>> based on material from t...@iana.org mailing list sources
>> ---
>>  winsup/doc/faq-api.xml | 29 +
>>  1 file changed, 25 insertions(+), 4 deletions(-)
>>
>> diff --git a/winsup/doc/faq-api.xml b/winsup/doc/faq-api.xml
>> index 829e4d7febd8..365e301555a5 100644
>> --- a/winsup/doc/faq-api.xml
>> +++ b/winsup/doc/faq-api.xml
>> @@ -385,13 +385,34 @@ Cygwin version number details, check out the
>>  
>>  
>>  
>> -Why isn't timezone set correctly?
>> +Why isn't time zone set correctly?
>>  
>>  
>> -(Please note: This section has not yet been 
>> updated for the latest net release.)
>> -
>> -Did you explicitly call tzset() before checking the value of timezone?
>> +Did you explicitly call tzset() before checking the value of time 
>> zone?
>>  If not, you must do so.
>> +Time zone settings are updated by changes to the tzdata package included in 
>> all
>> +Cygwin installations.
> 
> Shouldn't a new paragraph start at this point?
> 
> Actually, maybe this could be changed a bit more.  The question might be
> better called "Why isn't my (or the) time zone set correctly?" and the
> order inside the FAQ seems a bit upside down now.  Starting with a reply
> only affecting developers with self-written applications is rather weird
> given the general discussion only follows afterwards.
> 
> The discussion on how time zones are updated in real life might be the
> better start, then how to rectify local settings by running Setup, and
> only then implications for developers.
> 
> Make sense?
> 
> Thanks, I pushed the other two patches in the meantime.

Thanks, changed as suggested: have a look and feel free to tweak minor nits or
bounce back if more issues.

Getting better with git due to this intense pressure! ;^>
Still easier to hack patches and reapply than figure out how to mess around with
them using git.

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in IEC units and prefixes, physical quantities in SI.]


[PATCH v3 3/3] winsup/doc/faq-api.xml(faq.api.timezone): explain time zone updates

2020-08-27 Thread Brian Inglis
based on material from t...@iana.org mailing list sources
---
 winsup/doc/faq-api.xml | 40 +++-
 1 file changed, 35 insertions(+), 5 deletions(-)

diff --git a/winsup/doc/faq-api.xml b/winsup/doc/faq-api.xml
index 829e4d7febd8..6283fb663d77 100644
--- a/winsup/doc/faq-api.xml
+++ b/winsup/doc/faq-api.xml
@@ -385,13 +385,43 @@ Cygwin version number details, check out the
 
 
 
-Why isn't timezone set correctly?
+Why isn't my time (or zone) set correctly?
 
 
-(Please note: This section has not yet been 
updated for the latest net release.)
-
-Did you explicitly call tzset() before checking the value of timezone?
-If not, you must do so.
+Daylight saving (Summer time) and other time zone changes are
+decided on by politicians, and announced by government officials,
+sometimes with short or no notice, so time zone updates are released at
+least a few, and sometimes several, times a year.
+Details of changes are not known until they are announced publicly by
+officials, often in foreign languages.
+Those details then have to be noticed, possibly translated, passed to,
+picked up, and applied by the official tzdata
+source package maintainers.
+That information has to be compiled, checked, and released publicly in
+an update to the official tzdata source package.
+Then those changes have to be picked up and applied to the Cygwin
+tzdata package, which has to be updated, built,
+tested, and released publicly.
+
+Time zone settings are updates to the daylight saving (Summer
+time) rules for dates of changes, hour offsets from UTC of time zones,
+and the geographic regions to which those rules and offsets apply,
+provided in the tzdata package included in all
+Cygwin installations.
+Have you run the Cygwin Setup program recently to update at least
+the tzdata package?
+
+Are you developing applications using times which may be affected
+by time zones?
+Since the ctime(), localtime(),
+mktime(), and strftime() functions
+are required to set time zone information as if by calling
+tzset(), there is no need for an explicit
+tzset() call before using these functions.
+However, if none of the above functions are called first, applications
+should ensure tzset() is called explicitly before
+using any other time functions, or checking or using time zone
+information.
 
 
 
-- 
2.28.0