Re: Suspend doesn't work in cmd

2020-05-19 Thread Kacper Michajlow via Cygwin
On Mon, 18 May 2020 at 05:06, Takashi Yano  wrote:

> On Sun, 17 May 2020 19:57:15 +0200
> Kacper Michajlow via Cygwin  wrote:
> > Hi,
> >
> > Control keys doesn't seem to be working correctly under cmd.
> >
> > STR:
> > 1. Run bash in cmd.exe
> > 2. Run anything, in my case "seq 1 10"
> > 3. Try to suspend job with CTRL+Z or suspend printing with CTRL+S
> >
> > Ii will ignore request. Works in mintty, doesn't in cmd.
>
> Thanks for the report. This is a known problem, however,
> it is hard to fix soon.
>
> In current console implementation, ctrl-Z is processed in
> read() system call. So, if process does not call read(),
> ctlr-Z does not work.
>
> You can confirm that ctrl-Z works for cat, od, etc. which
> calls read().
>
> One solution might be to introduce a thread to handle the
> keystrokes. I wonder if it is worth enough to introduce such
> a big modification for console code.
>

Thanks for explanation. I report those bugs, because I kind of hope to get
away from mintty and use something like Windows Terminal for all envs. But
it doesn't look feasible for Cygwin.

- Kacper
--
Problem reports:  https://cygwin.com/problems.html
FAQ:  https://cygwin.com/faq/
Documentation:https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple


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

2020-05-17 Thread Kacper Michajlow via Cygwin-patches
On Sun, 17 May 2020 at 04:53, Takashi Yano via Cygwin-patches <
cygwin-patches@cygwin.com> wrote:

> - 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
>
>
Maybe also set  IXANY | IMAXBEL? For reasonable set of default values.

- Kacper


Suspend doesn't work in cmd

2020-05-17 Thread Kacper Michajlow via Cygwin
Hi,

Control keys doesn't seem to be working correctly under cmd.

STR:
1. Run bash in cmd.exe
2. Run anything, in my case "seq 1 10"
3. Try to suspend job with CTRL+Z or suspend printing with CTRL+S

Ii will ignore request. Works in mintty, doesn't in cmd.

Cygwin built from e637d53

Thanks,
Kacper
--
Problem reports:  https://cygwin.com/problems.html
FAQ:  https://cygwin.com/faq/
Documentation:https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple


Re: "ls -la /dev" fails to write output

2020-05-16 Thread Kacper Michajlow via Cygwin
On Sat, 16 May 2020 at 21:04, Takashi Yano  wrote:

> I cannot reproduce your problem. Could you please provide
> step by step procedure to reproduce your problem?


I though I lost it, because indeed there is prerequisite. It fails when
there is at least one pty allocated.

STR:
1. Open mintty (will allocate pty)
2. Open cmd with Cygwin's bash
3. ls -la /dev will fail in cmd.

-Kacper
--
Problem reports:  https://cygwin.com/problems.html
FAQ:  https://cygwin.com/faq/
Documentation:https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple


Re: "tmux open terminal failed: not a terminal" in terminal emulators other than mintty

2020-05-16 Thread Kacper Michajlow via Cygwin
On Fri, 27 Mar 2020 at 21:15, Michael Wild via Cygwin 
wrote:

> Hi
>
> As the maintainer of the tmux Cygwin package I have to admit that I have no
> idea how to fix this. Sorry.
>

Hi,

I did take a look how tmux works and what is going on in Cygwin. Here is
short summary of my findings.

* Tmux sends each client stdio fd to the server through socket. Cygwin does
not support passing file descriptors over to other processes so this fails.
* Tmux has a hack for Cygwin where it opens tty by name provided by
client...

And now there are two cases:

1. When there is no pseudo terminal. cmd.exe, (WT and most other terminal
emulators out there)
* Tmux server will try to open /dev/cons by name provided by client, but
this fails with ENOENT, because server process doesn't see this device.

2. When there is allocated pseudo terminal
* Tmux server will try to open /dev/pty by name provided by client and
actually work.

Is there a way to make tmux work with /dev/cons? I have seen in docs

/dev/cons1  Console device names are pseudo device names, only accessible
... from processes within this very console session.  This is due
to a restriction in Windows.

So it likely means that whatever we do it will not be accessible from
another process.

Is this docs still holds true in latest Windows? I have seen a path to
always allocate pty for native applications, maybe this would actually
resolve this problem too.

Best Regards,
Kacper
--
Problem reports:  https://cygwin.com/problems.html
FAQ:  https://cygwin.com/faq/
Documentation:https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple


"ls -la /dev" fails to write output

2020-05-16 Thread Kacper Michajlow via Cygwin
Hi,

Under cmd.exe listing /dev doesn't produce output. Running under strace
also fails with the following errors:

