Python -c "import readline" produce strange output on stdout

Solution Verified - Updated -

Environment

Red Hat Enterprise Linux 6.2 and later
Fedora 7 and later

Issue

Python's "import readline" produces some escape sequences stdout.

# TERM=xterm python -c "import readline" | hexdump -C
00000000  1b 5b 3f 31 30 33 34 68                           |.[?1034h|
00000008

Resolution

NOTABUG as addressed per BZ 304181 Readline initialization outputs escape sequence

Root Cause

Starting with Fedora 7, the xterm terminfo description added the "smm" attribute

infocmp xterm | grep smm
        smir=\E[4h, smkx=\E[?1h\E=, smm=\E[?1034h, smso=\E[7m,

man terminfo describes this as:

       meta_on                        smm         mm         turn on meta mode
                                                             (8th-bit on)

Diagnostic Steps

On RHEL 5.8 :

# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 5.8 (Tikanga)

# infocmp xterm | grep smm

On RHEL 6.2 :

# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 6.2 (Santiago)

# infocmp xterm | grep smm
    smir=\E[4h, smkx=\E[?1h\E=, smm=\E[?1034h, smso=\E[7m,

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments