tech-pkg archive

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

Re: Workaround for Suspended (tty output) in python?



> Date: Sun, 31 Dec 2023 02:25:06 +0000 (UTC)
> From: John Klos <john%klos.com@localhost>
> 
> #0  0x000070df4cd7f0da in ioctl () from /usr/lib/libc.so.12

Do you know which ioctl it is?  Can you ktrace it?

> #1  0x000070df3721e3c8 in rltty_set_default_bindings () from /usr/local/lib/libreadline.so.8
> #2  0x000070df37218912 in rl_initialize () from /usr/local/lib/libreadline.so.8

This is weird, why is it getting a readline with no debug info out of
/usr/local?

Are you installing packages with PREFIX=/usr/local, and did you not
rebuild devel/readline?  If so, can you rebuild devel/readline too?

> #3  0x000070df37604cab in setup_readline (mod_state=0x70df4c0d9430)
>      at ./Modules/readline.c:1306
> #4  PyInit_readline () at ./Modules/readline.c:1519
> #5  0x000070df4e865317 in _PyImport_LoadDynamicModuleWithSpec (spec=spec@entry=0x70df4c0d9090,
>      fp=fp@entry=0x0) at ./Python/importdl.c:169

Presumably Python is autoloading readline now because

(a) we ship readline in lang/pythonN now rather than in
    devel/py-readline, as of a month or two ago; and

(b) stdin is a tty (even if stdout is not),

which might explain why you started noticing this recently.

> So it seems this because there's no signal handler. Throwing in a random 
> signal (SIGTTOU, SIG_IGN); after rl_initialize(); in 
> Python-3.12.1/Modules/readline.c seems to have helped, but I have no idea 
> where this properly should go.

I don't think we should set up a signal handler here -- we should
figure out why it's trying to do anything that might trigger SIGTTOU
like writing to the tty or stdin when it should be writing to stdout
(which, if I understand your case correctly, is supposed to be a
file).


Home | Main Index | Thread Index | Old Index