* ptsname_r on Cygwin
@ 2021-01-20 6:31 Bruno Haible
2021-01-20 8:11 ` Bruno Haible
2021-01-21 18:21 ` Ken Brown
0 siblings, 2 replies; 6+ messages in thread
From: Bruno Haible @ 2021-01-20 6:31 UTC (permalink / raw)
To: Ken Brown, bug-gnulib
Hi Ken,
On Cygwin 2.9 (64-bit) I see a test failure in test-ptsname_r.c, here:
{
char buffer[256];
int result;
result = ptsname_r (-1, buffer, sizeof buffer);
ASSERT (result != 0); // <======================== HERE
ASSERT (result == EBADF || result == ENOTTY);
}
While https://www.kernel.org/doc/man-pages/online/pages/man3/ptsname_r.3.html
says that ptsname_r, upon failure, should return an error code, on Cygwin,
it returns 0 and stores the empty string in 'buffer'.
This causes 2 test failures of Gnulib tests:
FAIL: test-ptsname
==================
../../gltests/test-ptsname.c:76: assertion 'result == NULL' failed
FAIL test-ptsname.exe (exit status: 134)
FAIL: test-ptsname_r
====================
../../gltests/test-ptsname_r.c:126: assertion 'result != 0' failed
FAIL test-ptsname_r.exe (exit status: 134)
Bruno
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ptsname_r on Cygwin
2021-01-20 6:31 ptsname_r on Cygwin Bruno Haible
@ 2021-01-20 8:11 ` Bruno Haible
2021-01-21 18:21 ` Ken Brown
1 sibling, 0 replies; 6+ messages in thread
From: Bruno Haible @ 2021-01-20 8:11 UTC (permalink / raw)
To: Ken Brown; +Cc: bug-gnulib
> While https://www.kernel.org/doc/man-pages/online/pages/man3/ptsname_r.3.html
> says that ptsname_r, upon failure, should return an error code, on Cygwin,
> it returns 0 and stores the empty string in 'buffer'.
Let me document this issue.
2021-01-20 Bruno Haible <bruno@clisp.org>
doc: Document ptsname_r bug on Cygwin.
* doc/glibc-functions/ptsname_r.texi: Mention Cygwin bug.
diff --git a/doc/glibc-functions/ptsname_r.texi b/doc/glibc-functions/ptsname_r.texi
index 0bfd05b..a79e751 100644
--- a/doc/glibc-functions/ptsname_r.texi
+++ b/doc/glibc-functions/ptsname_r.texi
@@ -25,13 +25,17 @@ Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 6.7, Minix 3.1.8,
AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 11.4, Cygwin 1.7.9, mingw,
MSVC 14.
@item
-When this functions fails, it returns -1 instead of the error code
+When this function fails, it returns -1 instead of the error code
on some platforms:
Mac OS X 10.13, Android 4.3.
@end itemize
Portability problems not fixed by Gnulib:
@itemize
+@item
+When this function fails, it returns 0 and stores an empty string as result
+on some platforms:
+Cygwin 2.9.
@end itemize
Note: Portable programs should expect to find the error code as the
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: ptsname_r on Cygwin
2021-01-20 6:31 ptsname_r on Cygwin Bruno Haible
2021-01-20 8:11 ` Bruno Haible
@ 2021-01-21 18:21 ` Ken Brown
2021-01-21 20:26 ` Bruno Haible
1 sibling, 1 reply; 6+ messages in thread
From: Ken Brown @ 2021-01-21 18:21 UTC (permalink / raw)
To: Bruno Haible, bug-gnulib
Hi Bruno,
On 1/20/2021 1:31 AM, Bruno Haible wrote:
> Hi Ken,
>
> On Cygwin 2.9 (64-bit) I see a test failure in test-ptsname_r.c, here:
>
> {
> char buffer[256];
> int result;
>
> result = ptsname_r (-1, buffer, sizeof buffer);
> ASSERT (result != 0); // <======================== HERE
> ASSERT (result == EBADF || result == ENOTTY);
> }
>
> While https://www.kernel.org/doc/man-pages/online/pages/man3/ptsname_r.3.html
> says that ptsname_r, upon failure, should return an error code, on Cygwin,
> it returns 0 and stores the empty string in 'buffer'.
>
> This causes 2 test failures of Gnulib tests:
>
>
> FAIL: test-ptsname
> ==================
>
> ../../gltests/test-ptsname.c:76: assertion 'result == NULL' failed
> FAIL test-ptsname.exe (exit status: 134)
>
> FAIL: test-ptsname_r
> ====================
>
> ../../gltests/test-ptsname_r.c:126: assertion 'result != 0' failed
> FAIL test-ptsname_r.exe (exit status: 134)
Thanks for the report. I've submitted a patch that fixes this:
https://cygwin.com/pipermail/cygwin-patches/2021q1/010995.html
Ken
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ptsname_r on Cygwin
2021-01-21 18:21 ` Ken Brown
@ 2021-01-21 20:26 ` Bruno Haible
2021-01-21 22:45 ` Ken Brown
0 siblings, 1 reply; 6+ messages in thread
From: Bruno Haible @ 2021-01-21 20:26 UTC (permalink / raw)
To: Ken Brown; +Cc: bug-gnulib
Ken Brown wrote:
> Thanks for the report. I've submitted a patch that fixes this:
>
> https://cygwin.com/pipermail/cygwin-patches/2021q1/010995.html
Thanks. EBADF is the more "proper" errno value here, for fd < 0. But
glibc produces errno ENOTTY in this case; so it should be acceptable too.
Bruno
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ptsname_r on Cygwin
2021-01-21 20:26 ` Bruno Haible
@ 2021-01-21 22:45 ` Ken Brown
2021-01-22 15:48 ` Ken Brown
0 siblings, 1 reply; 6+ messages in thread
From: Ken Brown @ 2021-01-21 22:45 UTC (permalink / raw)
To: Bruno Haible; +Cc: bug-gnulib
On 1/21/2021 3:26 PM, Bruno Haible wrote:
> Ken Brown wrote:
>> Thanks for the report. I've submitted a patch that fixes this:
>>
>> https://cygwin.com/pipermail/cygwin-patches/2021q1/010995.html
>
> Thanks. EBADF is the more "proper" errno value here, for fd < 0. But
> glibc produces errno ENOTTY in this case; so it should be acceptable too.
I thought EBADF made more sense too, but Cygwin generally tries to emulate
Linux. We'll see what Corinna thinks.
Ken
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ptsname_r on Cygwin
2021-01-21 22:45 ` Ken Brown
@ 2021-01-22 15:48 ` Ken Brown
0 siblings, 0 replies; 6+ messages in thread
From: Ken Brown @ 2021-01-22 15:48 UTC (permalink / raw)
To: Bruno Haible; +Cc: bug-gnulib
On 1/21/2021 5:45 PM, Ken Brown wrote:
> On 1/21/2021 3:26 PM, Bruno Haible wrote:
>> Ken Brown wrote:
>>> Thanks for the report. I've submitted a patch that fixes this:
>>>
>>> https://cygwin.com/pipermail/cygwin-patches/2021q1/010995.html
>>
>> Thanks. EBADF is the more "proper" errno value here, for fd < 0. But
>> glibc produces errno ENOTTY in this case; so it should be acceptable too.
>
> I thought EBADF made more sense too, but Cygwin generally tries to emulate
> Linux. We'll see what Corinna thinks.
Corinna agreed with you but left it up to me, so I went with EBADF.
Thanks.
Ken
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-01-22 16:05 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-20 6:31 ptsname_r on Cygwin Bruno Haible
2021-01-20 8:11 ` Bruno Haible
2021-01-21 18:21 ` Ken Brown
2021-01-21 20:26 ` Bruno Haible
2021-01-21 22:45 ` Ken Brown
2021-01-22 15:48 ` Ken Brown
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).