304  477235 [main] ls 8268 fhandler_console::write: 0x8000990F0, 54
126  477361 [main] ls 8268 seterrno_from_win_error:
../../../../winsup/cygwin/fhandler_console.cc:1810 windows error 6
110  477471 [main] ls 8268 geterrno_from_win_error: windows error 6 ==
errno 9
115  477586 [main] ls 8268 fhandler_console::write_normal: write failed,
handle 0x190
 97  477683 [main] ls 8268 write: -1 = write(1, 0x8000990F0, 54), errno 9

Thanks,
Kacper
--
Problem reports:  https://cygwin.com/problems.html
FAQ:  https://cygwin.com/faq/
Documentation:https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple


Re: Console doesn't work correctly under anything else than cmd or mintty

2020-05-15 Thread Kacper Michajlow via Cygwin
On Fri, 15 May 2020 at 13:45, Takashi Yano  wrote:

> ...
> Then,
> stty echoe echok echoctl echoke
> should solve the problem.
>

Indeed, but I got confused, because it does work fine in local session and
it also has -echoe -echok -echoctl -echoke... What is the difference? I'm
just curious at this point.


> This causes because cygwin does not set ECHOE, ECHOK, ECHOCTL and ECHOKE
> by default. Mintty sets them by itself. Tcsh seems also to set them.
> However, bash does not.
>

FWIW, zsh also does not set those.

Thanks for help and patience :)

- Kacper
--
Problem reports:  https://cygwin.com/problems.html
FAQ:  https://cygwin.com/faq/
Documentation:https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple


Re: Console doesn't work correctly under anything else than cmd or mintty

2020-05-15 Thread Kacper Michajlow via Cygwin
On Fri, 15 May 2020 at 01:47, Takashi Yano  wrote:

> Please check the result of
> xxd
> Ctrl-V Backspace Enter Ctrl-D
>


Here is comparison with running ssh connection to the same machine in WT
and Mintty. Also I noticed that selecting and copying multi-line output of
stty in Windows Terminal was missing new line and was filled with spaces to
the end on terminal window.

Windows Terminal:

$ echo $TERM
xterm-256color
$ stty
speed 38400 baud; line = 0;
eol = M-^?; eol2 = M-^?;
-brkint -imaxbel iutf8
-echoe -echok -echoctl -echoke
$ xxd
⌂
: 7f0a ..
$ stty -a
speed 38400 baud; rows 38; columns 139; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = M-^?; eol2 =
M-^?; swtch = ; start = ^Q; stop = ^S; susp = ^Z;
rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon
-ixoff -iuclc -ixany -imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0
ff0
isig icanon iexten echo -echoe -echok -echonl -noflsh -xcase -tostop
-echoprt -echoctl -echoke -flusho -extproc

Mintty:

$ echo $TERM
xterm-256color
$ stty
speed 38400 baud; line = 0;
eol = M-^?; eol2 = M-^?;
-brkint ixany iutf8
$ xxd
^?
: 7f0a ..
$ stty -a
speed 38400 baud; rows 41; columns 135; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = M-^?; eol2 =
M-^?; swtch = ; start = ^Q; stop = ^S; susp = ^Z;
rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon
-ixoff -iuclc ixany imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0
ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
echoctl echoke -flusho -extproc

--
In local session, both Mintty and WT in xxd test produce:
: 0a

- Kacper
--
Problem reports:  https://cygwin.com/problems.html
FAQ:  https://cygwin.com/faq/
Documentation:https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple


Re: Console doesn't work correctly under anything else than cmd or mintty

2020-05-14 Thread Kacper Michajlow via Cygwin
On Thu, 14 May 2020 at 05:33, Takashi Yano  wrote:

> I guess setting
> stty erase '^?'
> on the host  resolves this problem.
>

Nope, it still doesn't work. And '^?' default so it doesn't change
anything. Please note that in bash Backspace works fine, but in read
command (or any other program that ask input from stdin) it fails.
--
Problem reports:  https://cygwin.com/problems.html
FAQ:  https://cygwin.com/faq/
Documentation:https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple


Console doesn't work correctly under anything else than cmd or mintty

2020-05-12 Thread Kacper Michajlow via Cygwin
Hi,

I was testing latest master (e637d53) and console is clunky in anything
that isn't cmd.exe or mintty. I tested Microsoft Terminal and ConEmu.

For example navigating with arrows doesn't work in vim. In zsh searching
history with up arrow when there is beginning of the command doesn't work.
And so on, sometimes Home button doesn't work to jump to beginning of the
line or Backspace to clear input.

It used to work better. I have tried CYGWIN=disable_pcon but didn't help
really.

Is it known problem? Is there a workaround? Should this be fixed in Cygwin
or somewhere else?

Thanks,
Kacper
--
Problem reports:  https://cygwin.com/problems.html
FAQ:  https://cygwin.com/faq/
Documentation:https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple


Re: "tmux open terminal failed: not a terminal" in terminal emulators other than mintty

2020-03-27 Thread Kacper Michajlow via Cygwin
> You can try another pty emulator. F.e. wintty.

Not really interested in some dead projects ;p

Let me rephrase the question, because I misspoke.

