This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v3] tst-ttyname: skip the test if failed to become root
- From: Luke Shumaker <lukeshu at lukeshu dot com>
- To: libc-alpha at sourceware dot org
- Date: Tue, 02 Jan 2018 00:19:46 -0500
- Subject: Re: [PATCH v3] tst-ttyname: skip the test if failed to become root
- Authentication-results: sourceware.org; auth=none
- References: <20171226141002.GA23091@altlinux.org> <20171226230703.GB28737@altlinux.org> <874lodskm6.fsf@mid.deneb.enyo.de> <87lghjx17h.wl-lukeshu@lukeshu.com> <20171231001152.GA26394@altlinux.org> <87efndljui.fsf@mid.deneb.enyo.de>
On Sat, 30 Dec 2017 19:11:52 -0500,
Dmitry V. Levin wrote:
> On Sat, Dec 30, 2017 at 06:09:22PM -0500, Luke Shumaker wrote:
> > Florian Weimer wrote:
> > > I don't think the glibc test suite is supposed to pass in such an
> > > environment [without ptmx]. If you don't provide /dev/null, /sys,
> > > or /proc to the tests, some of them will fail as well. I still
> > > think that the current test accurately reflects the inadequacy of
> > > your test environment.
>
> Also, one cannot declare these environments unsupported in master branch
> without reaching a consensus.
On Fri, 29 Dec 2017 08:55:17 -0500,
Florian Weimer wrote:
> * Dmitry V. Levin:
> > It used to work perfectly for at least 15 years, and it still works
> > when tst-ttyname is fixed.
>
> This just reflects that we did not have sufficient test coverage for
> the PTY code.
Obviously, I'm the outsider here; and can't authoritatively comment on
whether glibc supports environments without ptmx / UNIX 98 PTYs, but
from looking over the codebase:
1. There is insufficient test coverate of posix_openpt and friends to
conclude that Linux environments without ptmx were previously
supported.
The only other tests that call posix_openpt or other PTY-opening
functions are
- debug/tst-chk1.c
- login/tst-grantpt.c
- login/tst-ptsname.c
I don't have a good idea of what tst-chk1 does, or why it doesn't
error if posix_openpt fails; but the other 2 ignore an error
because "maybe the system does not have SUS pseudo terminals", and
the posix_openpt bit is just one subtest case.
Which is to say that posix_openpt is previously untested by the
test suite.
But, Linux does support SUS / UNIX 98 pseudo terminals; and
tst-ttyname lives in sysdeps/unix/sysv/linux. Linux has no config
option to disable ptmx. The only variable there is whatever sets
up /dev.
2. The Linux implementation of getpt (a GNU extension) first tries
posix_openpt to get a UNIX 98 PTY, but if that fails, it falls
back to trying to get a BSD PTY. Which suggests that glibc
supports Linux environments without ptmx.
I find #2 fairly compelling. That is to say, I've changed my mind,
and do support applying and backporting a patch to EXIT_UNSUPPORTED if
posix_openpt returns ENOENT.
--
Happy hacking,
~ Luke Shumaker