pkgsrc-Bugs archive

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

pkg/57886: lang/pythonN build suspends itself with SIGTTOU



>Number:         57886
>Category:       pkg
>Synopsis:       lang/pythonN build suspends itself with SIGTTOU
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jan 29 01:45:00 +0000 2024
>Originator:     Taylor R Campbell
>Release:        current
>Organization:
The NetTTY Foundation
>Environment:
>Description:
Now that readline is unconditionally included in the lang/pythonN packages, Python will unconditionally do silly things when stdin is a tty but stdout is not (e.g., redirect output to a file but don't redirect input, in a background job) -- under these circumstances it decides to initialize readline, and initializing readline makes it do TIOCGWINSZ, which is fine, and then TIOCSWINSZ, which suspends the process with SIGTTOU.

static int
get_tty_settings (int tty, TIOTYPE *tiop)
{
  set_winsize (tty);
...
}

/* Dummy call to force a backgrounded readline to stop before it tries
   to get the tty settings. */
static void
set_winsize (tty)
     int tty;
{
#if defined (TIOCGWINSZ)
  struct winsize w;

  if (ioctl (tty, TIOCGWINSZ, &w) == 0)
      (void) ioctl (tty, TIOCSWINSZ, &w);
#endif /* TIOCGWINSZ */
}

See https://mail-index.netbsd.org/tech-pkg/2024/01/03/msg028751.html and the thread leading into that for more detail.
>How-To-Repeat:
build python or things that use python at build-time in a background job with output redirected to a file and input from the tty
>Fix:
Workaround: run the build with input redirected from /dev/null.

Fix: Yes, please!



Home | Main Index | Thread Index | Old Index