From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: "H.J. Lu" <hjl.tools@gmail.com>, libc-alpha@sourceware.org
Subject: Re: [PATCH] tst-spawn6.c: Skip if _PATH_TTY doesn't exist [BZ #28836]
Date: Sat, 29 Jan 2022 17:04:41 -0300 [thread overview]
Message-ID: <af15d79f-fd97-a75a-869f-8696a5496c07@linaro.org> (raw)
In-Reply-To: <20220129154518.4192-1-hjl.tools@gmail.com>
On 29/01/2022 12:45, H.J. Lu wrote:
> posix/tst-spawn6 fails with
>
> error: xopen.c:28: open64 ("/dev/tty", 0x0, 0600): No such device or address
>
> when there is no one logged in. Skip tst-spawn6 if _PATH_TTY doesn't
> exist. This fixes BZ #28836.
> ---
> posix/tst-spawn6.c | 19 +++++++++++++++++--
> 1 file changed, 17 insertions(+), 2 deletions(-)
>
> diff --git a/posix/tst-spawn6.c b/posix/tst-spawn6.c
> index 5f95bd1938..72fbab4db3 100644
> --- a/posix/tst-spawn6.c
> +++ b/posix/tst-spawn6.c
> @@ -30,10 +30,25 @@
> #include <support/xunistd.h>
> #include <sys/wait.h>
>
> +static int
> +open_tty (int flags, mode_t mode)
> +{
> + int ret = open64 (_PATH_TTY, flags, mode);
> + if (ret < 0)
> + {
> + /* NB: Skip the test if _PATH_TTY doesn't exist. */
> + if (errno == ENXIO)
> + FAIL_UNSUPPORTED ("\"%s\" doesn't exist", _PATH_TTY);
> + FAIL_EXIT1 ("open64 (\"%s\", 0x%x, 0%o): %m",
> + _PATH_TTY, flags, mode);
> + }
> + return ret;
> +}
> +
> static int
> handle_restart (const char *argv1)
> {
> - int fd = xopen (_PATH_TTY, O_RDONLY, 0600);
> + int fd = open_tty (O_RDONLY, 0600);
>
> /* If process group is not changed (POSIX_SPAWN_SETPGROUP), then check
> the creating process one, otherwise check against the process group
I think that if tty can't be opened on the spawned process this is genuine
issue that should be reported.
> @@ -116,7 +131,7 @@ do_test (int argc, char *argv[])
> if (restart)
> return handle_restart (argv[1]);
>
> - int tcfd = xopen (_PATH_TTY, O_RDONLY, 0600);
> + int tcfd = open_tty (O_RDONLY, 0600);
>
> /* Check getters and setters. */
> {
I will send an updated version of posix_spawn_file_actions_addtcsetpgrp_np
with this change.
prev parent reply other threads:[~2022-01-29 20:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-29 15:45 H.J. Lu
2022-01-29 20:04 ` Adhemerval Zanella [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=af15d79f-fd97-a75a-869f-8696a5496c07@linaro.org \
--to=adhemerval.zanella@linaro.org \
--cc=hjl.tools@gmail.com \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).