-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Replace realpath
to BSD implementation
#5620
Conversation
realpath
to BSD implementatiorealpath
to BSD implementation
This issue is introduced by NDK, see: android/ndk#1260 And NDK seems not going to fix it. So sad. |
Not a ton of time with a 1-month old here; basically limited to stuff I can do on my phone in between/during feedings. 🥲😴😅 |
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.
Might be best to do this in the busybox source, similar to this: https://github.com/osm0sis/android-busybox-ndk/blob/master/patches/024-a-hush-platform.patch
It's how busybox handles broken/incomplete platforms.
No. Your patch is for undefined symbols but mine is for replacing the bionic implementation. So doing something like your patch will raise duplicated symbols when linking. |
platform.h/.c can be used to wrap and add various functions and calls, sometimes replacing ones from the libc used on a particular platform by defining a bb_ version instead. Yours could be added in code as bb_realpath in platform.c, then defined as a replacement in platform.h, I think I've seen that done in busybox before. 🤷♂️ |
Sort of? I might be also thinking about how I took the bb_ functions for ttyname and used them in my nano builds by defining it as the replacement for the useless NDK stub version of it: https://forum.xda-developers.com/t/tools-zips-scripts-osm0sis-odds-and-ends-multiple-devices-platforms.2239421/page-34#post-66486572 But busybox platform.h/.c should allow for something similar I thought. |
Ok, I see now. Instead of |
Bingo! And nah, in busybox platform is in all, since it has all the platform hacks needed everywhere. 👍 |
Then it's safe to use |
Sounds good. Can you let me know the first SDK version or NDK version where this issue started? It worked last with Magisk 24.1 I believe. I'll look into guarding it in a patch to platform.h with that, and upstream it in busybox if they'll accept it. |
ndk 21 and ndk 22 have no problem. ndk 23 introduces the problem. |
Could this regression break anything else in Magisk? Should the used NDK perhaps be downgraded for now? I know @topjohnwu has done that in the past. |
Only busybox is affected. |
@osm0sis we shouldn't upstream this to BusyBox, as this is an issue with Bionic updating |
I mean, busybox is about supporting broken platforms in places so it's not entirely outside their usual, but 👍 |
Fix #5530
The thing is, ndk changes its
realpath
implementation to a new one that does not support kernel with version < 3.6. So, on some old devices or TWRP,readlink -f
will fail. This replaces therealpath
implementation to support older kernel versions.@osm0sis Could you help me make this change to ndk-kitchen and co-author me? Thx.