public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v2] tst-ttyname: skip the test when /dev/ptmx is not available
@ 2017-12-25 21:41 Dmitry V. Levin
  2018-01-02  5:46 ` Luke Shumaker
  2018-01-08 11:53 ` Dmitry V. Levin
  0 siblings, 2 replies; 5+ messages in thread
From: Dmitry V. Levin @ 2017-12-25 21:41 UTC (permalink / raw)
  To: libc-alpha

* sysdeps/unix/sysv/linux/tst-ttyname.c (do_in_chroot_1): Skip the
test instead of failing in case of ENOENT returned by posix_openpt.
---
 ChangeLog                             | 5 +++++
 sysdeps/unix/sysv/linux/tst-ttyname.c | 9 ++++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/sysdeps/unix/sysv/linux/tst-ttyname.c b/sysdeps/unix/sysv/linux/tst-ttyname.c
index 0fdf1a8..6848a6d 100644
--- a/sysdeps/unix/sysv/linux/tst-ttyname.c
+++ b/sysdeps/unix/sysv/linux/tst-ttyname.c
@@ -253,7 +253,14 @@ do_in_chroot_1 (int (*cb)(const char *, int))
   /* Open the PTS that we'll be testing on.  */
   int master;
   char *slavename;
-  VERIFY ((master = posix_openpt (O_RDWR|O_NOCTTY|O_NONBLOCK)) >= 0);
+  master = posix_openpt (O_RDWR|O_NOCTTY|O_NONBLOCK);
+  if (master < 0)
+    {
+      if (errno == ENOENT)
+	FAIL_UNSUPPORTED ("posix_openpt: %m");
+      else
+	FAIL_EXIT1 ("posix_openpt: %m");
+    }
   VERIFY ((slavename = ptsname (master)));
   VERIFY (unlockpt (master) == 0);
   if (strncmp (slavename, "/dev/pts/", 9) != 0)
-- 
ldv

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] tst-ttyname: skip the test when /dev/ptmx is not available
  2017-12-25 21:41 [PATCH v2] tst-ttyname: skip the test when /dev/ptmx is not available Dmitry V. Levin
@ 2018-01-02  5:46 ` Luke Shumaker
  2018-01-08 11:48   ` Dmitry V. Levin
  2018-01-08 11:53 ` Dmitry V. Levin
  1 sibling, 1 reply; 5+ messages in thread
From: Luke Shumaker @ 2018-01-02  5:46 UTC (permalink / raw)
  To: libc-alpha

On Mon, 25 Dec 2017 16:41:54 -0500,
Dmitry V. Levin wrote:
> 
> * sysdeps/unix/sysv/linux/tst-ttyname.c (do_in_chroot_1): Skip the
> test instead of failing in case of ENOENT returned by posix_openpt.
> ---
>  ChangeLog                             | 5 +++++
>  sysdeps/unix/sysv/linux/tst-ttyname.c | 9 ++++++++-
>  2 files changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/tst-ttyname.c b/sysdeps/unix/sysv/linux/tst-ttyname.c
> index 0fdf1a8..6848a6d 100644
> --- a/sysdeps/unix/sysv/linux/tst-ttyname.c
> +++ b/sysdeps/unix/sysv/linux/tst-ttyname.c
> @@ -253,7 +253,14 @@ do_in_chroot_1 (int (*cb)(const char *, int))
>    /* Open the PTS that we'll be testing on.  */
>    int master;
>    char *slavename;
> -  VERIFY ((master = posix_openpt (O_RDWR|O_NOCTTY|O_NONBLOCK)) >= 0);
> +  master = posix_openpt (O_RDWR|O_NOCTTY|O_NONBLOCK);
> +  if (master < 0)
> +    {
> +      if (errno == ENOENT)
> +	FAIL_UNSUPPORTED ("posix_openpt: %m");
> +      else
> +	FAIL_EXIT1 ("posix_openpt: %m");
> +    }
>    VERIFY ((slavename = ptsname (master)));
>    VERIFY (unlockpt (master) == 0);
>    if (strncmp (slavename, "/dev/pts/", 9) != 0)
> -- 
> ldv

As I explained in a different thread: I generally support applying
this and backporting it to the 2.26 release branch.

However, shouldn't it also make this same change in do_in_chroot_2?

Of course, if do_in_chroot_1 returns EXIT_UNSUPPORTED, then
do_in_chroot_2 doesn't get to run.  But, as I think about that more, I
don't think that's the correct thing to do.

Maybe also do this?

@@ -557,12 +571,7 @@ do_test (void)
   support_become_root ();
 
   int ret1 = do_in_chroot_1 (run_chroot_tests);
-  if (ret1 == EXIT_UNSUPPORTED)
-    return ret1;
-
   int ret2 = do_in_chroot_2 (run_chroot_tests);
-  if (ret2 == EXIT_UNSUPPORTED)
-    return ret2;
 
   return  ret1 | ret2;

-- 
Happy hacking,
~ Luke Shumaker

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] tst-ttyname: skip the test when /dev/ptmx is not available
  2018-01-02  5:46 ` Luke Shumaker
