bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Bruno Haible <bruno@clisp.org>
To: bug-gnulib@gnu.org
Subject: Re: doc: Update regarding NetBSD
Date: Sat, 04 Feb 2023 02:45:33 +0100	[thread overview]
Message-ID: <2793700.ym9AcoWpTW@nimes> (raw)
In-Reply-To: <2207819.gQ4Ct1Qfld@nimes>

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

And here's the second attachment.

[-- Attachment #2: netbsd-bug2.txt --]
[-- Type: text/plain, Size: 1643 bytes --]

To: gnats-bugs@NetBSD.org
Subject: sigprocmask return value wrong when libpthread is in use
From: bruno@clisp.org
Reply-To: bruno@clisp.org
X-send-pr-version: 3.95


>Submitter-Id:	net
>Originator:	
>Organization:	GNU
>Confidential:	no
>Synopsis:	The return value of sigprocmask is not standards compliant
>Severity:	non-critical
>Priority:	medium
>Category:	lib
>Class:		sw-bug
>Release:	NetBSD 9.0
>Environment:
System: NetBSD netbsd9.bruno.haible.de 9.0 NetBSD 9.0 (GENERIC) #0: Fri Feb 14 00:06:28 UTC 2020 mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:
When a program that is linked with libpthread uses the sigprocmask function,
its return value can be wrong.
See https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_sigmask.html
section "RETURN VALUE".
>How-To-Repeat:
Compile this program
==================== foo.c ================
#include <errno.h>
#include <signal.h>
#include <stdio.h>

int main ()
{
  sigset_t set;
  int ret;

  sigemptyset (&set);
  sigaddset (&set, SIGINT);

  ret = sigprocmask (1729, &set, NULL);
  if (ret == 0)
    printf ("sigprocmask succeeded!\n");
  else
    printf ("sigprocmask -> %d, errno=%d\n", ret, errno);

  ret = pthread_sigmask (1729, &set, NULL);
  if (ret == 0)
    printf ("pthread_sigmask succeeded!\n");
  else
    printf ("pthread_sigmask -> %d\n", ret);

  return 0;
}
=============================================
$ gcc -Wall foo.c -lpthread
$ ./a.out

Expected output:
sigprocmask -> -1, errno=22
pthread_sigmask -> 22

Actual output:
sigprocmask -> 22, errno=22
pthread_sigmask -> 22

>Fix:

      reply	other threads:[~2023-02-04  1:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-04  1:44 doc: Update regarding NetBSD Bruno Haible
2023-02-04  1:45 ` Bruno Haible [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2793700.ym9AcoWpTW@nimes \
    --to=bruno@clisp.org \
    --cc=bug-gnulib@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).