From cheetah@fastcat.org Thu Sep 28 01:58:26 2017 Received: from cheetah.fastcat.org (cheetah.fastcat.org [71.174.62.34]) by underdog.stansell.org (8.15.2/8.15.2) with ESMTPS id v8S1wO1k001514 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NO) for ; Thu, 28 Sep 2017 01:58:26 GMT DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=fastcat.org ; s=20130912; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Date: Message-ID:To:Subject:From:Sender:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=dEnO2T5hUAN3SW5WyE/q79vlRqCXsIe8lHnEQ1jQVX0=; b=Tun1x3SmbYQAo3XngsDBXk2Z2L Ur/v7kJcjXyqoy93mdOFhkDxTvSkzMQcPza1PCcRN/+94rGXgX98LKulB1P1aq2G69VtCVjsoRX5y YaWqoNPxhv/lRQCqZXxQK5MlsTnF/j3K3kZwBXBJiQKiIqIRDxr4/W5YTgTnl2pdHpUxBQL0twXQM 6CxCm4OSlLJpZ/L1VtzA7Wk4dEd45NoRn4cWW93uDgEanuefmPJJY0tS2ONKBaMtIsSzQbyaq/aQl BE1DcyU18cxSuWxx/vzJfrSOD/dZm3WMOE4D0F62q7E0W5WlDiYS2Xy8nCLrBRFuNUyWFCyvh3QiW hKjuVKig==; Received: from [70.88.250.17] (helo=harkonnen.beechwoods.com) by cheetah.fastcat.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1dxO5n-0005VZ-Ge for users@conserver.com; Wed, 27 Sep 2017 21:58:23 -0400 From: Matthew Gabeler-Lee Subject: [patch] Exec slaves and controlling TTY To: users@conserver.com Message-ID: Date: Wed, 27 Sep 2017 21:58:22 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 0.697 () BAYES_50, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS X-Scanned-By: MIMEDefang 2.72 on 198.151.248.21 X-BeenThere: users@conserver.com X-Mailman-Version: 2.1.23 Precedence: list List-Id: Conserver Users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Sep 2017 01:58:26 -0000 Like several others on the mailing list before me, I'm having problem with exec consoles that run a program that needs /dev/tty -- i.e. they need a controlling TTY. The problem seems to be a (trivial to fix!) bug in conserver -- It doesn't call the ioctl to set a controlling TTY as part of the child process setup. When I went to fix that, I noticed another small bug in the same function -- it takes an arg for which FD to configure ... but never obeys it. Here's a simple patch to fix both. I /hope/ it's portable. ---- snip ---- diff -urNp conserver-8.2.1/conserver/consent.c conserver-8.2.1-fixed/conserver/consent.c --- conserver-8.2.1/conserver/consent.c 2016-11-02 15:54:38.000000000 -0400 +++ conserver-8.2.1-fixed/conserver/consent.c 2017-09-27 21:39:52.249987884 -0400 @@ -513,9 +513,9 @@ SetupTty(CONSENT *pCE, int fd) * under PTX (others?) we have to push the compatibility * streams modules `ptem', `ld', and `ttcompat' */ - ioctl(1, I_PUSH, "ptem"); - ioctl(1, I_PUSH, "ldterm"); - ioctl(1, I_PUSH, "ttcompat"); + ioctl(fd, I_PUSH, "ptem"); + ioctl(fd, I_PUSH, "ldterm"); + ioctl(fd, I_PUSH, "ttcompat"); #endif if (0 != tcgetattr(1, &n_tio)) { @@ -544,8 +544,13 @@ SetupTty(CONSENT *pCE, int fd) n_tio.c_cc[VSTART] = '\021'; n_tio.c_cc[VSTOP] = '\023'; n_tio.c_cc[VSUSP] = '\032'; - if (0 != tcsetattr(1, TCSANOW, &n_tio)) + if (0 != tcsetattr(fd, TCSANOW, &n_tio)) exit(EX_OSERR); +#ifdef TIOCSCTTY + /* Set the tty to be the controlling tty */ + if (0 != ioctl(fd, TIOCSCTTY, 0)) + exit(EX_OSERR); +#endif } /* setup a virtual device (ksb) ---- snip --- -- -Matt "Reality is that which, when you stop believing in it, doesn't go away". -- Philip K. Dick GPG fingerprint: 0061 15DF D282 D4A9 57CE 77C5 16AF 1460 4A3C C4E9