Skip to content

Conversation

@aitap
Copy link
Member

@aitap aitap commented Dec 25, 2025

POSIX says:

The <signal.h> header shall define the siginfo_t type as a structure

So <sys/wait.h> is not enough to see the definition (not just a forward declaration) of siginfo_t.

Fixes: #7516

Tested manually on FreeBSD:

Details
$ R CMD check data.table_1.18.99.tar.gz --no-manual

* using R version 4.5.1 (2025-06-13)                                                   
* using platform: amd64-portbld-freebsd15.0                                            
* R was compiled by                                                                                                                                                            
    FreeBSD clang version 19.1.7 (https://github.com/llvm/llvm-project.git llvmorg-19.1.7-0-gcd708029e0b2)
    GNU Fortran (FreeBSD Ports Collection) 13.3.0                                      
* running under: FreeBSD freebsd 15.0-RELEASE FreeBSD 15.0-RELEASE releng/15.0-n280995-7aedc8de6446 GENERIC amd64
* checking whether package ‘data.table’ can be installed ... OK                        
* used C compiler: ‘FreeBSD clang version 19.1.7 (https://github.com/llvm/llvm-project.git llvmorg-19.1.7-0-gcd708029e0b2)’                                                    
* checking compiled code ... NOTE                                                      
File ‘data.table/libs/data_table.so’:   
  Found non-API calls to R: ‘IS_GROWABLE’, ‘LEVELS’, ‘SETLENGTH’,
    ‘SET_GROWABLE_BIT’, ‘SET_TRUELENGTH’, ‘TRUELENGTH’, ‘XTRUELENGTH’
Status: 1 NOTE                                                                         

...and OpenBSD:

Details
$ LANG=C.UTF-8 R CMD check data.table_1.18.99.tar.gz --no-manual

* R was compiled by                                                                    
    egcc (GCC) 8.4.0                                                                   
    GNU Fortran (GCC) 8.4.0                                                            
* running under: OpenBSD openbsd.my.domain 7.8 GENERIC#54 amd64                        

* checking whether package ‘data.table’ can be installed ... OK
* used C compiler: ‘OpenBSD clang version 19.1.7’

Status: OK

Also tested on GNU/Linux with PKG_CFLAGS=--std=c99.

@jszhao, could you please pull from this branch (posix_siginfo_t) and run R CMD build, then install the resulting tarball?

POSIX says:

> The <signal.h> header shall define the siginfo_t type as a structure

So <sys/wait.h> is not enough to see the definition (not just a forward
declaration) of siginfo_t.
@codecov
Copy link

codecov bot commented Dec 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.96%. Comparing base (3c06138) to head (a5a2644).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #7517   +/-   ##
=======================================
  Coverage   98.96%   98.96%           
=======================================
  Files          87       87           
  Lines       16737    16737           
=======================================
  Hits        16563    16563           
  Misses        174      174           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions
Copy link

github-actions bot commented Dec 25, 2025

  • HEAD=posix_siginfo_t stopped early for DT[by,verbose=TRUE] improved in #6296
  • HEAD=posix_siginfo_t stopped early for isoweek improved in #7144
    Comparison Plot

Generated via commit a5a2644

Download link for the artifact containing the test results: ↓ atime-results.zip

Task Duration
R setup and installing dependencies 2 minutes and 44 seconds
Installing different package versions 45 seconds
Running and plotting the test cases 4 minutes and 29 seconds

@jszhao
Copy link

jszhao commented Dec 26, 2025

POSIX says:

The <signal.h> header shall define the siginfo_t type as a structure

So <sys/wait.h> is not enough to see the definition (not just a forward declaration) of siginfo_t.

Fixes: #7516

Tested manually on FreeBSD:
Details

...and OpenBSD:
Details

Also tested on GNU/Linux with PKG_CFLAGS=--std=c99.

@jszhao, could you please pull from this branch (posix_siginfo_t) and run R CMD build, then install the resulting tarball?

I have used R CMD INSTALL ... to install this branch (in fact, I am not familiar with github, so I just downloaded the branch with zip file, unzip, and tar it to tarball). It works. Thanks a lot for your effect to fix it for FreeBSD. Thanks again.

Copy link
Member

@MichaelChirico MichaelChirico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

@MichaelChirico
Copy link
Member

cc @aitap for extra eyes on a5a2644 -- should we add the same to the other jobs with -D_FORTIFY_SOURCE=2? just doing so in the strict job for now.

@aitap
Copy link
Member Author

aitap commented Jan 3, 2026

Ironically, setting -D_POSIX_C_SOURCE=200809L makes gettimeofday invisible in FreeBSD 15 (indeed, POSIX.1-2008 marks it as obsolete, recommending clock_gettime() instead):

user@freebsd:~ $ echo '#include <sys/time.h>' | cpp | grep gettimeofday                                   
int gettimeofday(struct timeval *, struct timezone *);
user@freebsd:~ $ echo '#include <sys/time.h>' | cpp -D_POSIX_C_SOURCE=200809L | grep gettimeofday || echo not found
not found

We use gettimeofday in wallclock. (The code that wants to use clock_gettime() deprives itself of the opportunity by testing for #ifdef CLOCK_REALTIME before a header file can #define it. A fix to that will need to be careful not to reintroduce #5374.)

Unlike _POSIX_C_SOURCE, which controls symbol visibility, _FORTIFY_SOURCE rewrites some function calls to perform stricter checks. Is the idea to make strict checks use #define _POSIX_C_SOURCE 200809L because it will hide non-standard or obsolete symbols?

@MichaelChirico
Copy link
Member

I'm just looking for a way to fortify our checks such that we would have caught this issue before release

@aitap
Copy link
Member Author

aitap commented Jan 3, 2026

Then the strict checks must use --std=c99 to hide even more symbols, so that data.table could request some of them back using #define _POSIX_C_SOURCE=200809L:
https://gitlab.com/Rdatatable/data.table/-/commit/f02dcb783903727cbc043620f764b9d7f25c7af9/pipelines?ref=stricter_c99

(Right now the only failure is the -vanilla test, due to the C locale.)

Should I push f02dcb7 to this branch?

Drat. R itself uses configure-time tests for C23 features in R_ext/Rboolean.h, so when we later request C99 compatibility, this causes annoying warnings (because the configure-time tests aren't updated).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

data.table 1.18.0 could not be installed on FreeBSD

4 participants