bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#28500: 25.3; shell mode starts echoing command


From: Barry Warsaw
Subject: bug#28500: 25.3; shell mode starts echoing command
Date: Tue, 19 Sep 2017 20:19:40 -0400

On Sep 19, 2017, at 09:36, Andreas Schwab <address@hidden> wrote:
> 
> $ stty; openssl aes-256-cbc -in foo.txt -out foo.text.enc; stty

What is happening is that -echo is getting lost.  `stty -echo` after exiting 
Python will restore normal behavior in a shell buffer.  I’m not entirely sure 
why, but this is neither set nor necessary in a Terminal window.

My suspicion now falls on readline from home-brew.  Specifically, if I build 
Python from git master but *remove* the readline.<blah>.so file so there’s no 
way that readline can be invoked, then I don’t see the problem.  readline gets 
imported implicitly if available when entering the interactive prompt, and I’ve 
proven to myself that if that happens, echo gets reenabled.  It’s the common 
feature with sqlite3 too, which for me comes from brew.  Further, because 
openssl comes from Apple, it isn’t linked with brew’s readline and that does 
*not* exhibit the problem.

And then I found this: https://github.com/Homebrew/brew/issues/651

I will follow up on that issue, but it’s clearly now not an Emacs bug.

FWIW, this little bit of Python in your $PYTHONSTARTUP file will workaround the 
problem:

import sys
import atexit
import termios

# Reset `stty -echo` on exit.
def no_echo():
    flags = termios.tcgetattr(sys.stdin)
    flags[3] &= ~termios.ECHO
    termios.tcsetattr(sys.stdin, termios.TCSADRAIN, flags)

atexit.register(no_echo)

Cheers!

Attachment: signature.asc
Description: Message signed with OpenPGP


reply via email to

[Prev in Thread] Current Thread [Next in Thread]