[ROOT-5041] pyroot outputs .[?1034h to stdout if TERM=xterm Created: 09/Apr/13  Updated: 15/May/19  Resolved: 15/May/13

Status: Closed
Project: ROOT
Component/s: None
Affects Version/s: 5.34/00
Fix Version/s: None

Type: Bug Priority: High
Reporter: Peter Waller (Inactive) Assignee: Wim Lavrijsen
Resolution: Clarified Votes: 0
Labels: None
Environment:

GNU/Linux


External issue ID: bugs101141
External issue URL: https://savannah.cern.ch/bugs/?101141
Development:
Actual End:

 Description   

I was just trying to write a program which writes to stdout, in the spirit of unix.

I was a bit confused when programs downstream broke, it turns out that it's because pyroot for some reason causes ".[?1034h". to appear on stdout.

This doesn't appear unless ROOT is imported, although googling "python .[?1034h" does show a couple of non-root related hits.

I've tried this on SLC6 and Gentoo, and I see the same behaviour.

To reproduce:

$ export TERM=xterm
$ root -l -b <<< 'cout << "hello" << endl;' | hexdump -C
00000000 68 65 6c 6c 6f 0a |hello.|
00000006
$ python -c "import os; os.environ['TERM']; import ROOT as R; print 'hello'" | hexdump -C
00000000 1b 5b 3f 31 30 33 34 68 68 65 6c 6c 6f 0a |.[?1034hhello.|
0000000e
$ python -c "import os; del os.environ['TERM']; import ROOT as R; print 'hello'" | hexdump -C
00000000 68 65 6c 6c 6f 0a |hello.|
00000006
$ python -c "import os; print 'hello'" | hexdump -C
00000000 68 65 6c 6c 6f 0a |hello.|
00000006

Here is a backtrace: for (what I think) is a guilty fwrite. The write syscall actually occurs during an fflush() during python shutdown.

#0 0x00000035f7a67500 in fwrite () from /lib64/libc.so.6
#1 0x00007fffefde7571 in G__process_cmd () from /batchsoft/root/root-sl6/lib/libCint.so
#2 0x00007ffff0ad1646 in TCint::ProcessLine(char const*, TInterpreter::EErrorCode*) () from /batchsoft/root/root-sl6/lib/libCore.so
#3 0x00007ffff0ad1b3d in TCint::TCint(char const*, char const*) () from /batchsoft/root/root-sl6/lib/libCore.so
#4 0x00007ffff0a7948a in TROOT::TROOT(char const*, char const*, void (**)()) () from /batchsoft/root/root-sl6/lib/libCore.so
#5 0x00007ffff0a7a91c in ROOT::GetROOT() () from /batchsoft/root/root-sl6/lib/libCore.so
#6 0x00007ffff0a7b2e0 in GLOBAL_sub_I_TROOT.cxx () from /batchsoft/root/root-sl6/lib/libCore.so
#7 0x00007ffff0e7b036 in __do_global_ctors_aux () from /batchsoft/root/root-sl6/lib/libCore.so
#8 0x00007ffff0a1f90b in _init () from /batchsoft/root/root-sl6/lib/libCore.so
#9 0x0000003500000000 in ?? ()
#10 0x00000035f720e535 in _dl_init_internal () from /lib64/ld-linux-x86-64.so.2
#11 0x00000035f7212c25 in dl_open_worker () from /lib64/ld-linux-x86-64.so.2
#12 0x00000035f720e196 in _dl_catch_error () from /lib64/ld-linux-x86-64.so.2
#13 0x00000035f721246a in _dl_open () from /lib64/ld-linux-x86-64.so.2
#14 0x00000035f7e00f66 in dlopen_doit () from /lib64/libdl.so.2
#15 0x00000035f720e196 in _dl_catch_error () from /lib64/ld-linux-x86-64.so.2
#16 0x00000035f7e0129c in _dlerror_run () from /lib64/libdl.so.2
#17 0x00000035f7e00ee1 in dlopen@@GLIBC_2.2.5 () from /lib64/libdl.so.2
#18 0x0000003612b07582 in _PyImport_GetDynLoadFunc () from /usr/lib64/libpython2.6.so.1.0
#19 0x0000003612af41d8 in _PyImport_LoadDynamicModule () from /usr/lib64/libpython2.6.so.1.0
#20 0x0000003612af2245 in ?? () from /usr/lib64/libpython2.6.so.1.0
#21 0x0000003612af24c4 in ?? () from /usr/lib64/libpython2.6.so.1.0
#22 0x0000003612af2b1d in ?? () from /usr/lib64/libpython2.6.so.1.0
#23 0x0000003612af3884 in PyImport_ImportModuleLevel () from /usr/lib64/libpython2.6.so.1.0
#24 0x0000003612ad885f in ?? () from /usr/lib64/libpython2.6.so.1.0
#25 0x0000003612a44303 in PyObject_Call () from /usr/lib64/libpython2.6.so.1.0
#26 0x0000003612ad8dd3 in PyEval_CallObjectWithKeywords () from /usr/lib64/libpython2.6.so.1.0
#27 0x0000003612adc47f in PyEval_EvalFrameEx () from /usr/lib64/libpython2.6.so.1.0
#28 0x0000003612ae0797 in PyEval_EvalCodeEx () from /usr/lib64/libpython2.6.so.1.0
#29 0x0000003612ae0872 in PyEval_EvalCode () from /usr/lib64/libpython2.6.so.1.0
#30 0x0000003612af0842 in PyImport_ExecCodeModuleEx () from /usr/lib64/libpython2.6.so.1.0
#31 0x0000003612af0d26 in ?? () from /usr/lib64/libpython2.6.so.1.0
#32 0x0000003612af2245 in ?? () from /usr/lib64/libpython2.6.so.1.0
#33 0x0000003612af24c4 in ?? () from /usr/lib64/libpython2.6.so.1.0
#34 0x0000003612af2b1d in ?? () from /usr/lib64/libpython2.6.so.1.0
#35 0x0000003612af3884 in PyImport_ImportModuleLevel () from /usr/lib64/libpython2.6.so.1.0
#36 0x0000003612ad885f in ?? () from /usr/lib64/libpython2.6.so.1.0
#37 0x0000003612a44303 in PyObject_Call () from /usr/lib64/libpython2.6.so.1.0
#38 0x0000003612ad8dd3 in PyEval_CallObjectWithKeywords () from /usr/lib64/libpython2.6.so.1.0
#39 0x0000003612adc47f in PyEval_EvalFrameEx () from /usr/lib64/libpython2.6.so.1.0
#40 0x0000003612ae0797 in PyEval_EvalCodeEx () from /usr/lib64/libpython2.6.so.1.0
#41 0x0000003612ae0872 in PyEval_EvalCode () from /usr/lib64/libpython2.6.so.1.0
#42 0x0000003612afbbbc in ?? () from /usr/lib64/libpython2.6.so.1.0
#43 0x0000003612afbdca in PyRun_StringFlags () from /usr/lib64/libpython2.6.so.1.0
#44 0x0000003612afd030 in PyRun_SimpleStringFlags () from /usr/lib64/libpython2.6.so.1.0
#45 0x0000003612b09636 in Py_Main () from /usr/lib64/libpython2.6.so.1.0
#46 0x00000035f7a1ecdd in __libc_start_main () from /lib64/libc.so.6
#47 0x0000000000400649 in _start ()



 Comments   
Comment by Wim Lavrijsen [ 15/May/13 ]

Peter,

we've looked into this when it first cropped up 5 or 6 years ago. The issue was then (and I presumed the diagnosis has not changed) with a specific combination of specific versions of readline and ncurses (sorry, I can't remember which ones). Nothing that can be solved on the PyROOT side. Just set TERM=vt100 and it'll go away.

Cheers,
Wim

Generated at Thu Oct 24 03:36:30 CEST 2019 using Jira 8.3.4#803005-sha1:1f96e09b3c60279a408a2ae47be3c745f571388b.