Terminal doesn't work right after OS 10.15; must hit return 3 times.

I am a long time C programmer. I have a large program that is a CAS (computer algebra system). It runs under terminal. It runs fine on Linux and always did on Mac OS.

I never bothered to update past OS 10.14 until recently. Since OS 10.15 there is a problem. Reading from the terminal does not work right. Same thing happens on OS 12. Previously one types a command and hits return. But now it won't work unless one hits return three times. Why three works I have no idea. I changed from zsh to bash and it makes no difference. Again, everything is fine on Linux. Any ideas??

Does this only affect your program running in Terminal? Or do you see the same problem in other command-line tools, like say openssl?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Only in terminal. But that's very important! In the procedure that handles terminal I/O I use fgetc, ungetc, getc, foef. Maybe something changed in their implementation?

I guess you need to add some debugging and see what those fgetc etc. calls actually receive.

I would suggest running under strace if that were available, is there something similar?

Are you checking for errors on all of those function calls?

Use of ungetc is interesting.

Do let us know what the problem was when you find it.

Only in terminal.

That’s not quite what I asked. Rather, I was asking whether your app is the only command-line tool that’s having this problem. If, for example, you run the openssl tool, does it also have the issue? In my setup, I ran this:

% openssl
OpenSSL> help
openssl:Error: 'help' is an invalid command.

…

and I only had to press Return once after typing help.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

openssl works fine; just hitting return once works. Evidently something changed in one of the utilities I use. As I wrote above: fgetc, ungetc, getc, foef. This is old code that still works fine in Linux.

openssl works fine; just hitting return once works.

OK, cool. I just want to make sure that there wasn’t a problem with your Terminal setup.

Evidently something changed in one of the utilities I use. As I wrote above: fgetc, ungetc, getc, feof.

That certainly does seem likely. Try pulling the command reading code out of your main program and into a tiny test tool. Does it exhibit the same behaviour?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I worked around it. I put in some code that actually should have been there but never mattered. Now it fixed the problem. That still doesn't explain what happened to Terminal or some of the low level C-commands in OS 10.15. Thanks for your comments.

Terminal doesn't work right after OS 10.15; must hit return 3 times.
 
 
Q