Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange echoing behavior on Windows #5

Open
ralphlange opened this issue May 20, 2015 · 8 comments
Open

Strange echoing behavior on Windows #5

ralphlange opened this issue May 20, 2015 · 8 comments

Comments

@ralphlange
Copy link
Owner

I am running:

  • procServ build from upstream sources (GitHub) on cygwin64 serving to port 12345
  • child: a native Windows64 built 3.15 (bazaar trunk) IOC: just the softIoc exe from Base

When I connect using 'nc -C' on cygwin:
The connection is running in "line mode". (Control chars are sent on hitting Enter.)
Prompt is double: "epics> epics> ".
I see every character as it is typed, plus it is echoed once I hit Return: I get the another echo of the commend and an empty line before the result.

When I connect using 'nc' on cygwin:
The connection is running in "line mode". (Control chars are sent on hitting Enter.)
Prompt is single: "epics> ".
I see every character as it is typed, plus it is echoed once I hit Return: I get the another echo of the commend (no empty line) before the result.

When I connect using PuTTY (telnet mode):
The connection is running in "line mode". (Control chars are sent on hitting Enter.)
Prompt is single: "epics> ".
I do not see characters as they are typed, it is echoed once I hit Return: I get the another echo of the commend (no empty line) before the result.

When I connect using native 'telnet' on Windows:
The connection is running in "char mode". (Control chars are sent immediately.)
Prompt is double: "epics> epics> ".
I see every character as it is typed, once I hit Return I get an empty line before the result.

When I connect using 'telnet' on cygwin:
The connection is running in "char mode". (Control chars are sent immediately.)
Prompt is single: "epics> ".
I see every character as it is typed, no additional echoes, result follows immediately.

This last mode is actually flawless and exactly the wanted behavior.

I would say that the issue is not between procServ and the IOC, but between the client and procServ.

@Robatronic
Copy link

Did anything ever come of this one....?

@ralphlange
Copy link
Owner Author

Nope.
And given that we're not using Windows, I don't think I will invest time in this...
As Windows, procServ and Cygwin have had a few new versions in the last 6 years, re-running the test would be the first thing to try.
Are you seeing this kind of issue?

@Robatronic
Copy link

Robatronic commented Sep 8, 2021

Something similar.

Running procServ in a Windows cmd prompt with an ioc that starts out of batch file.

When connecting with telnet, the welcome message shows up, but no ioc prompt....

@Robatronic
Copy link

V2.8 of procServ and Cygwin DLL: 3.2.0

@Robatronic
Copy link

I haven't tried all the variations you describe above...

@ralphlange
Copy link
Owner Author

Ouh.
I always run the IOC directly as the procServ child. Never considered to put a batch between procServ and the child IOC. Why do you?
That would be the first test, then: Run the IOC directly as the procServ child.

@Robatronic
Copy link

To set up the environment before running the IOC; such as running dllPath.bat, setting some EPICS env vars that kind of thing.

We do similar here with Linux and startup scripts.

It was a bit late (our time) when I was looking at it yesterday. I'm going to set up an environment by hand and call procServ that way. See if it changes anything....

@anjohnson
Copy link

I'm getting similar iocsh behavior which I initially suspected might have been due to the Busybox v1.23.1 implementation of telnet, but now I'm not so sure. This IOC is running on a Xilinx GNU/Linux kernel 3.15.0 on armv7l (an i-Tech Libera Spark BPM), and it does not use libreadline.

We run a GNU Screen session on a different machine that uses ssh -t sioc@lsparksp004 telnet 127.0.0.1 10000 to connect to the IOC console. The Screen session shows this at the top:

@@@ Welcome to procServ (procServ Process Server 2.6.0)
@@@ Use ^X to kill the child, auto restart is ON, use ^T to toggle auto restart
@@@ procServ server PID: 1098
@@@ Server startup directory: /C2/iocs/anj/libera-spark/main/iocBoot/ioc2s01bpmap1
@@@ Child startup directory: /C2/iocs/anj/libera-spark/main/iocBoot/ioc2s01bpmap1
@@@ Child "ioc2s01bpmap1" started as: /C2/iocs/anj/libera-spark/main/iocBoot/iocLaunch
@@@ Child "ioc2s01bpmap1" PID: 1099
@@@ procServ server started at: Thu Jan 11 13:37:16 2024
@@@ Child "ioc2s01bpmap1" started at: Thu Jan 11 1
Entering character mode
Escape character is '^]'.

