This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: misc/tst-ttyname time outs
On 03/01/2019 11:30, Florian Weimer wrote:
> ENOSPC is tough to deal with here. I suspect it involves asynchronous
> namespace deallocation (so the next run of the test starts before the
> previous namespace is gone).
>
> For EMFILE, please try the attached patch. It should help.
>
> It also guards against the infinite loop.
>
> Thanks,
> Florian
>
> Subject: [PATCH] Linux: Improve handling of resource limits in misc/tst-ttyname
>
> An attempt to re-create a different PTY under the same name can fail
> if the PTY has a very high number. Try to increase the file
> descriptor limit in this case, and bail out if this still does not
> allow the test to proceed.
>
> 2019-01-03 Florian Weimer <fweimer@redhat.com>
>
> * sysdeps/unix/sysv/linux/tst-ttyname.c (adjust_file_limit): New
> function.
> (do_in_chroot_1): Call it.
> (run_chroot_tests):
> Improve error reporting in case it is not possible to create a
> collision for the PTY name required by the test.
>
this works for me, i get
$ cat misc/tst-ttyname.test-result
UNSUPPORTED: misc/tst-ttyname
original exit status 77
$ cat misc/tst-ttyname.out
info: entering chroot 1
info: adjusting RLIMIT_NOFILE from 1024 to 1671
info: testcase: basic smoketest
info: ttyname: PASS {name="/dev/pts/1661", errno=0}
info: ttyname_r: PASS {name="/dev/pts/1661", ret=0, errno=0}
info: testcase: no conflict, no match
info: ttyname: PASS {name=NULL, errno=19}
info: ttyname_r: PASS {name=NULL, ret=19, errno=19}
info: testcase: no conflict, console
info: ttyname: PASS {name="/dev/console", errno=0}
info: ttyname_r: PASS {name="/dev/console", ret=0, errno=0}
error: ../sysdeps/unix/sysv/linux/tst-ttyname.c:486: cannot re-create PTY "/dev/pts/1661" in chroot: No space left on device (consider
increasing limits)
> + if (posix_openpt (O_RDWR|O_NOCTTY|O_NONBLOCK) < 0)
> + {
> + if (errno == ENOSPC || errno == EMFILE || errno == ENOSPC)
ENOSPC is checked twice.
> + FAIL_UNSUPPORTED ("cannot re-create PTY \"%s\" in chroot: %m"
> + " (consider increasing limits)", slavename);
> + else
> + FAIL_EXIT1 ("cannot re-create PTY \"%s\" chroot: %m", slavename);
> + }
> + }