From nobody Tue Jan 04 20:25:14 2022 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 388BA1920B51 for ; Tue, 4 Jan 2022 20:25:15 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JT3yL6bhLz3shL for ; Tue, 4 Jan 2022 20:25:14 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C29C81F34F for ; Tue, 4 Jan 2022 20:25:14 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 204KPEho087170 for ; Tue, 4 Jan 2022 20:25:14 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 204KPEYw087169 for bugs@FreeBSD.org; Tue, 4 Jan 2022 20:25:14 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 260938] script(1) hangs when child doesn't read input fast enough Date: Tue, 04 Jan 2022 20:25:14 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: 13.0-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: nabijaczleweli@nabijaczleweli.xyz X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1641327915; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gneJXUD+xatWQf0d9ZwbgEq7+GLFDvwwwTOdmUYt31Y=; b=A4EObZImJe82BbVtf8jkHKdud+ry4U81lfTl9C8BJ1xKXtX/I1nbk/qQOedXhsFk7oDSE/ M2B4kowGV4pICpI6jfaA6c6dvO9VE079NJ8dCCmN13cUWD++kLlKGZapPuRPk6JTXnZ0d8 ufhEhqbo7FivUQgQLzDo/dGUf3wo4Y/vx+vfceGp/g+pt7fsfcLZbvkJSyla59GJ1Wrlev gqgXrSDNbHAgISyjktsr1S07Cm2HyYzbLrH0tP31gIaMh5eyW2xwFduIMZ7uvUknTxlMam xCtdDQpKEDPr1gYKGTogU6zM7Eq1Yq2aRuSEdU61FcVB9N40OLudSKv78gIiHA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1641327915; a=rsa-sha256; cv=none; b=Xi8JadDiWqkaVTwGff4fwAC4MESAQ4rnyNdRwYykGNoz+fGYqP2Upf2tnHhfZARKLcRcW7 oMxKaf17Fp5z0oNYsQJeBpFtn94FCtKkupwG6rnvV3/sxK1hFF/GqcgCCRKipQxrhhBYr+ 8mqLr5s1e3ssIs80E28wlLyC9pcEmg1ApakO3VNPCNBEORqbO6IeraazCKge6kzassLcQE 9croUGl102edPZ542nso524/Z0s3hqHcQpM0vPWo7+k35ZzNMtXlAWBR4jjQKW7dPuqF0d CVQcVGaGDK7IWRXsRvZRgaVrXLW5/mE5yKqXt1sIsgFWujMw0Gl7uyFY/qIg/w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D260938 Bug ID: 260938 Summary: script(1) hangs when child doesn't read input fast enough Product: Base System Version: 13.0-RELEASE Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: nabijaczleweli@nabijaczleweli.xyz Created attachment 230710 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D230710&action= =3Dedit Above core dump, zstd compressed If there's enough input and the child doesn't read it in fast enough, scrip= t(1) deadlocks on stdin to the child against the child writing to its stdout. This is a regression from 4.4BSD-Lite, brought on by replacing the 2-process model (i.e. leader: stdin -> master pty child: master pty -> stdout/fscript subchild: the command ) with a single process and select(2); writes to the master pty don't seem = to shard, and block forever; the child cannot continue because it's blocked on writing its own data. This is the same bug as in util-linux's implementation (though that uses poll(2)), so please see this Debian bug for more words on the topic: https://bugs.debian.org/1003095 Attaching core I got after ^\ing and trace from=20 ktrace script /dev/null sh -c 'for i in $(seq 10); do echo $i; done; read= -r a; echo a=3D$a' < lc wherein lc is b64encode /lib/libc.so.7 /lib/libc.so.7 > lc uname -a says "FreeBSD build 13.0-RELEASE-p4 FreeBSD 13.0-RELEASE-p4 #0: Tue Aug 24 07:33:27 UTC 2021=20=20=20=20 root@amd64-builder.daemonology.net:/usr/obj/usr/src/amd64.amd64/sys/GENERIC= =20 amd64" --=20 You are receiving this mail because: You are the assignee for the bug.=