I develop for Linux and OpenBSD and sometimes I get the error can't preload library
- do you know what it means?
The exact output I got was:
: can't preload library
When I try to run scripts and/or binaries. It seems to have to do with quoting but I'm not sure.
This problem does not occur on Linux, only OpenBSD.
The code is here but I don't know what it does:
void
_dl_dopreload(char *paths)
{
char *cp, *dp;
elf_object_t *shlib;
dp = paths = _dl_strdup(paths);
if (dp == NULL) {
_dl_printf("preload: out of memory");
_dl_exit(1);
}
while ((cp = _dl_strsep(&dp, ":")) != NULL) {
shlib = _dl_load_shlib(cp, _dl_objects, OBJTYPE_LIB,
_dl_objects->obj_flags);
if (shlib == NULL) {
_dl_printf("%s: can't preload library '%s'\n",
__progname, cp);
_dl_exit(4);
}
_dl_add_object(shlib);
_dl_link_child(shlib, _dl_objects);
}
_dl_free(paths);
return;
}
This is my script, which works with dash
and Linux, that I try to run with OpenBSD:s Korn shell.
#!/bin/sh
echo "-- Testing our implementation of OpenShell --"
echo ""
echo "- If you have any problem in passing a test read the corresponding"
echo "- source file to understand what the test is checking"
echo ""
printf "********************* PRESS ENTER TO RUN TESTS ... "
read _
# Key pressed, do something
printf "********************* TEST WILDCARDS \n***** Press any key to listing all files in current directory...\nYou should see filesnames *.* below "
read _
valgrind --leak-check=full -v ./shell << EOF
ls -al *.*
EOF
printf "********************* TEST ALGORITHMS ... \n***** Press any key to run the algorithms... .\nYou should see the output from top -b -n1|head -8|tail -1 "
read _
top -b -n1|head -8|tail -1|sort -n|wc -l
valgrind --leak-check=full -v ./shell << EOF
ls|grep open
EOF
printf "********************* TEST ALGORITHMS Part II. ... .\nYou should see the output from who|awk '{print \$4 ; print \$3}'|sort -n|wc -l. "
read _
valgrind --leak-check=full ./shell << EOF
who|awk '{print \$4 ; print \$3}'|sort -n|wc -l
EOF
printf "********************* TEST CHECKENV. ..... .\nYou should see the output checkenv below "
read _
valgrind ./shell << EOF
checkenv
EOF
printf "********************* TEST DONE. YOU SHOULD SEE OUTPUT FROM TEST ABOVE ... "
read _