Terminal must be reset using stty after running wine program

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
johnmudd
Newbie
Newbie
Posts: 1
Joined: Fri Oct 25, 2013 10:43 am

Terminal must be reset using stty after running wine program

Post by johnmudd »

I'm running wine 1.6 on Ubuntu 13.04. I have to reset my terminal using "stty sane" after running any program in wine. Here's an example. Any suggestions?

Code: Select all

$ wine --version
wine-1.6
$ which date.exe
/home/mudd/.wine/drive_c/MinGW/msys/1.0/bin//date.exe
$ date.exe
fixme:netapi32:NetUserGetInfo Level 3 is not implemented
fixme:netapi32:NetUserGetInfo Level 3 is not implemented
Fri Oct 25 11:46:05 EDT 2013$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $
I'm sorry if this is a dumb question. I've been unable to search for this issue.
oiaohm
Level 8
Level 8
Posts: 1020
Joined: Fri Feb 29, 2008 2:54 am

Re: Terminal must be reset using stty after running wine pro

Post by oiaohm »

johnmudd Yes you have might have found a bug please retest with 1.7.5 or what ever the current development branch is and submit a bug report if it is still wrong when program is run the right way.

Why I say might. Due to being a command line tool you need to set up command line environment. You have not setup windows command line environment. So bad things can and do happen.

wine cmd /c date.exe would be running date in command line environment.

Lot of those binfmt_misc stuff is too generic. Default of binfmt_misc is for a graphical application.

In fact for the most dependable command line running wine start cmd /k date.exe

with cmd /c <program> at cmd ends when program program closes.
with cmd /k <program> shell remains open after program closes. I used /k to show that its a X11 window.

johnmudd this might be just incorrect usage of wine. Ok if you want the straight usage to work you would have to submit bug report for wine to have special handling of PE executable marked console. But this most likely will be rejected because there are a lot of graphical applications marked console that never do anything on console so setting up console is not required overhead.

Maybe this needs to be added to the FAQ.
mvk
Newbie
Newbie
Posts: 3
Joined: Tue Oct 06, 2015 8:28 am

Re: Terminal must be reset using stty after running wine pro

Post by mvk »

I update this thread because I experienced the same problem, and I couldn't find the problem discussed elsewhere on the Internet, let alone a confirmed solution. (Except that this one looks very similar: https://www.winehq.org/pipermail/wine-b ... 06161.html but seems unsolved).

For me the problem was solved after installing wine-1.7.51.

In my case I was trying to make a C program which reads from stdin. Once getc() is used, the console status after leaving 'wine' is corrupted with -echo:

Code: Select all

$ stty
lflags: -icanon -iexten -echo echoe echok echoke echoctl
iflags: -icrnl -ixon -ixany iutf8 -brkint ignpar
oflags: onocr onlret
cflags: cs8 -parenb
$
If getc() is not used, the terminal restores ok. Normally stty looks like this:

Code: Select all

$ stty
speed 9600 baud;
lflags: echoe echoke echoctl pendin
iflags: iutf8
oflags: -oxtabs
cflags: cs8 -parenb
$
Interestingly, a quite similar win32 exe, of which I must assume was compiled natively, didn't exhibit this issue. So it must use a somewhat different input method and trigger another sequence through wine. But I don't have the source of that program, so I couldn't investigate the difference.

For reference:
System: MacOS (10.10.5)
Cross-compiler: MinGW (from gcc-4.8.0-qt-4.8.4-for-mingw32.dmg)
Wine version: 1.6.2 (installed through homebrew)
I experienced the same problem with another 1.6.2 as installed from MacPorts.
Solved, for me, by installing wine 1.7.51.
mvk
Newbie
Newbie
Posts: 3
Joined: Tue Oct 06, 2015 8:28 am

Re: Terminal must be reset using stty after running wine pro

Post by mvk »

Moderator, thanks for approving the post.

For completeness, I forgot to add that the suggested invocation method

Code: Select all

wine cmd /c foo.exe
did not make a difference in my case.

And there is in fact one other thread (also unresolved) on this forum mentioning this problem:
viewtopic.php?f=8&t=23548
With your permission I will crosslink from there to here, so that future googlers might be helped.
Locked