[PATCH] Cygwin: termios: Set ECHOE, ECHOK, ECHOCTL and ECHOKE by default.

2020-05-16 Thread Takashi Yano via Cygwin-patches
- Backspace key does not work correctly in linux session opend by
  ssh from cygwin console if the shell is bash. This is due to lack
  of these flags.

  Addresses: https://cygwin.com/pipermail/cygwin/2020-May/244837.html.
---
 winsup/cygwin/fhandler_termios.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/fhandler_termios.cc 
b/winsup/cygwin/fhandler_termios.cc
index b6759b0a7..b03478b87 100644
--- a/winsup/cygwin/fhandler_termios.cc
+++ b/winsup/cygwin/fhandler_termios.cc
@@ -33,7 +33,8 @@ fhandler_termios::tcinit (bool is_pty_master)
   tc ()->ti.c_iflag = BRKINT | ICRNL | IXON | IUTF8;
   tc ()->ti.c_oflag = OPOST | ONLCR;
   tc ()->ti.c_cflag = B38400 | CS8 | CREAD;
-  tc ()->ti.c_lflag = ISIG | ICANON | ECHO | IEXTEN;
+  tc ()->ti.c_lflag = ISIG | ICANON | ECHO | IEXTEN
+   | ECHOE | ECHOK | ECHOCTL | ECHOKE;
 
   tc ()->ti.c_cc[VDISCARD] = CFLUSH;
   tc ()->ti.c_cc[VEOL] = CEOL;
-- 
2.21.0



[PATCH] Cygwin: pty: Call FreeConsole() only if attached to current pty.

2020-05-16 Thread Takashi Yano via Cygwin-patches
- After commit 071b8e0cbd4be33449c12bb0d58f514ed8ef893c, the problem
  reported in https://cygwin.com/pipermail/cygwin/2020-May/244873.html
  occurs. This is due to freeing console device accidentally rather
  than pseudo console. This patch makes sure to call FreeConsole()
  only if the process is attached to the pseudo console of the current
  pty.
---
 winsup/cygwin/fhandler_tty.cc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
index 8547ec7c4..467784255 100644
--- a/winsup/cygwin/fhandler_tty.cc
+++ b/winsup/cygwin/fhandler_tty.cc
@@ -708,7 +708,7 @@ fhandler_pty_slave::~fhandler_pty_slave ()
   if (!get_ttyp ())
 {
   /* Why comes here? Who clears _tc? */
-  if (freeconsole_on_close)
+  if (freeconsole_on_close && get_minor () == pcon_attached_to)
{
  FreeConsole ();
  pcon_attached_to = -1;
@@ -739,7 +739,7 @@ fhandler_pty_slave::~fhandler_pty_slave ()
   if (used == 0)
{
  init_console_handler (false);
- if (freeconsole_on_close)
+ if (freeconsole_on_close && get_minor () == pcon_attached_to)
{
  FreeConsole ();
  pcon_attached_to = -1;
@@ -3006,7 +3006,7 @@ fhandler_pty_slave::fixup_after_exec ()
   if (used == 1 /* About to close this tty */)
{
  init_console_handler (false);
- if (freeconsole_on_close)
+ if (freeconsole_on_close && get_minor () == pcon_attached_to)
{
  FreeConsole ();
  pcon_attached_to = -1;
-- 
2.21.0



[PATCH] libc: Replace i386/sys/fenv.h symlink with an #include shim

2020-05-16 Thread David Macek via Cygwin-patches
Same reasoning as fbaa0967.

Signed-off-by: David Macek 
---

Excuse my ignorance, but is this acceptable?  I'm not sure
what actually happens with these files, but it'd be nice to
get rid of the last symlink in the repo.

 newlib/libc/machine/i386/sys/fenv.h | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)
 mode change 12 => 100644 newlib/libc/machine/i386/sys/fenv.h

diff --git a/newlib/libc/machine/i386/sys/fenv.h 
b/newlib/libc/machine/i386/sys/fenv.h
deleted file mode 12
index 218057825e..00
--- a/newlib/libc/machine/i386/sys/fenv.h
+++ /dev/null
@@ -1 +0,0 @@
-../../x86_64/sys/fenv.h
\ No newline at end of file
diff --git a/newlib/libc/machine/i386/sys/fenv.h 
b/newlib/libc/machine/i386/sys/fenv.h
new file mode 100644
index 00..d2c41a6d5a
--- /dev/null
+++ b/newlib/libc/machine/i386/sys/fenv.h
@@ -0,0 +1,5 @@
+/*
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#include "../../x86_64/sys/fenv.h"
-- 
2.26.2.windows.1