Frank,

I don’t know if this is related, but I have found that I always have to enter 
this command after logging into the POSIX /bin/sh on z/OS via regular telnet 
(not SSH):

stty erase ^?

In other words, erase (backspace in stty terms) is Cntl-? instead of Cntl-H.

HTH

Peter

From: IBM Mainframe Discussion List <[email protected]> On Behalf Of 
Frank Swarbrick
Sent: Wednesday, April 9, 2025 6:08 PM
To: [email protected]
Subject: Issue with z/OS pseudo-terminal programming


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://urldefense.com/v3/__https://github.com/zyedidia/micro__;!!Ebr-cpPeAnfNniQ8HSAI-g_K5b7VKg!JVb1Eoy1pjNCjBpOQ7S6SJe3V42ErNteZiSZWqmH-Zo8C7vkDbhVmHTI6sMQZ5qC84PnWmvXA5ms5uLl5m8-lNF_1OSiBFzFgQ$<https://urldefense.com/v3/__https:/github.com/zyedidia/micro__;!!Ebr-cpPeAnfNniQ8HSAI-g_K5b7VKg!JVb1Eoy1pjNCjBpOQ7S6SJe3V42ErNteZiSZWqmH-Zo8C7vkDbhVmHTI6sMQZ5qC84PnWmvXA5ms5uLl5m8-lNF_1OSiBFzFgQ$>

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://urldefense.com/v3/__https://github.com/creack/pty__;!!Ebr-cpPeAnfNniQ8HSAI-g_K5b7VKg!JVb1Eoy1pjNCjBpOQ7S6SJe3V42ErNteZiSZWqmH-Zo8C7vkDbhVmHTI6sMQZ5qC84PnWmvXA5ms5uLl5m8-lNF_1ORlILujNg$<https://urldefense.com/v3/__https:/github.com/creack/pty__;!!Ebr-cpPeAnfNniQ8HSAI-g_K5b7VKg!JVb1Eoy1pjNCjBpOQ7S6SJe3V42ErNteZiSZWqmH-Zo8C7vkDbhVmHTI6sMQZ5qC84PnWmvXA5ms5uLl5m8-lNF_1ORlILujNg$>

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://urldefense.com/v3/__https://github.com/fswarbrick/xpty__;!!Ebr-cpPeAnfNniQ8HSAI-g_K5b7VKg!JVb1Eoy1pjNCjBpOQ7S6SJe3V42ErNteZiSZWqmH-Zo8C7vkDbhVmHTI6sMQZ5qC84PnWmvXA5ms5uLl5m8-lNF_1ORFgPk6qA$<https://urldefense.com/v3/__https:/github.com/fswarbrick/xpty__;!!Ebr-cpPeAnfNniQ8HSAI-g_K5b7VKg!JVb1Eoy1pjNCjBpOQ7S6SJe3V42ErNteZiSZWqmH-Zo8C7vkDbhVmHTI6sMQZ5qC84PnWmvXA5ms5uLl5m8-lNF_1ORFgPk6qA$>



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://urldefense.com/v3/__https://github.com/fswarbrick/xpty__;!!Ebr-cpPeAnfNniQ8HSAI-g_K5b7VKg!JVb1Eoy1pjNCjBpOQ7S6SJe3V42ErNteZiSZWqmH-Zo8C7vkDbhVmHTI6sMQZ5qC84PnWmvXA5ms5uLl5m8-lNF_1ORFgPk6qA$<https://urldefense.com/v3/__https:/github.com/fswarbrick/xpty__;!!Ebr-cpPeAnfNniQ8HSAI-g_K5b7VKg!JVb1Eoy1pjNCjBpOQ7S6SJe3V42ErNteZiSZWqmH-Zo8C7vkDbhVmHTI6sMQZ5qC84PnWmvXA5ms5uLl5m8-lNF_1ORFgPk6qA$>).
  You can reply to this post, or you can enter the "Discussion" area in my xpty 
repository and respond there.



Thanks in advance!

Frank

This message and any attachments are intended only for the use of the addressee 
and may contain information that is privileged and confidential. If the reader 
of the message is not the intended recipient or an authorized representative of 
the intended recipient, you are hereby notified that any dissemination of this 
communication is strictly prohibited. If you have received this communication 
in error, please notify us immediately by e-mail and delete the message and any 
attachments from your system.


----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to