Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

test_sigwaitinfo fails on NetBSD due to POSIX violation #137490

Closed
Labels
3.13bugs and security fixes3.14bugs and security fixes3.15new features, bugs and security fixesOS-netbsdtestsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error
@furkanonder

Description

@furkanonder

Bug report

Bug description:

TheSignalEINTRTest.test_sigwaitinfo test intest_eintr fails on NetBSD. According to the officialPOSIX.1-2024 specification forsigwaitinfo:

"The sigtimedwait() and sigwaitinfo() functions may fail if: [EINTR] The wait was interrupted by an unblocked, caught signal."

NetBSD'ssigwaitinfo() implementation violates POSIX by returningerrno = ECANCELED (87) instead oferrno = EINTR (4) when interrupted by a signal not in the wait set.

Configuration

./configure --with-pydebug

Test

╰─$ ./python-munittesttest._test_eintr.SignalEINTRTest.test_sigwaitinfo-vtest_sigwaitinfo (test._test_eintr.SignalEINTRTest.test_sigwaitinfo) ...ERROR======================================================================ERROR:test_sigwaitinfo (test._test_eintr.SignalEINTRTest.test_sigwaitinfo)----------------------------------------------------------------------Traceback (mostrecentcalllast):File"/home/blue/Desktop/cpython/Lib/test/_test_eintr.py",line440,intest_sigwaitinfoself.check_sigwait(wait_func)~~~~~~~~~~~~~~~~~~^^^^^^^^^^^File"/home/blue/Desktop/cpython/Lib/test/_test_eintr.py",line430,incheck_sigwaitwait_func(signum)~~~~~~~~~^^^^^^^^File"/home/blue/Desktop/cpython/Lib/test/_test_eintr.py",line438,inwait_funcsignal.sigwaitinfo([signum])~~~~~~~~~~~~~~~~~~^^^^^^^^^^OSError: [Errno87]Operationcanceled----------------------------------------------------------------------Ran1testin0.112sFAILED (errors=1)

Reproduction

I created a minimal C program that reproduces the same issue.

#include<signal.h>#include<pthread.h>#include<unistd.h>#include<sys/wait.h>#include<stdio.h>#include<stdlib.h>#include<errno.h>#include<string.h>volatilesig_atomic_tgot_sigalrm=0;voidsigalrm_handler(intsig) {got_sigalrm=1;printf("SIGALRM handler called\n");}intmain() {printf("sigwaitinfo interruption test\n");sigset_tsigset;siginfo_tinfo;inttarget_signal=SIGUSR1;// Set SIGALRM handlerstructsigactionsa= {0};sa.sa_handler=sigalrm_handler;sigaction(SIGALRM,&sa,NULL);// Block SIGUSR1 and save old masksigemptyset(&sigset);sigaddset(&sigset,target_signal);pthread_sigmask(SIG_BLOCK,&sigset,NULL);printf("Blocked SIGUSR1, waiting with sigwaitinfo...\n");pid_tpid=fork();if (pid==0) {sleep(1);printf("Child: sending SIGALRM to interrupt parent\n");kill(getppid(),SIGALRM);exit(0);    }printf("Parent: calling sigwaitinfo([SIGUSR1])...\n");intresult=sigwaitinfo(&sigset,&info);if (result==-1) {printf("sigwaitinfo failed: errno = %d (%s)\n",errno,strerror(errno));    }printf("SIGALRM handler was called: %s\n",got_sigalrm ?"yes" :"no");intstatus;waitpid(pid,&status,0);printf("Child exited with status: %d\n",WEXITSTATUS(status));return0;}

Output on NetBSD 10.0:

sigwaitinfo interruption testBlocked SIGUSR1, waiting with sigwaitinfo...Parent: calling sigwaitinfo([SIGUSR1])...Child: sending SIGALRM to interrupt parentSIGALRM handler calledsigwaitinfo failed: errno = 87 (Operation canceled)SIGALRM handler was called: yesChild exited with status: 0

Expected POSIX-compliant output (Linux):

sigwaitinfo interruption testBlocked SIGUSR1, waiting with sigwaitinfo...Parent: calling sigwaitinfo([SIGUSR1])...Child: sending SIGALRM to interrupt parentSIGALRM handler calledsigwaitinfo failed: errno = 4 (Interrupted system call)SIGALRM handler was called: yesChild exited with status: 0

CPython versions tested on:

CPython main branch, 3.15, 3.14, 3.13

Operating systems tested on:

Other

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13bugs and security fixes3.14bugs and security fixes3.15new features, bugs and security fixesOS-netbsdtestsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp