-
-
Notifications
You must be signed in to change notification settings - Fork 770
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable large file support on old glibc #1910
Conversation
On glibc <2.23 fts.h doesn't support the feature: https://sourceware.org/bugzilla/show_bug.cgi?id=11460
Probably wouldn't occur in practice but glibc 1.23+ would also match the check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was discussed here: #1678 (comment)
I don't think we want to keep adding workarounds for buggy libc behavior which have been fixed for almost a decade now.
#if defined(__linux__) || defined(MINGW) || defined(__MINGW32__) \ | ||
|| defined(__MINGW64__) || defined(__CYGWIN__) | ||
#ifndef _GNU_SOURCE | ||
#define _GNU_SOURCE | ||
#endif | ||
#include <features.h> /* __GLIBC__ etc */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is a public header for us to be including.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't aware of this but indeed feature_test_macros(7) documents this. I can shuffle includes around a bit to avoid this if you're not against this PR a priori.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's upto @jarun to make the call. I personally don't think trying to work around a decade old glibc bug is worth it, especially since glibc maintainers now recommend defining it unconditionally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand the perspective but the one extra ifdef keeps nnn working on legacy platforms where system utilities like this remain useful. Note that RHEL 7 is still under extended lifecycle support. I'll keep it working in pkgsrc while I can but it would be nice if vanilla nnn kept working too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am fine with this. We should try to keep nnn
working on older systems.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
then unconditionally include one of the base headers like stddef.h to get the effects of features.h
This sounds okay.
That would assume it's okay to delay _FILE_OFFSET_BITS until after stddef.h
Unfortunately, I don't think this will work. From the feature_test_macros
manpage:
"NOTE: In order to be effective, a feature test macro must be defined before including any header files"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_FILE_OFFSET_BITS
is indeed checked by features.h, so a bit of a chicken and egg problem here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't think of a way to do this correctly without a configure script. Unless you do I propose we close this PR and I think of something better (or leave it as is).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a bit of pseudo configure script going on in the Makefile over here
Lines 189 to 190 in 86d883e
# test if we are on Mac OS X and get X.Y.Z OS version with system binary /usr/bin/sw_vers | |
MACOS_VERSION := $(strip $(shell command -v sw_vers >/dev/null && [ "`sw_vers -productName`" = "Mac OS X" ] && sw_vers -productVersion)) |
If you can do something like this without too much baggage (we don't want to slow down the build step noticeably) then that seems acceptable to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's a command that you can use to test glibc version in the makefile if you're still interested in pursuing this:
printf "#include <stdlib.h>\n#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 23)\nYES\n#else\nNO\n#endif\n" | cc -E - | tail -n1
It's your call to make - the advantage is that nnn can still run older targets such as CentOS 7, at the cost of a bit of preprocessor crud. Functionally there's no degradation on platforms where nnn already works. |
#if defined(__linux__) || defined(MINGW) || defined(__MINGW32__) \ | ||
|| defined(__MINGW64__) || defined(__CYGWIN__) | ||
#ifndef _GNU_SOURCE | ||
#define _GNU_SOURCE | ||
#endif | ||
#include <features.h> /* __GLIBC__ etc */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am fine with this. We should try to keep nnn
working on older systems.
Closing this since this is working for a very long time. |
On glibc <2.23 fts.h doesn't support the feature:
https://sourceware.org/bugzilla/show_bug.cgi?id=11460