@ 2018-01-08 11:48   ` Dmitry V. Levin
  0 siblings, 0 replies; 5+ messages in thread
From: Dmitry V. Levin @ 2018-01-08 11:48 UTC (permalink / raw)
  To: Luke Shumaker; +Cc: libc-alpha

[-- Attachment #1: Type: text/plain, Size: 1738 bytes --]

On Tue, Jan 02, 2018 at 12:46:29AM -0500, Luke Shumaker wrote:
> On Mon, 25 Dec 2017 16:41:54 -0500, Dmitry V. Levin wrote:
> > 
> > * sysdeps/unix/sysv/linux/tst-ttyname.c (do_in_chroot_1): Skip the
> > test instead of failing in case of ENOENT returned by posix_openpt.
> > ---
> >  ChangeLog                             | 5 +++++
> >  sysdeps/unix/sysv/linux/tst-ttyname.c | 9 ++++++++-
> >  2 files changed, 13 insertions(+), 1 deletion(-)
> > 
> > diff --git a/sysdeps/unix/sysv/linux/tst-ttyname.c b/sysdeps/unix/sysv/linux/tst-ttyname.c
> > index 0fdf1a8..6848a6d 100644
> > --- a/sysdeps/unix/sysv/linux/tst-ttyname.c
> > +++ b/sysdeps/unix/sysv/linux/tst-ttyname.c
> > @@ -253,7 +253,14 @@ do_in_chroot_1 (int (*cb)(const char *, int))
> >    /* Open the PTS that we'll be testing on.  */
> >    int master;
> >    char *slavename;
> > -  VERIFY ((master = posix_openpt (O_RDWR|O_NOCTTY|O_NONBLOCK)) >= 0);
> > +  master = posix_openpt (O_RDWR|O_NOCTTY|O_NONBLOCK);
> > +  if (master < 0)
> > +    {
> > +      if (errno == ENOENT)
> > +	FAIL_UNSUPPORTED ("posix_openpt: %m");
> > +      else
> > +	FAIL_EXIT1 ("posix_openpt: %m");
> > +    }
> >    VERIFY ((slavename = ptsname (master)));
> >    VERIFY (unlockpt (master) == 0);
> >    if (strncmp (slavename, "/dev/pts/", 9) != 0)
> > -- 
> > ldv
> 
> As I explained in a different thread: I generally support applying
> this and backporting it to the 2.26 release branch.
> 
> However, shouldn't it also make this same change in do_in_chroot_2?

If the first posix_openpt invocation succeeded, we may expect all
subsequent posix_openpt invocations will succeed, too.
If they don't, there must be something odd going on.


-- 
ldv

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] tst-ttyname: skip the test when /dev/ptmx is not available
  2017-12-25 21:41 [PATCH v2] tst-ttyname: skip the test when /dev/ptmx is not available Dmitry V. Levin
  2018-01-02  5:46 ` Luke Shumaker
@ 2018-01-08 11:53 ` Dmitry V. Levin
  2018-01-08 17:51   ` Florian Weimer
  1 sibling, 1 reply; 5+ messages in thread
From: Dmitry V. Levin @ 2018-01-08 11:53 UTC (permalink / raw)
  To: libc-alpha; +Cc: Florian Weimer

