From 17bdd56e02b142944e2bf6d8e0f1fb939f268497 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Sun, 16 Jul 2023 03:51:57 +0200 Subject: [PATCH] Never export LD_LIBRARY_PATH It's been made redundant by the RPATH changes The only platform that gets the dubious honor of actually needing an LD_LIBRARY_PATH is PocketBook, because of InkView. Co-authored-by: Benoit Pierre Bump base to pull in the aforementioned RPATH changes ;). https://github.com/koreader/koreader-base/pull/1638 --- base | 2 +- frontend/device/sdl/device.lua | 3 +-- kodev | 20 +++++++------------- platform/appimage/AppRun | 3 --- platform/cervantes/koreader.sh | 3 --- platform/debian/koreader.sh | 3 --- platform/kindle/koreader.sh | 7 ++----- platform/kobo/disable-wifi.sh | 2 +- platform/kobo/enable-wifi.sh | 3 +-- platform/kobo/koreader.sh | 3 --- platform/kobo/nickel.sh | 2 +- platform/kobo/obtain-ip.sh | 4 ++-- platform/kobo/release-ip.sh | 2 +- platform/pocketbook/koreader.app | 7 ++++--- platform/remarkable/koreader.sh | 3 --- platform/ubuntu-touch/koreader.sh | 3 --- 16 files changed, 21 insertions(+), 49 deletions(-) diff --git a/base b/base index a938d082b..b0f7e9984 160000 --- a/base +++ b/base @@ -1 +1 @@ -Subproject commit a938d082ba3f39a9d5cc39492637ce8711b9dd3f +Subproject commit b0f7e99845b16fc4176d3d29e4ffc258baa53cca diff --git a/frontend/device/sdl/device.lua b/frontend/device/sdl/device.lua index f30c7853a..3c35832ed 100644 --- a/frontend/device/sdl/device.lua +++ b/frontend/device/sdl/device.lua @@ -27,8 +27,7 @@ local function isCommand(s) end local function runCommand(command) - local env = jit.os ~= "OSX" and 'env -u LD_LIBRARY_PATH ' or "" - return os.execute(env..command) == 0 + return os.execute(command) == 0 end local function getDesktopDicts() diff --git a/kodev b/kodev index fe91314bc..423b71602 100755 --- a/kodev +++ b/kodev @@ -136,9 +136,6 @@ function setup_env() { fi EMU_DIR="${files[${idx}]}/koreader" export EMU_DIR - KO_LD_LIBRARY_PATH="$(realpath "${EMU_DIR}")/libs:${LD_LIBRARY_PATH}" - # Don't export it to avoid messing with tools (e.g., debuggers). - # We'll pass it to LuaJIT via env } function kodev-fetch-thirdparty() { @@ -818,7 +815,7 @@ TARGET: fi KOREADER_ARGS="-d" - KOREADER_COMMAND="env LD_LIBRARY_PATH=${KO_LD_LIBRARY_PATH} ./reader.lua ${KOREADER_ARGS}" + KOREADER_COMMAND="./reader.lua ${KOREADER_ARGS}" # run with catchsegv by default when it is available (unless no-catchsegv is enabled, c.f., #7036) # see https://github.com/koreader/koreader/issues/2878#issuecomment-326796777 @@ -829,7 +826,7 @@ TARGET: fi if [ -n "${valgrind}" ]; then - KOREADER_COMMAND="${valgrind} env LD_LIBRARY_PATH=${KO_LD_LIBRARY_PATH} ./luajit reader.lua ${KOREADER_ARGS}" + KOREADER_COMMAND="${valgrind} ./luajit reader.lua ${KOREADER_ARGS}" fi echo "[*] Running KOReader with arguments: $* ..." @@ -843,9 +840,9 @@ TARGET: # We don't want to stack valgrind/catchsegv on top of GDB ;). if [[ "${gdb}" == gdb* ]]; then # The standard CLI needs a little hand holding to properly pass arguments to the process it'll monitor - KOREADER_COMMAND="${gdb} --args env LD_LIBRARY_PATH=${KO_LD_LIBRARY_PATH} ./luajit reader.lua ${KOREADER_ARGS} ${args}" + KOREADER_COMMAND="${gdb} --args ./luajit reader.lua ${KOREADER_ARGS} ${args}" else - KOREADER_COMMAND="${gdb} env LD_LIBRARY_PATH=${KO_LD_LIBRARY_PATH} ./luajit reader.lua ${KOREADER_ARGS} ${args}" + KOREADER_COMMAND="${gdb} ./luajit reader.lua ${KOREADER_ARGS} ${args}" fi else KOREADER_COMMAND="${KOREADER_COMMAND} ${args}" @@ -952,8 +949,7 @@ OPTIONS: fi echo "Running tests in" "${test_path}" - env LD_LIBRARY_PATH="${KO_LD_LIBRARY_PATH}" \ - busted --lua="./luajit" "${opts}" \ + busted --lua="./luajit" "${opts}" \ --output=gtest \ --lpath="${test_path_basedir}/?.lua" \ --exclude-tags=notest "${test_path}" @@ -1091,8 +1087,7 @@ OPTIONS: test_path="./spec/${target}/unit" if [ "${show_previous}" -eq 0 ]; then echo "Running tests in" ${test_path} - env LD_LIBRARY_PATH="${KO_LD_LIBRARY_PATH}" \ - busted --lua="./luajit" \ + busted --lua="./luajit" \ --sort-files \ -o "./spec/${target}/unit/verbose_print" \ --coverage \ @@ -1260,8 +1255,7 @@ case "${1}" in prompt) kodev-build pushd "${EMU_DIR}" && { - env LD_LIBRARY_PATH="${KO_LD_LIBRARY_PATH}" \ - ./luajit -i setupkoenv.lua + ./luajit -i setupkoenv.lua } && popd || exit ;; log) diff --git a/platform/appimage/AppRun b/platform/appimage/AppRun index 35a735c4c..adcc68a24 100755 --- a/platform/appimage/AppRun +++ b/platform/appimage/AppRun @@ -7,9 +7,6 @@ KOREADER_DIR="${0%/*}" # we're always starting from our working directory cd "${KOREADER_DIR}" || exit -# export load library path -export LD_LIBRARY_PATH="${KOREADER_DIR}/libs":"${LD_LIBRARY_PATH}" - RETURN_VALUE=85 while [ ${RETURN_VALUE} -eq 85 ]; do diff --git a/platform/cervantes/koreader.sh b/platform/cervantes/koreader.sh index 6f975f88d..ac9deb3da 100755 --- a/platform/cervantes/koreader.sh +++ b/platform/cervantes/koreader.sh @@ -53,9 +53,6 @@ if [ -n "${fail}" ] && [ "${fail}" -eq 0 ]; then exec ./koreader.sh "$@" fi -# load our own shared libraries if possible -export LD_LIBRARY_PATH="${KOREADER_DIR}/libs" - # export trained OCR data directory export TESSDATA_PREFIX="data" diff --git a/platform/debian/koreader.sh b/platform/debian/koreader.sh index 3f68a5fb1..9d4f1cb4c 100755 --- a/platform/debian/koreader.sh +++ b/platform/debian/koreader.sh @@ -16,9 +16,6 @@ KOREADER_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/../lib/koreader" # we're always starting from our working directory cd "${KOREADER_DIR}" || exit -# export load library path -export LD_LIBRARY_PATH=${KOREADER_DIR}/libs:${LD_LIBRARY_PATH} - RETURN_VALUE=85 while [ ${RETURN_VALUE} -eq 85 ]; do ./reader.lua "${ARGS}" diff --git a/platform/kindle/koreader.sh b/platform/kindle/koreader.sh index ae2b01603..eb62de0c0 100755 --- a/platform/kindle/koreader.sh +++ b/platform/kindle/koreader.sh @@ -177,9 +177,6 @@ if [ -n "${fail}" ] && [ "${fail}" -eq 0 ]; then exec ./koreader.sh ${REEXEC_FLAGS} "${@}" fi -# load our own shared libraries if possible -export LD_LIBRARY_PATH="${KOREADER_DIR}/libs:${LD_LIBRARY_PATH}" - # export trained OCR data directory export TESSDATA_PREFIX="data" @@ -355,9 +352,9 @@ fi if [ "${STOP_FRAMEWORK}" = "yes" ]; then logmsg "Restarting framework . . ." if [ "${INIT_TYPE}" = "sysv" ]; then - cd / && env -u LD_LIBRARY_PATH /etc/init.d/framework start + cd / && /etc/init.d/framework start else - cd / && env -u LD_LIBRARY_PATH start lab126_gui + cd / && start lab126_gui fi fi diff --git a/platform/kobo/disable-wifi.sh b/platform/kobo/disable-wifi.sh index 30a23d087..795027542 100755 --- a/platform/kobo/disable-wifi.sh +++ b/platform/kobo/disable-wifi.sh @@ -6,7 +6,7 @@ cp -a "/etc/resolv.conf" "/tmp/resolv.ko" old_hash="$(md5sum "/etc/resolv.conf" | cut -f1 -d' ')" if [ -x "/sbin/dhcpcd" ]; then - env -u LD_LIBRARY_PATH dhcpcd -d -k "${INTERFACE}" + dhcpcd -d -k "${INTERFACE}" killall -q -TERM udhcpc default.script else killall -q -TERM udhcpc default.script dhcpcd diff --git a/platform/kobo/enable-wifi.sh b/platform/kobo/enable-wifi.sh index 4b854b859..516335084 100755 --- a/platform/kobo/enable-wifi.sh +++ b/platform/kobo/enable-wifi.sh @@ -136,5 +136,4 @@ ifconfig "${INTERFACE}" up [ "${WIFI_MODULE}" = "dhd" ] && wlarm_le -i "${INTERFACE}" up pkill -0 wpa_supplicant || - env -u LD_LIBRARY_PATH \ - wpa_supplicant -D "${WPA_SUPPLICANT_DRIVER}" -s -i "${INTERFACE}" -c /etc/wpa_supplicant/wpa_supplicant.conf -C /var/run/wpa_supplicant -B + wpa_supplicant -D "${WPA_SUPPLICANT_DRIVER}" -s -i "${INTERFACE}" -c /etc/wpa_supplicant/wpa_supplicant.conf -C /var/run/wpa_supplicant -B diff --git a/platform/kobo/koreader.sh b/platform/kobo/koreader.sh index 662f4cd61..8d36e7b03 100755 --- a/platform/kobo/koreader.sh +++ b/platform/kobo/koreader.sh @@ -144,9 +144,6 @@ if [ -n "${fail}" ] && [ "${fail}" -eq 0 ]; then exec ./koreader.sh "${@}" fi -# load our own shared libraries if possible -export LD_LIBRARY_PATH="${KOREADER_DIR}/libs:${LD_LIBRARY_PATH}" - # export trained OCR data directory export TESSDATA_PREFIX="data" diff --git a/platform/kobo/nickel.sh b/platform/kobo/nickel.sh index 0950e00b6..d30fcf51e 100755 --- a/platform/kobo/nickel.sh +++ b/platform/kobo/nickel.sh @@ -31,7 +31,7 @@ if grep -q "^${WIFI_MODULE}" "/proc/modules"; then cp -a "/etc/resolv.conf" "/tmp/resolv.ko" old_hash="$(md5sum "/etc/resolv.conf" | cut -f1 -d' ')" if [ -x "/sbin/dhcpcd" ]; then - env -u LD_LIBRARY_PATH dhcpcd -d -k "${INTERFACE}" + dhcpcd -d -k "${INTERFACE}" killall -q -TERM udhcpc default.script else killall -q -TERM udhcpc default.script dhcpcd diff --git a/platform/kobo/obtain-ip.sh b/platform/kobo/obtain-ip.sh index 4b9e3e456..e2a161407 100755 --- a/platform/kobo/obtain-ip.sh +++ b/platform/kobo/obtain-ip.sh @@ -18,7 +18,7 @@ done # NOTE: Prefer dhcpcd over udhcpc if available. That's what Nickel uses, # and udhcpc appears to trip some insanely wonky corner cases on current FW (#6421) if [ -x "/sbin/dhcpcd" ]; then - env -u LD_LIBRARY_PATH dhcpcd -d -t 30 -w "${INTERFACE}" + dhcpcd -d -t 30 -w "${INTERFACE}" else - env -u LD_LIBRARY_PATH udhcpc -S -i "${INTERFACE}" -s /etc/udhcpc.d/default.script -b -q + udhcpc -S -i "${INTERFACE}" -s /etc/udhcpc.d/default.script -b -q fi diff --git a/platform/kobo/release-ip.sh b/platform/kobo/release-ip.sh index 72caa0456..bcc61a298 100755 --- a/platform/kobo/release-ip.sh +++ b/platform/kobo/release-ip.sh @@ -6,7 +6,7 @@ cp -a "/etc/resolv.conf" "/tmp/resolv.ko" old_hash="$(md5sum "/etc/resolv.conf" | cut -f1 -d' ')" if [ -x "/sbin/dhcpcd" ]; then - env -u LD_LIBRARY_PATH dhcpcd -d -k "${INTERFACE}" + dhcpcd -d -k "${INTERFACE}" killall -q -TERM udhcpc default.script else killall -q -TERM udhcpc default.script dhcpcd diff --git a/platform/pocketbook/koreader.app b/platform/pocketbook/koreader.app index 2f3ad9b8d..93ed2da26 100755 --- a/platform/pocketbook/koreader.app +++ b/platform/pocketbook/koreader.app @@ -4,6 +4,10 @@ export LC_ALL="en_US.UTF-8" # working directory of koreader KOREADER_DIR="/mnt/ext1/applications/koreader" +# load our own shared libraries if possible, solely because we don't control InkView, and we'd rather not it have load duplicate system libs... +# (We handle this via DT_RPATH for our own stuff). +export LD_LIBRARY_PATH="${KOREADER_DIR}/libs${LD_LIBRARY_PATH+:}${LD_LIBRARY_PATH}" + # file through which we communicate instanced opens export KO_PATH_OPEN_BOOK="/tmp/.koreader.open" @@ -74,9 +78,6 @@ ko_update_check() { # we're always starting from our working directory cd ${KOREADER_DIR} || exit -# export load library path for some old firmware -export LD_LIBRARY_PATH="${KOREADER_DIR}/libs:${LD_LIBRARY_PATH}" - # export trained OCR data directory export TESSDATA_PREFIX="data" diff --git a/platform/remarkable/koreader.sh b/platform/remarkable/koreader.sh index d950cfa67..e4fa7f4dd 100755 --- a/platform/remarkable/koreader.sh +++ b/platform/remarkable/koreader.sh @@ -72,9 +72,6 @@ if [ -n "${fail}" ] && [ "${fail}" -eq 0 ]; then exec ./koreader.sh "${@}" fi -# load our own shared libraries if possible -export LD_LIBRARY_PATH="${KOREADER_DIR}/libs:${LD_LIBRARY_PATH}" - # export trained OCR data directory export TESSDATA_PREFIX="data" diff --git a/platform/ubuntu-touch/koreader.sh b/platform/ubuntu-touch/koreader.sh index 0c5ea6ca4..34c1f6949 100755 --- a/platform/ubuntu-touch/koreader.sh +++ b/platform/ubuntu-touch/koreader.sh @@ -7,9 +7,6 @@ KOREADER_DIR="${0%/*}" # we're always starting from our working directory cd "${KOREADER_DIR}" || exit -# export load library path for some old firmware -export LD_LIBRARY_PATH="${KOREADER_DIR}/libs":"${LD_LIBRARY_PATH}" - # export trained OCR data directory export TESSDATA_PREFIX="data"