Currently Cygwin works acceptably only under Mintty as far as I can see.
Running it from cmd or any of terminal emulators listed before result in
sub-par performance. Even things like Home button to move cursor doesn't
work, as originally stated tmux doesn't work and so on.

Now that Windows is making improvements to their console
https://devblogs.microsoft.com/commandline/windows-command-line-introducing-the-windows-pseudo-console-conpty/
it may be good time to improve Cygwin's compatibility.

Since my first mail I looked at git log and seen pty related changes,
compiled latest Cygwin, but it doesn't work better and even worse, because
mouse stopped working over ssh in tmux.

That said, I guess my really questions are:
1. Is the goal to improve Windows console compatibility?
2. If yes, what is the current status and challenges?
3. And my original question will the tmux work? :)

Projects like Windows Terminal are convenient way to have PS, CMD, Cygwin
and its child MSYS in one window hence I am wondering if it will be
possible without drawbacks.
--
Problem reports:  https://cygwin.com/problems.html
FAQ:  https://cygwin.com/faq/
Documentation:https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple


Re: ACL: Why SYSTEM doesn't have full access set on newly created files?

2020-03-27 Thread Kacper Michajlow via Cygwin
 > It is easily fixable by mounting directories outside Cygwin tree with
"noacl" flag.
> It is even required to do so, if you expect interoperation between Cygwin
and
> native tools.

Indeed, this is acceptable workaround for me. Then again it is not really
interoperable out of the box, even tho it may looks like. I mean all
Windows drives are mounted, you can easily jump through all directories,
mess with them until you find that it doesn't work and it is " required" to
access those files differently. One may be fooled by the seemingly no
boundary between Cygwin and Windows.

> Don't do that on Cygwin directory tree, you break Cygwin doing this.

I was talking about project cloned outside Cygwin tree, by using Cygwin's
git. I do understand that Cygwin sysroot is it's own thing.
Also the Cygwin tree have let say "normal" permissions set. I mean there is
not deny on SYSTEM and so on.

> Answered multiple time in the last 20 years. Read the docs.

If it were so easy to find. And it was changed like 5 years ago how ACLs
are handled, so I really doubt it was described 20 years ago. I just wanted
to understand why SYSTEM described in Cygwin's docs as "A special account
which has all kinds of dangerous rights, sort of an uber-root account."
have those rights limited.

> They are in correct order. Just not canonical order, which Explorer only
supports.

I was not implying they are in incorrect order... The question was, could
Cygwin apart from having permissions in correct order, have them in
Explorer compatible order also?

> Yes.

Thank you for comprehensive answer.

-Kacper
--
Problem reports:  https://cygwin.com/problems.html
FAQ:  https://cygwin.com/faq/
Documentation:https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple


ACL: Why SYSTEM doesn't have full access set on newly created files?

2020-03-26 Thread Kacper Michajlow via Cygwin
Hi,

I know that Cygwin tries to emulate UNIX permissions using ACL. But I don't
understand why SYSTEM doesn't have Full Control allowed or even modify.
Shouldn't generally SYSTEM have access to everything?

I have cloned git repository of UWP application, and deployment fails in VS
with error:
"DEP0700: Registration of the app failed. [0x80070005] Deployment Register
operation with target volume F: on Package ... from:  (AppxManifest.xml)
 failed with error 0x80070005."
It is easily fixable by adding Full Control for SYSTEM on all files, but
that wasn't my first idea, so it took some time :) Long story short, it
fails and might be not obvious for the user why, at the first glance.

Also when accessing ACL from Explorer it throws:
"The permissions on  are incorrectly ordered, which may cause
some entries to be ineffective."
And forces me to reorder them if I want to edit.

That said, I have three questions:
1. Could Cygwin by default give SYSTEM full control? If not, why?
2. Could Cygwin put ACL in order, so Windows doesn't complain about it?
3. Do we need "NULL SID" entry?

-Kacper
--
Problem reports:  https://cygwin.com/problems.html
FAQ:  https://cygwin.com/faq/
Documentation:https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple


"tmux open terminal failed: not a terminal" in terminal emulators other than mintty

2020-03-26 Thread Kacper Michajlow via Cygwin
Hi,

I'm not exactly sure who to blame for this issue, but I figured I will ask
you guys. Tmux fails to open in anything else than mintty it seems like. It
works from ssh session, probably because pseudo-tty is allocated, but
except that tmux will fail.

There are multiple reports about that, without solutions:
https://github.com/cmderdev/cmder/issues/453
https://github.com/alacritty/alacritty/issues/1687
https://github.com/zeit/hyper/issues/3608
https://github.com/microsoft/terminal/issues/5132

Do you think we could make it work without using mintty?
If yes, should the changes be made in the Cygwin, tmux or terminal emulator
code?
Any pointer would be good so I can poke others :)

Thanks,
Kacper
--
Problem reports:  https://cygwin.com/problems.html
FAQ:  https://cygwin.com/faq/
Documentation:https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple