ClickHouse/tests/queries/0_stateless/02280_dynamic_linker_env.sh
Azat Khuzhin c32e151bc2 Add a test for dynamic linker variables
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-04-18 23:34:13 +03:00

19 lines
716 B
Bash
Executable File

#!/usr/bin/env bash
CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
. "$CUR_DIR"/../shell_config.sh
static=$($CLICKHOUSE_LOCAL -q "SELECT value IN ('ON', '1') FROM system.build_options WHERE name = 'STATIC'")
clickhouse-local -q 'select 1'
if [ "$static" -eq 1 ]; then
# "grep -c" will also gives "1"
LD_LIBRARY_PATH=/ clickhouse-local -q 'select 1' |& grep -x -F -c 'Environment variable LD_LIBRARY_PATH is set to /. It can compromise security.'
else
# works because it does not uses main.cpp entrypoint
# (due to shared build is always splitted, and non-splitted will have lots of ODR issues)
LD_LIBRARY_PATH=/ clickhouse-local -q 'select 1'
fi