Repository navigation
fix: Fix ENODATA undefined on FreeBSD and OpenBSD - #906
Conversation
ENODATA is an XSI/SVID extension, not part of the POSIX base specification, so <errno.h> is not required to define it. FreeBSD and OpenBSD do not define it, which currently breaks the build of nanoarrow_ipc on those platforms. (NetBSD already defines ENODATA itself and is unaffected.) The existing fallback only kicked in for old Windows/MinGW toolchains (R 3.6). Widen the guard to apply on any platform that does not define ENODATA, so FreeBSD, OpenBSD, and other such systems also get the fallback definition. The value 120 matches the existing Windows/MinGW fallback and does not collide with any errno value defined by FreeBSD (ELAST == 97 as of FreeBSD 16-CURRENT) or OpenBSD (ELAST == 95).
|
All tests pass locally: |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #906 +/- ##
==========================================
- Coverage 79.96% 78.59% -1.38%
==========================================
Files 105 106 +1
Lines 15461 16128 +667
Branches 1738 1858 +120
==========================================
+ Hits 12364 12675 +311
- Misses 1998 2286 +288
- Partials 1099 1167 +68 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
ENODATA is an XSI/SVID extension and is not guaranteed by POSIX; FreeBSD and OpenBSD do not define it in errno.h, breaking the build of the vendored nanoarrow_ipc.c (nanoarrow 0.3.0) on those platforms. Add a portable fallback definition, matching the fix proposed upstream in apache/arrow-nanoarrow#906. This is a stopgap until Snowflake re-vendors a nanoarrow release containing that fix. Upstream-PR: apache/arrow-nanoarrow#906 This fixes snowflakedb#2967
|
'mmmm, Not sure if this is the correct fix for FreeBSD..... But I have my findings from porting Ceph to FreeBSD where Functions calls that under FreeBSD return ENOATTR and Ceph actually tests for ENODATA. These are mostly functions handeling (ex)atributes.... If you fix it in a different way:
So you atleast need to look at the function that it return got tested agains |
|
My problem with ENOATTR that it is logically tied to xattr and would be an abuse. Does it make it better? I am not a huge fan of the downstream patch either. I am open for improvements. |
paleolimbot
left a comment
There was a problem hiding this comment.
Thank you!
I agree that setting this to a random value is not ideal. Probably the bigger problem is that we're using ENODATA as a sentinel for a special case in the process of reading IPC files (the "end of stream"). There might be a function that surfaces this to users (we could change that and document it), but mostly this is internal.
We could either rewrite the code to avoid using a sentinal errno value at all, or use a different errno define like ENOATTR. It is probably better to use an actual define for anything we return to a user.
In any case, this change is an improvement (also happy to merge something like if !defined(ENODATA) -> ENOATTR as long as it's documented for any function where it actually returns to a user).
I totally agree that in essence ENODATA is tied to attributes... But just random assigning a leftover number doesn't help either. This is another definition that is available: Which is something I've come arcross in some other libraries. (Which ones I cannot recall at this moment) So it comes back to why do you want to define it? But looking at the objective off this project, where you build a set of functions to be used by others |
|
I don't mind which errno value we use here...I had to choose one of them to use as a sentinel and I didn't know at the time that ENODATA was problematic. The easiest short term solution is to pick a new sentinel that is not ENODATA; a more involved long term solution is to rewrite that portion of the IPC decoder to not use a sentinel value at all. |
Why not have a define of your own since it seems to be internal only? E.g. |
|
These are all great ideas...I opened #909 to track making the situation more robust, but I'll merge in the meantime since this is an improvement over the current failure mode on BSD (and because that particular value, defined internally, does not leak to users in the vast majority of current usage). |
|
@paleolimbot Thank you for the quick turnaround and do it the ASF way! |
ENODATA is an XSI/SVID extension, not part of the POSIX base specification, so <errno.h> is not required to define it. FreeBSD and OpenBSD do not define it, which currently breaks the build of nanoarrow_ipc on those platforms. (NetBSD already defines ENODATA itself and is unaffected.)
The existing fallback only kicked in for old Windows/MinGW toolchains (R 3.6). Widen the guard to apply on any platform that does not define ENODATA, so FreeBSD, OpenBSD, and other such systems also get the fallback definition.
The value 120 matches the existing Windows/MinGW fallback and does not collide with any errno value defined by FreeBSD (ELAST == 97 as of FreeBSD 16-CURRENT) or OpenBSD (ELAST == 95).