-
-
Notifications
You must be signed in to change notification settings - Fork 28
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
tzdb integration #142
tzdb integration #142
Conversation
Hi! This is the friendly automated conda-forge-linting service. I just wanted to let you know that I linted all conda-recipes in your PR ( |
This reverts commit 2c40af6.
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.
A first quick review.
+ this_lib = (char*)malloc(total_length + 1); | ||
+ memcpy(this_lib, resolved, total_length); | ||
+#endif | ||
+ |
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.
For extra safety?
+ | |
+ | |
+ this_lib[static_cast<size_t>(total_length)] = '\0'; |
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 impossible to have a conda environment where the /lib
folder does not have at least depth 1 (and thus a guaranteed null byte that we'll insert below). Not sure what the extra null byte would achieve
+ if (dladdr(addr, &info)) { | ||
+ char* resolved = realpath(info.dli_fname, buffer); | ||
+ if (resolved) { | ||
+ int total_length = (int)strlen(resolved); |
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.
Should we prefer static_cast
?
This suggestion applies in other places.
+ // we're in $PREFIX/lib/libstdcxx.so | ||
+# define TO_PREFIX "/.." | ||
+# define PATH_SEP '/' | ||
+ char buffer[PATH_MAX]; |
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.
Out of curiosity, where is PATH_MAX
defined?
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 took this over from https://github.com/gpakosz/whereami, but some googling says its from <limits.h>
.
recipe/patches/0004-patch-zoneinfo_dir_override-to-point-to-our-tzdata.patch
Outdated
Show resolved
Hide resolved
d5397db
to
cc5880e
Compare
OK, this now passes some basic tests, though I'm sure the implementation can be improved (e.g. less allocations as @mbargull pointed out in #133). It's still using the
CC @conda-forge/ctng-compilers |
eebb928
to
0ed42a0
Compare
recipe/patches/0004-patch-zoneinfo_dir_override-to-point-to-our-tzdata.patch
Outdated
Show resolved
Hide resolved
loading zoneinfo_dir_override as an extern function does not actually get the address of the function where it is defined (c.f. implementation ``` void* addr = __builtin_extract_return_addr(__builtin_return_address(0)); ``` ), but ends up returning the address of the file from where it is called. As such, in order to observe/test the zoneinfo_dir_override implementation, export libstdcxx's zoneinfo_file, which does exactly what's needed.
@isuruf, this still fails when we compile something that needs |
That's because |
That's not a big surprise to me; it was an exploratory change, because I saw |
Though it is getting linked successfully while building with that change; before this patch, I needed to explicitly add |
If I do patch the Makefiles again, is it important for you to use the |
I haven't yet thought about the static linking case; I'll leave this one for @isuruf since he is more of an expert than me on it ;). |
Yes, we should link in |
Hi! This is the friendly automated conda-forge-linting service. I just wanted to let you know that I linted all conda-recipes in your PR ( |
Gentle ping @conda-forge/ctng-compilers |
All good now? |
-#ifdef _AIX | ||
- // Cannot override weak symbols on AIX. | ||
- const char* (*zoneinfo_dir_override)() = nullptr; | ||
-#else |
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.
Let's keep this block or at least #error so that we don't trip if we build this.
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.
Hmm, probably not needed since we have tests.
Thanks |
Retry bits that were de-scoped from #133