Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 04 Jan 2022 20:25:14 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 260938] script(1) hangs when child doesn't read input fast enough
Message-ID:  <bug-260938-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
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.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-260938-227>