From nobody Mon Sep 26 12:21:10 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 4MbhgV4S2cz4VC0G for ; Mon, 26 Sep 2022 12:21:10 +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 4MbhgV2CM0z3jLr for ; Mon, 26 Sep 2022 12:21:10 +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 4MbhgV1HjDzmDs for ; Mon, 26 Sep 2022 12:21:10 +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 28QCLAgp061241 for ; Mon, 26 Sep 2022 12:21:10 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 28QCLABq061240 for bugs@FreeBSD.org; Mon, 26 Sep 2022 12:21:10 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 266627] stty -f should be non-blocking Date: Mon, 26 Sep 2022 12:21:10 +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: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: se@FreeBSD.org 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 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=1664194870; 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=cwcwFDwOl7ff7KDZ3SoRvP6NgGowjRLWJ3QuRePJEz0=; b=CP/KKtq7GID/XLrGPDhB8KiTnJME30aqoO5hXstOEKDlPC8VhJC5ar4MjEK1sQ5c5Uuk56 xuAoGDH4jdLVD1eQC04AvJ8Q2cQl4yGaYlZIOUrOh9HZjRqX6o6ZgB5fbSAAf255LGA4ff /VcxHn34oz8gwDpumHrGkJizqHBP//sMYf37lTEZfcfY/erMA5u/q+0yq8wTTRmROjX10J 4P7KsSGG3or6tRCM2RMEFb9JBpSf+0cndFBRAysaij42E9vlorrA6rtbOk7H5w5l/3bV4u WtBoraLQOb2D8D1aaBQOM/1Vb7ZBvjnZYX4A0fDHzFIwvU8vhqqk3ZCy1pEoOQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1664194870; a=rsa-sha256; cv=none; b=J3bhF5Q+dajS6ohpndfprT9whpbF8fFICk825m+vlFbbuQ42yewKJqox99erP+4xx+t65R 7FPRYUlahWo4+3GOQZn0Vajt81z5orN5+kH427ykk0I4QvtI3nrxwaXYS0W46ZL0620sF3 Tzq/MPIqmrJQeHIQPIeb6WP5jpHD1KC4CfT+LOO0eyaXABQxZAGSRQgTTM3pXrrjs528ng VJAhyCy/SNvvcC1T3Knb8a5NS6FUkcnuFdtYJ8UzmtekxZ3Ib+4XJJCVJF5rjUTOH8U88l H6GCluraxFIZ57JlGJE5u66zPa6USoB/VRTNwejnHQEu1RnLb+VC4d6e0z5Xkw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D266627 Bug ID: 266627 Summary: stty -f should be non-blocking Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: se@FreeBSD.org Ths stty man-page describes the -f option to cause a non-blocking open of t= he passed file: -f Open and use the terminal named by file rather than using standard input. The file is opened using the O_NONBLOCK flag = of open(), making it possible to set or display settings on a terminal that might otherwise block on the open. This does work when TTY options are fetched and displayed, but not when attempting to set some parameter. I'd expect the following command to not block, but instead to fail with a non-zero exit status: $ stty -f /dev/tty sane & But the command blocks, waiting for a "fg" command, and only then executes = the requested operation on the TTY. The reason seems to be that the tcsetattr() function ignores the O_NONBLOCK flag of the passed file descriptor (or rather that the ioctl() it invokes ignores it). This appears to be a deviation from documented behavior (and breaks a script I'm working on which wants to reset the TTY on exit, but now blocks exiting from the script when it has been put into the background by the user). --=20 You are receiving this mail because: You are the assignee for the bug.=