[-- Attachment #1: Type: text/plain, Size: 1269 bytes --]

On Tue, Dec 26, 2017 at 12:41:54AM +0300, Dmitry V. Levin wrote:
> * sysdeps/unix/sysv/linux/tst-ttyname.c (do_in_chroot_1): Skip the
> test instead of failing in case of ENOENT returned by posix_openpt.
> ---
>  ChangeLog                             | 5 +++++
>  sysdeps/unix/sysv/linux/tst-ttyname.c | 9 ++++++++-
>  2 files changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/tst-ttyname.c b/sysdeps/unix/sysv/linux/tst-ttyname.c
> index 0fdf1a8..6848a6d 100644
> --- a/sysdeps/unix/sysv/linux/tst-ttyname.c
> +++ b/sysdeps/unix/sysv/linux/tst-ttyname.c
> @@ -253,7 +253,14 @@ do_in_chroot_1 (int (*cb)(const char *, int))
>    /* Open the PTS that we'll be testing on.  */
>    int master;
>    char *slavename;
> -  VERIFY ((master = posix_openpt (O_RDWR|O_NOCTTY|O_NONBLOCK)) >= 0);
> +  master = posix_openpt (O_RDWR|O_NOCTTY|O_NONBLOCK);
> +  if (master < 0)
> +    {
> +      if (errno == ENOENT)
> +	FAIL_UNSUPPORTED ("posix_openpt: %m");
> +      else
> +	FAIL_EXIT1 ("posix_openpt: %m");
> +    }
>    VERIFY ((slavename = ptsname (master)));
>    VERIFY (unlockpt (master) == 0);
>    if (strncmp (slavename, "/dev/pts/", 9) != 0)

Florian, do you have any objections to this fix?


-- 
ldv

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] tst-ttyname: skip the test when /dev/ptmx is not available
  2018-01-08 11:53 ` Dmitry V. Levin
@ 2018-01-08 17:51   ` Florian Weimer
  0 siblings, 0 replies; 5+ messages in thread
From: Florian Weimer @ 2018-01-08 17:51 UTC (permalink / raw)
  To: libc-alpha

* Dmitry V. Levin:

> On Tue, Dec 26, 2017 at 12:41:54AM +0300, Dmitry V. Levin wrote:
>> * sysdeps/unix/sysv/linux/tst-ttyname.c (do_in_chroot_1): Skip the
>> test instead of failing in case of ENOENT returned by posix_openpt.
>> ---
>>  ChangeLog                             | 5 +++++
>>  sysdeps/unix/sysv/linux/tst-ttyname.c | 9 ++++++++-
>>  2 files changed, 13 insertions(+), 1 deletion(-)
>> 
>> diff --git a/sysdeps/unix/sysv/linux/tst-ttyname.c b/sysdeps/unix/sysv/linux/tst-ttyname.c
>> index 0fdf1a8..6848a6d 100644
>> --- a/sysdeps/unix/sysv/linux/tst-ttyname.c
>> +++ b/sysdeps/unix/sysv/linux/tst-ttyname.c
>> @@ -253,7 +253,14 @@ do_in_chroot_1 (int (*cb)(const char *, int))
>>    /* Open the PTS that we'll be testing on.  */
>>    int master;
>>    char *slavename;
>> -  VERIFY ((master = posix_openpt (O_RDWR|O_NOCTTY|O_NONBLOCK)) >= 0);
>> +  master = posix_openpt (O_RDWR|O_NOCTTY|O_NONBLOCK);
>> +  if (master < 0)
>> +    {
>> +      if (errno == ENOENT)
>> +	FAIL_UNSUPPORTED ("posix_openpt: %m");
>> +      else
>> +	FAIL_EXIT1 ("posix_openpt: %m");
>> +    }
>>    VERIFY ((slavename = ptsname (master)));
>>    VERIFY (unlockpt (master) == 0);
>>    if (strncmp (slavename, "/dev/pts/", 9) != 0)
>
> Florian, do you have any objections to this fix?

I still do not see the point, consdering that a test for posix_openpt
would still fail, had we one, but I don't have objections to the
change above.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-01-08 17:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-25 21:41 [PATCH v2] tst-ttyname: skip the test when /dev/ptmx is not available Dmitry V. Levin
2018-01-02  5:46 ` Luke Shumaker
2018-01-08 11:48   ` Dmitry V. Levin
2018-01-08 11:53 ` Dmitry V. Levin
2018-01-08 17:51   ` Florian Weimer

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).