-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Labels
bug reportSomething is not working properlySomething is not working properlyinactiveNo activity in a certain period of timeNo activity in a certain period of timesystem-level bugBug is hidden somewhere in OS and can't be fixedBug is hidden somewhere in OS and can't be fixed
Description
Problem description
If I call tmpfile directly from the code, I get the inline version of tmpfile (from stdio.h) documented in #208. However, if I call tmpfile indirectly, the code fails as it calls the version in libc.so.
I found the issue when trying to port SBCL lisp in termux. They call the libc functions indirectly.
What steps will reproduce the bug?
compile this code
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <dlfcn.h>
void call_indirect()
{
void *clib;
FILE* (*mytmp)();
clib = dlopen("/system/lib64/libc.so",RTLD_LAZY);
if (clib) {
*(void **)(&mytmp) = dlsym(clib,"tmpfile");
FILE* fid = mytmp();
if (fid) {
printf("ok");
fclose(fid);
} else {
printf("failed");
}
}
}
void call_direct()
{
FILE* fid = tmpfile();
if (fid) {
printf("ok\n");
int status = fprintf(fid,"ok\n");
fclose(fid);
} else {
printf("failed\n");
}
}
int main () {
call_direct(); //expect ok
call_indirect(); //expect ok, got failed
}
What is the expected behavior?
I expect the program to print ok on both calls. But fails in the indirect call.
System information
Termux Variables:
TERMUX_APK_RELEASE=F_DROID
TERMUX_APP_PACKAGE_MANAGER=apt
TERMUX_APP_PID=23706
TERMUX_IS_DEBUGGABLE_BUILD=0
TERMUX_MAIN_PACKAGE_FORMAT=debian
TERMUX_VERSION=0.118.1
TERMUX__USER_ID=0
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://mirror.leitecastro.com/termux/termux-main stable main
Updatable packages:
binutils-bin/stable 2.44-1 aarch64 [upgradable from: 2.43.1]
binutils-libs/stable 2.44-1 aarch64 [upgradable from: 2.43.1]
binutils/stable 2.44-1 aarch64 [upgradable from: 2.43.1]
command-not-found/stable 2.4.0-70 aarch64 [upgradable from: 2.4.0-69]
glib/stable 2.84.0-2 aarch64 [upgradable from: 2.84.0-1]
liblzma/stable 5.8.1 aarch64 [upgradable from: 5.8.0]
xz-utils/stable 5.8.1 aarch64 [upgradable from: 5.8.0]
termux-tools version:
1.45.0
Android version:
10
Kernel build information:
Linux localhost 4.9.186-22990479 #1 SMP PREEMPT Thu Feb 24 18:21:21 KST 2022 aarch64 Android
Device manufacturer:
samsung
Device model:
SM-G960U
Supported ABIs:
SUPPORTED_ABIS: arm64-v8a,armeabi-v7a,armeabi
SUPPORTED_32_BIT_ABIS: armeabi-v7a,armeabi
SUPPORTED_64_BIT_ABIS: arm64-v8a
LD Variables:
LD_LIBRARY_PATH=
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec-ld-preload.soMetadata
Metadata
Assignees
Labels
bug reportSomething is not working properlySomething is not working properlyinactiveNo activity in a certain period of timeNo activity in a certain period of timesystem-level bugBug is hidden somewhere in OS and can't be fixedBug is hidden somewhere in OS and can't be fixed