3:37:17 2024
@@@ 0 user(s) and 0 logger(s) connected (plus you)


ioc2s01bpmap1> ioc2s01bpmap1>

ioc2s01bpmap1> ioc2s01bpmap1> pwd

/C2/iocs/anj/libera-spark/main
ioc2s01bpmap1> ioc2s01bpmap1> 

Every time I press the Return key it immediately outputs a blank line before the command output, and I get duplicate prompts from iocsh after the command output. Switching telnet into line mode makes it worse as it then echos the line typed on pressing Return:

ioc2s01bpmap1> ioc2s01bpmap1>
Console escape. Commands are:

 l      go to line mode
 c      go to character mode
 z      suspend telnet
 e      exit telnet

Entering line mode
Escape character is '^C'.
pwd
pwd

/C2/iocs/anj/libera-spark/main
ioc2s01bpmap1> ioc2s01bpmap1> pwd
pwd

/C2/iocs/anj/libera-spark/main
ioc2s01bpmap1> ioc2s01bpmap1> ^C
Console escape. Commands are:

 l      go to line mode
 c      go to character mode
 z      suspend telnet
 e      exit telnet

Entering character mode
Escape character is '^]'.


ioc2s01bpmap1> ioc2s01bpmap1>

Not much I can do at the telnet prompt or on its command line, so if it's telnet causing it I can't fix that. However then I wondered if the ssh port forwarding would help, so I just tried this:

$ ssh -W 127.0.0.1:10000 sioc@lsparksp004-ops
@@@ Welcome to procServ (procServ Process Server 2.6.0)
@@@ Use ^X to kill the child, auto restart is ON, use ^T to toggle auto restart
@@@ procServ server PID: 1098
@@@ Server startup directory: /C2/iocs/anj/libera-spark/main/iocBoot/ioc2s01bpmap1
@@@ Child startup directory: /C2/iocs/anj/libera-spark/main/iocBoot/ioc2s01bpmap1
@@@ Child "ioc2s01bpmap1" started as: /C2/iocs/anj/libera-spark/main/iocBoot/iocLaunch
@@@ Child "ioc2s01bpmap1" PID: 1099
@@@ procServ server started at: Thu Jan 11 13:37:16 2024
@@@ Child "ioc2s01bpmap1" started at: Thu Jan 11 13:37:17 2024
@@@ 1 user(s) and 0 logger(s) connected (plus you)
????"

ioc2s01bpmap1> 

ioc2s01bpmap1> pwd
pwd
/C2/iocs/anj/libera-spark/main
ioc2s01bpmap1> 

That is a bit better since there's only one iocsh prompt now, but it looks like telnet in line-mode with the command being echoed, and pressing Ctrl+T there seems to trigger an ssh response instead of the procServ one: load: 3.00 cmd: ssh 73530 waiting 0.01u 0.00s. Pressing Ctrl+T through the telnet port (in char mode) gives the expected @@@ Toggled auto restart to OFF.

Characters typed into the telnet window are immediately also shown in the forwarded window, but not vice versa, nothing appears in the telnet stream until I press Return in the other. Pressing Return in the port-forwarded session also only outputs a single newline to the telnet session, so the blank lines are definitely related to the input processing. This is my port-forwarded window where I was typing:

ioc2s01bpmap1> 

ioc2s01bpmap1> echo "Hello"
echo "Hello"
Hello
ioc2s01bpmap1> 

ioc2s01bpmap1>          

This was the telnet window for the same time period:

ioc2s01bpmap1> 
ioc2s01bpmap1> echo "Hello"
Hello
ioc2s01bpmap1> 
ioc2s01bpmap1> 

I tried using system "stty ..." to examine and change the terminal settings, but changing the ones that were different to my ssh login didn't seem to make any difference. Any ideas there would be welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants