NetBSD Problem Report #57886

From  Mon Jan 29 01:41:44 2024
Return-Path: <>
Received: from ( [])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "", Issuer " CA" (not verified))
	by (Postfix) with ESMTPS id 648461A9238
	for <>; Mon, 29 Jan 2024 01:41:44 +0000 (UTC)
Message-Id: <>
Date: Mon, 29 Jan 2024 01:41:43 +0000 (UTC)
Subject: lang/pythonN build suspends itself with SIGTTOU
X-Send-Pr-Version: www-1.0

>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
The NetTTY Foundation
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 and the thread leading into that for more detail.
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
Workaround: run the build with input redirected from /dev/null.

Fix: Yes, please!

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD:,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2024 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.