[hurd] Fix arbitrary error code

Message ID 20220412094434.nqpydlozpprrkg6r@begin
State Superseded
Headers
Series [hurd] Fix arbitrary error code |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent
dj/TryBot-32bit success Build for i686

Commit Message

Samuel Thibault April 12, 2022, 9:44 a.m. UTC
  ELIBBAD is Linux-specific, Hurd has EGRATUITOUS instead.
  

Comments

Florian Weimer April 12, 2022, 9:53 a.m. UTC | #1
* Samuel Thibault:

> ELIBBAD is Linux-specific, Hurd has EGRATUITOUS instead.
>
> diff --git a/nss/nss_test_errno.c b/nss/nss_test_errno.c
> index 680f8a07b9..d27368f4f3 100644
> --- a/nss/nss_test_errno.c
> +++ b/nss/nss_test_errno.c
> @@ -28,7 +28,13 @@ static void __attribute__ ((constructor))
>  init (void)
>  {
>    /* An arbitrary error code which is otherwise not used.  */
> +#if defined(__linux__)
>    errno = ELIBBAD;
> +#elif defined(__GNU__)
> +  errno = EGRATUITOUS;
> +#else
> +#error missing arbitrary error code
> +#endif
>  }
>  
>  /* Lookup functions for pwd follow that do not return any data.  */

I don't see a build failure because of this?

Maybe we can pick another shared error code?

Related question: Would it be possible to add ELIBEXEC to Hurd some day?

Thanks,
Florian
  
Samuel Thibault April 12, 2022, 9:57 a.m. UTC | #2
Florian Weimer, le mar. 12 avril 2022 11:53:01 +0200, a ecrit:
> > +++ b/nss/nss_test_errno.c
> > @@ -28,7 +28,13 @@ static void __attribute__ ((constructor))
> >  init (void)
> >  {
> >    /* An arbitrary error code which is otherwise not used.  */
> > +#if defined(__linux__)
> >    errno = ELIBBAD;
> > +#elif defined(__GNU__)
> > +  errno = EGRATUITOUS;
> > +#else
> > +#error missing arbitrary error code
> > +#endif
> >  }
> >  
> >  /* Lookup functions for pwd follow that do not return any data.  */
> 
> I don't see a build failure because of this?

The build failure happens during make check, not during make.

> Maybe we can pick another shared error code?

Yep, sure, I'm just not sure what should be used.

> Related question: Would it be possible to add ELIBEXEC to Hurd some day?

That should be easy to implement, yes. We can already just enable its
definition in glibc, and we'll be able to implement it in Hurd's exec
server.

Samuel
  
Florian Weimer April 12, 2022, 10:31 a.m. UTC | #3
* Samuel Thibault:

>> I don't see a build failure because of this?
>
> The build failure happens during make check, not during make.

Huh.  For me, it does not.

>> Maybe we can pick another shared error code?
>
> Yep, sure, I'm just not sure what should be used.

We can use an arbitrary constant such as -1009.

Thanks,
Florian
  
Samuel Thibault April 12, 2022, 8:18 p.m. UTC | #4
Florian Weimer, le mar. 12 avril 2022 12:31:06 +0200, a ecrit:
> * Samuel Thibault:
> 
> >> I don't see a build failure because of this?
> >
> > The build failure happens during make check, not during make.
> 
> Huh.  For me, it does not.

Maybe I was not precise enough: the build failure happens on GNU/Hurd
systems only, where make check can actually not only build but also run
programs.

> >> Maybe we can pick another shared error code?
> >
> > Yep, sure, I'm just not sure what should be used.
> 
> We can use an arbitrary constant such as -1009.

Ok, done so!

Samuel
  
Samuel Thibault April 12, 2022, 8:45 p.m. UTC | #5
Samuel Thibault, le mar. 12 avril 2022 11:57:42 +0200, a ecrit:
> Florian Weimer, le mar. 12 avril 2022 11:53:01 +0200, a ecrit:
> > Related question: Would it be possible to add ELIBEXEC to Hurd some day?
> 
> That should be easy to implement, yes. We can already just enable its
> definition in glibc, and we'll be able to implement it in Hurd's exec
> server.

Now done so.

Samuel
  

Patch

diff --git a/nss/nss_test_errno.c b/nss/nss_test_errno.c
index 680f8a07b9..d27368f4f3 100644
--- a/nss/nss_test_errno.c
+++ b/nss/nss_test_errno.c
@@ -28,7 +28,13 @@  static void __attribute__ ((constructor))
 init (void)
 {
   /* An arbitrary error code which is otherwise not used.  */
+#if defined(__linux__)
   errno = ELIBBAD;
+#elif defined(__GNU__)
+  errno = EGRATUITOUS;
+#else
+#error missing arbitrary error code
+#endif
 }
 
 /* Lookup functions for pwd follow that do not return any data.  */