diff mbox series

posix: Add error message for EAI_OVERFLOW

Message ID 20230525124503.152721-1-dridi.boukelmoune@gmail.com
State New
Headers show
Series posix: Add error message for EAI_OVERFLOW | expand

Commit Message

Dridi Boukelmoune May 25, 2023, 12:45 p.m. UTC
Signed-off-by: Dridi Boukelmoune <dridi.boukelmoune@gmail.com>
---
 sysdeps/posix/gai_strerror-strs.h | 1 +
 1 file changed, 1 insertion(+)

Comments

Arjun Shankar May 29, 2023, 1:34 p.m. UTC | #1
> Signed-off-by: Dridi Boukelmoune <dridi.boukelmoune@gmail.com>
> ---
>  sysdeps/posix/gai_strerror-strs.h | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/sysdeps/posix/gai_strerror-strs.h b/sysdeps/posix/gai_strerror-strs.h
> index 19040a5138..667c4b2d4a 100644
> --- a/sysdeps/posix/gai_strerror-strs.h
> +++ b/sysdeps/posix/gai_strerror-strs.h
> @@ -15,3 +15,4 @@ _S(EAI_NOTCANCELED, N_("Request not canceled"))
>  _S(EAI_ALLDONE, N_("All requests done"))
>  _S(EAI_INTR, N_("Interrupted by a signal"))
>  _S(EAI_IDN_ENCODE, N_("Parameter string not correctly encoded"))
> +_S(EAI_OVERFLOW, N_("Result too large for supplied buffer"))
> --
> 2.40.1
>

Thanks! This looks good to me.

Reviewed-by: Arjun Shankar <arjun@redhat.com>

...and I already pushed it!
Arjun Shankar May 29, 2023, 2:59 p.m. UTC | #2
> > Signed-off-by: Dridi Boukelmoune <dridi.boukelmoune@gmail.com>
> > ---
> >  sysdeps/posix/gai_strerror-strs.h | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/sysdeps/posix/gai_strerror-strs.h b/sysdeps/posix/gai_strerror-strs.h
> > index 19040a5138..667c4b2d4a 100644
> > --- a/sysdeps/posix/gai_strerror-strs.h
> > +++ b/sysdeps/posix/gai_strerror-strs.h
> > @@ -15,3 +15,4 @@ _S(EAI_NOTCANCELED, N_("Request not canceled"))
> >  _S(EAI_ALLDONE, N_("All requests done"))
> >  _S(EAI_INTR, N_("Interrupted by a signal"))
> >  _S(EAI_IDN_ENCODE, N_("Parameter string not correctly encoded"))
> > +_S(EAI_OVERFLOW, N_("Result too large for supplied buffer"))
> > --
> > 2.40.1
> >
>
> Thanks! This looks good to me.
>
> Reviewed-by: Arjun Shankar <arjun@redhat.com>
>
> ...and I already pushed it!

It would be nice to have a new test for gai_strerror: whether it
returns a unique string for each of the errors it should handle. It
also seems that `gai_strerror (0)` returns "Unknown error". It would
be nice if it returned "Success" instead. strerror already does the
same, presumably from sysdeps/gnu/errlist.h. Would you be interested
in fixing one or both of these up?
Dridi Boukelmoune May 29, 2023, 4:48 p.m. UTC | #3
> It would be nice to have a new test for gai_strerror: whether it
> returns a unique string for each of the errors it should handle. It
> also seems that `gai_strerror (0)` returns "Unknown error". It would
> be nice if it returned "Success" instead. strerror already does the
> same, presumably from sysdeps/gnu/errlist.h. Would you be interested
> in fixing one or both of these up?

I will have a look at how glibc is tested and give it a try.

Dridi
Carlos O'Donell May 30, 2023, 11:32 a.m. UTC | #4
On 5/29/23 12:48, Dridi Boukelmoune via Libc-alpha wrote:
>> It would be nice to have a new test for gai_strerror: whether it
>> returns a unique string for each of the errors it should handle. It
>> also seems that `gai_strerror (0)` returns "Unknown error". It would
>> be nice if it returned "Success" instead. strerror already does the
>> same, presumably from sysdeps/gnu/errlist.h. Would you be interested
>> in fixing one or both of these up?
> 
> I will have a look at how glibc is tested and give it a try.

Thanks!

The 'gai_strerror()' function is indirectly tested by getaddrinfo() tests in posix/*

To add a test for this you would:

- Add a new test in posix/* e.g. posix/tst-gai_strerror.c
- Add the test to posix/Makefile 'tests' target (lines 191-320) in the correct
  alpha sort position.
  Note: python scripts/sort-makefile-lines.py will sort lines for you.
- Use '#include <support/test-driver.c>' infrastructure.
  e.g. posix/tst-fnmatch7.c

Additional notes here:
https://sourceware.org/glibc/wiki/Testing/Builds
Dridi Boukelmoune June 10, 2023, 7:19 a.m. UTC | #5
> The 'gai_strerror()' function is indirectly tested by getaddrinfo() tests in posix/*
>
> To add a test for this you would:
>
> - Add a new test in posix/* e.g. posix/tst-gai_strerror.c
> - Add the test to posix/Makefile 'tests' target (lines 191-320) in the correct
>   alpha sort position.
>   Note: python scripts/sort-makefile-lines.py will sort lines for you.
> - Use '#include <support/test-driver.c>' infrastructure.
>   e.g. posix/tst-fnmatch7.c
>
> Additional notes here:
> https://sourceware.org/glibc/wiki/Testing/Builds

With your tips and `make help` I was able to submit a test case.

Thanks!
diff mbox series

Patch

diff --git a/sysdeps/posix/gai_strerror-strs.h b/sysdeps/posix/gai_strerror-strs.h
index 19040a5138..667c4b2d4a 100644
--- a/sysdeps/posix/gai_strerror-strs.h
+++ b/sysdeps/posix/gai_strerror-strs.h
@@ -15,3 +15,4 @@  _S(EAI_NOTCANCELED, N_("Request not canceled"))
 _S(EAI_ALLDONE, N_("All requests done"))
 _S(EAI_INTR, N_("Interrupted by a signal"))
 _S(EAI_IDN_ENCODE, N_("Parameter string not correctly encoded"))
+_S(EAI_OVERFLOW, N_("Result too large for supplied buffer"))