I posted this to IBM-MAIN a few days ago, but haven't received any useful response yet. Maybe someone from IBM can look in to it?
I am implementing z/OS support for the "micro" TUI editor, which is written in Go. The current source code, sans z/OS support, is here:
https://github.com/zyedidia/micro
One feature of the editor is the ability to open a "terminal window". This feature makes use of a go PTY package, which is found here:
https://github.com/creack/pty
Partial support for z/OS was added to this package by (if I recall correctly) an intern on the Go for z/OS team. I had to add some additional code to get the Micro terminal window support to work (specifically, something to deal with EBCDIC newline to ASCII CRLF support), but that is not the issue that I am looking to resolve with this post.
The z/OS execution of the test suite for the package fails on one particular test case. That test case deals with the backspace control character. After figuring out how the results on z/OS differ from the expected results I have created a C language project (just one program) that demonstrates the issue. I did this so that it is demonstrated that the same issue is present within just the C runtime, and is not specific to the Go runtime. This package is here:
https://github.com/fswarbrick/xpty
The README.MD file in this package goes in to detail about the issue. But the crux of it is that z/OS pseudo-terminal support appears to behave in a manner a bit differently than (all other?) POSIX environments. My specific tests were on z/OS and Linux (for x86/64). Below are the outputs from my test program, xpty.c. I'm not sure how the backspace control character will present itself within this post, so I have also displayed the hex values of the results.
Linux results:
Pty write bytes 7: 01293
30 31 32 39 8 33 a
--------------------------------
Pty read result: 7: 01293
30 31 32 39 8 33 a
--------------------------------
Tty read result: 9: 0129^H3
30 31 32 39 5e 48 33 d a
--------------------------------
Z/OS results:
MVS
master
Terminal /dev/ptyp0008 3 819 0
Terminal /dev/ptyp0008 3 819 1047
slave
Terminal /dev/ttyp0008 4 819 0
Terminal /dev/ttyp0008 4 819 1047
Pty write bytes 7: 01293
30 31 32 39 8 33 a
--------------------------------
Pty read result: 5: 0123
30 31 32 33 a
--------------------------------
Tty read result: 9: 0129 3
30 31 32 39 8 20 8 33 a
--------------------------------
The result files (zos_results.txt and linux_results.txt) are also part of my xpty package on github. If you are interested in helping me resolve this issue, please take a look at this package (again, that's https://github.com/fswarbrick/xpty). You can reply to this post, or you can enter the "Discussion" area in my xpty repository and respond there.
(By the way, I seem to have referred to the Pty file as the Tty file and visa versa, but I'm just going to leave it as is. Hopefully it doesn't confuse things too much.)
Thanks.
------------------------------
Frank Swarbrick
------------------------------