public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug string/26555] New: strerrorname_np does not return the documented value
@ 2020-08-30 18:39 bruno at clisp dot org
  2020-08-30 18:42 ` [Bug string/26555] " bruno at clisp dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: bruno at clisp dot org @ 2020-08-30 18:39 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=26555

            Bug ID: 26555
           Summary: strerrorname_np does not return the documented value
           Product: glibc
           Version: 2.32
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: string
          Assignee: unassigned at sourceware dot org
          Reporter: bruno at clisp dot org
  Target Milestone: ---

Created attachment 12809
  --> https://sourceware.org/bugzilla/attachment.cgi?id=12809&action=edit
Test case

The documentation
https://www.gnu.org/software/libc/manual/html_node/Error-Messages.html says
that strerrorname_np returns "the name describing the error errnum or NULL if
there is no known constant with this value (e.g "EINVAL" for EINVAL)".

But this is not what it does. For EINVAL it returns "Invalid argument", not
"EINVAL".

Thus the function appears to behave identically to strerrordesc_np.

How to reproduce: Compile and run this test program:
================================ foo.c ================================
#define _GNU_SOURCE 1
#include <stdio.h>
#include <string.h>
#include <errno.h>

int main (void)
{
  printf ("strerrorname_np(EINVAL) = %s\n", strerrorname_np (EINVAL));
  printf ("strerrordesc_np(EINVAL) = %s\n", strerrordesc_np (EINVAL));
}
=======================================================================
Actual output:

strerrorname_np(EINVAL) = Invalid argument
strerrordesc_np(EINVAL) = Invalid argument

Expected output:

strerrorname_np(EINVAL) = EINVAL
strerrordesc_np(EINVAL) = Invalid argument

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug string/26555] strerrorname_np does not return the documented value
  2020-08-30 18:39 [Bug string/26555] New: strerrorname_np does not return the documented value bruno at clisp dot org
@ 2020-08-30 18:42 ` bruno at clisp dot org
  2020-08-30 18:46 ` bruno at clisp dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: bruno at clisp dot org @ 2020-08-30 18:42 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=26555

Bruno Haible <bruno at clisp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |x86_64-unknown-linux-gnu
                URL|                            |https://www.gnu.org/softwar
                   |                            |e/libc/manual/html_node/Err
                   |                            |or-Messages.html
               Host|                            |x86_64-unknown-linux-gnu

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug string/26555] strerrorname_np does not return the documented value
  2020-08-30 18:39 [Bug string/26555] New: strerrorname_np does not return the documented value bruno at clisp dot org
  2020-08-30 18:42 ` [Bug string/26555] " bruno at clisp dot org
@ 2020-08-30 18:46 ` bruno at clisp dot org
  2020-08-31 11:24 ` adhemerval.zanella at linaro dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: bruno at clisp dot org @ 2020-08-30 18:46 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=26555

--- Comment #1 from Bruno Haible <bruno at clisp dot org> ---
In the source code, I can see that strerrorname_np invokes __get_errname,
and __get_errname uses _sys_errnameidx and _sys_errname.

In the debugger I see:
(gdb) print _sys_errnameidx
$3 = {0, 8, 32, 58, 74, 98, 117, 143, 166, 184, 204, 709, 249, 272, 290, 302,
324, 348, 360, 386, 401, 417, 432, 469, 449, 499, 530, 
  545, 560, 584, 597, 619, 634, 646, 679, 223, 1518, 1657, 1676, 1567, 1484, 0,
1841, 1763, 2076, 2104, 2129, 2144, 2158, 2183, 2212, 
  2239, 2254, 2271, 2298, 2312, 2321, 2342, 0, 2355, 1893, 1801, 1966, 1868,
2376, 2406, 1640, 1819, 2428, 2444, 2458, 1951, 1782, 
...
(gdb) print _sys_errname
$4 = {{str4 = "Success", str9 = "Operation not permitted", str16 = "No such
file or directory", str21 = "No such process", 
    str32 = "Interrupted system call", str37 = "Input/output error", str46 =
"No such device or address", 
    str54 = "Argument list too long", str60 = "Exec format error", str67 = "Bad
file descriptor", str74 = "No child processes", 
    str82 = "Resource deadlock avoided", str88 = "Cannot allocate memory",
str93 = "Permission denied", str99 = "Bad address", 
    str106 = "Block device required", str113 = "Device or resource busy",
str119 = "File exists", 
...

It looks like the array _sys_errname contains the wrong strings.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug string/26555] strerrorname_np does not return the documented value
  2020-08-30 18:39 [Bug string/26555] New: strerrorname_np does not return the documented value bruno at clisp dot org
  2020-08-30 18:42 ` [Bug string/26555] " bruno at clisp dot org
  2020-08-30 18:46 ` bruno at clisp dot org
@ 2020-08-31 11:24 ` adhemerval.zanella at linaro dot org
  2020-08-31 14:03 ` adhemerval.zanella at linaro dot org
  2020-09-29 16:58 ` adhemerval.zanella at linaro dot org
  4 siblings, 0 replies; 6+ messages in thread
From: adhemerval.zanella at linaro dot org @ 2020-08-31 11:24 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=26555

Adhemerval Zanella <adhemerval.zanella at linaro dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at sourceware dot org   |adhemerval.zanella at linaro dot o
                   |                            |rg
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |ASSIGNED
                 CC|                            |adhemerval.zanella at linaro dot o
                   |                            |rg
   Last reconfirmed|                            |2020-08-31

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug string/26555] strerrorname_np does not return the documented value
  2020-08-30 18:39 [Bug string/26555] New: strerrorname_np does not return the documented value bruno at clisp dot org
                   ` (2 preceding siblings ...)
  2020-08-31 11:24 ` adhemerval.zanella at linaro dot org
@ 2020-08-31 14:03 ` adhemerval.zanella at linaro dot org
  2020-09-29 16:58 ` adhemerval.zanella at linaro dot org
  4 siblings, 0 replies; 6+ messages in thread
From: adhemerval.zanella at linaro dot org @ 2020-08-31 14:03 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=26555

--- Comment #2 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> ---
And the worse part is I added the testcase to catch it (which is also bogus
since it was not update on the review process), to catch this very issue but I
haven' t added on the Makefile.  I will send a patch to fix it and also update
the test-strerr to be decouple of the errlist.h itself.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug string/26555] strerrorname_np does not return the documented value
  2020-08-30 18:39 [Bug string/26555] New: strerrorname_np does not return the documented value bruno at clisp dot org
                   ` (3 preceding siblings ...)
  2020-08-31 14:03 ` adhemerval.zanella at linaro dot org
@ 2020-09-29 16:58 ` adhemerval.zanella at linaro dot org
  4 siblings, 0 replies; 6+ messages in thread
From: adhemerval.zanella at linaro dot org @ 2020-09-29 16:58 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=26555

Adhemerval Zanella <adhemerval.zanella at linaro dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |2.33
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> ---
Fixed on 2.33 (cef95fdc2e4002ee6357d8d40ef73c8d875720e3).

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

end of thread, other threads:[~2020-09-29 16:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-30 18:39 [Bug string/26555] New: strerrorname_np does not return the documented value bruno at clisp dot org
2020-08-30 18:42 ` [Bug string/26555] " bruno at clisp dot org
2020-08-30 18:46 ` bruno at clisp dot org
2020-08-31 11:24 ` adhemerval.zanella at linaro dot org
2020-08-31 14:03 ` adhemerval.zanella at linaro dot org
2020-09-29 16:58 ` adhemerval.zanella at linaro dot org

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