From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C82EE385840B; Wed, 2 Feb 2022 19:35:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C82EE385840B From: "carlos at redhat dot com" To: glibc-bugs@sourceware.org Subject: [Bug libc/28853] Problems with terminal control Date: Wed, 02 Feb 2022 19:35:30 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: libc X-Bugzilla-Version: 2.35 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: carlos at redhat dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: glibc-bugs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-bugs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Feb 2022 19:35:30 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D28853 Carlos O'Donell changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |carlos at redhat dot com --- Comment #4 from Carlos O'Donell --- Dave, Thanks for the bug report. I can confirm that posix/tst-spawn6 breaks out of the support/* isolation a= nd in doing so impacts the shell / process group / session on the terminal. e.g. [2]+ Stopped less ~/build/glibc-review/check.log (In reply to John David Anglin from comment #2) > I suppose this is the problematic part of the change: >=20 > /* Set the controlling terminal. */ > if ((attr->__flags & POSIX_SPAWN_TCSETPGROUP) !=3D 0) > { > /* Check if it is possible to avoid an extra syscall. */ > pid_t pgrp =3D (attr->__flags & POSIX_SPAWN_SETPGROUP) !=3D 0 > && attr->__pgrp !=3D 0 > ? attr->__pgrp : __getpgid (0); > if (__tcsetpgrp (attr->__ctty_fd, pgrp) !=3D 0) > goto fail; > } This is not problematic per-se, since this is what you want to do for shell control, but if the test isolation code doesn't stop this affecting your current shell then that's a problem. The posix/tst-spawn6 test is the *only* test in which we exercise process g= roup control testing, and so it may break the testing isolation we expect. (In reply to John David Anglin from comment #3) > The function tcsetpgrp() makes the process group with process group ID > pgrp the foreground process group on the terminal associated to fd, > which must be the controlling terminal of the calling process, and > still be associated with its session. Moreover, pgrp must be a > (nonempty) process group belonging to the same session as the calling > process. > If tcsetpgrp() is called by a member of a background process group in > its session, and the calling process is not blocking or ignoring SIGT- > TOU, a SIGTTOU signal is sent to all members of this background process > group. Yes, for the current /dev/tty (in the test), we make the posix_spawn'd process the foreground process group for the session to verify the test wor= ks correctly. I can't easily containerize the test because we don't setup an alternative TTY/session/pgrp in the container e.g. tests-container +=3D tst-spawn6. make[2]: Leaving directory '/home/carlos/src/glibc-review/posix' FAIL: posix/tst-spawn6 original exit status 1 error: tst-spawn6.c:138: open64 ("/dev/tty", 0x0, 0600): No such file or directory error: 1 test failures make[1]: Leaving directory '/home/carlos/src/glibc-review' --=20 You are receiving this mail because: You are on the CC list for the bug.=