Skip to content

Commit a22ccc4

Browse files
author
Craig Ringer
committed
Aliases update
1 parent 380c7ec commit a22ccc4

File tree

1 file changed

+59
-9
lines changed

1 file changed

+59
-9
lines changed

misc/bashenv/bash_aliases

+59-9
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ function pgbuild() {
2323
declare -a configure_args=(--enable-debug --enable-cassert --enable-tap-tests --enable-dtrace)
2424
local CPP="/usr/lib64/ccache/gcc -E"
2525
local CC="/usr/lib64/ccache/gcc"
26-
local LD="/usr/bin/ld"
2726
local CPPFLAGS=
2827
local CFLAGS="-Og -ggdb3"
2928
case "${variant:-}" in
@@ -35,7 +34,38 @@ function pgbuild() {
3534
"CLANG")
3635
CPP="/usr/lib64/ccache/clang -E"
3736
CC="/usr/lib64/ccache/clang"
38-
LD="/usr/bin/lld"
37+
CFLAGS="${CFLAGS} -fuse-ld=lld -fdebug-macro -O1"
38+
# The non-asan clang build is also fully valgrind-enabled, it doesn't
39+
# do much unless run under valgrind.
40+
CFLAGS="${CFLAGS} -DUSE_VALGRIND -fno-omit-frame-pointer"
41+
;;
42+
"CLANG_ASAN")
43+
# this is not included in pgbuildall for now
44+
CPP="/usr/lib64/ccache/clang -E"
45+
CC="/usr/lib64/ccache/clang"
46+
CFLAGS="${CFLAGS} -fuse-ld=lld -fdebug-macro -O1"
47+
# TODO: sanitizer coverage per https://clang.llvm.org/docs/SanitizerCoverage.html
48+
# TODO why do we have to set explicit rpath?
49+
# Pg adds CFLAGS to LDFLAGS already
50+
CFLAGS="${CFLAGS} -fno-omit-frame-pointer -fsanitize=address -fsanitize-address-use-after-scope -fsanitize-address-use-odr-indicator -frtlib-add-rpath -shared-libasan -fno-common -rpath /usr/lib64/clang/10.0.0/lib/linux -rpath /usr/lib64/clang/10.0.0/lib"
51+
# TODO runtime ASAN_OPTIONS=strict_string_checks=1:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1
52+
# via __asan_default_options per https://github.com/google/sanitizers/wiki/AddressSanitizerFlags
53+
ASAN_OPTIONS="detect_leaks=0:strict_string_checks=1:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1:replace_str=1:replace_intrin=1:print_stats=1:atexit=1"
54+
export ASAN_OPTIONS
55+
# We could also experiment with memory sanitizing but it's not allowed at the same time as
56+
# address sanitizing.
57+
#CFLAGS="${CFLAGS} -fsanitize=memory -fsanitize-memory-track-origins"
58+
# and flow-control protection
59+
CFLAGS="${CFLAGS} -fcf-protection"
60+
# maybe also experiment with heap profiling if palloc doesn't mask it too much
61+
#CFLAGS="${CFLAGS} -fmemory-profile"
62+
# TODO: experiment with -flto. Right now it doesn't work because we use 'ar' to create
63+
# libpgcommon.a and then we break when trying to link it.
64+
# Enable stack guards on the asan build too
65+
CFLAGS="${CFLAGS} -fstack-protector-strong"
66+
;;
67+
"CLOBBER")
68+
CFLAGS="${CFLAGS} -DCLOBBER_CACHE_ALWAYS"
3969
;;
4070
*)
4171
echo "unrecognised build variant $variant"
@@ -76,7 +106,7 @@ function pgbuild() {
76106
cd $builddir
77107
set -e
78108
echo "configuring for $dest"
79-
CPPFLAGS="${CPPFLAGS}" CFLAGS="${CFLAGS}" CPP="${CPP}" CC="${CC}" LD="${LD}" $configurepath $CONFQUIET --cache-file=config.cache${variant:=-${variant}} --prefix="$dest" "${configure_args[@]}"
109+
CPPFLAGS="${CPPFLAGS}" CFLAGS="${CFLAGS}" CPP="${CPP}" CC="${CC}" $configurepath $CONFQUIET --cache-file=config.cache${variant:=-${variant}} --prefix="$dest" "${configure_args[@]}"
80110
echo "configured, making"
81111
make $SILENT clean
82112
make $SILENT -j4
@@ -202,10 +232,21 @@ function bdr3build() {
202232
alias pgl3make=pgl3build
203233
alias bdr3make=bdr3build
204234

205-
if [ -e ~/.local/TPA_2Q_SUBSCRIPTION_TOKEN ]; then
206-
read -r TPA_2Q_SUBSCRIPTION_TOKEN < ~/.local/TPA_2Q_SUBSCRIPTION_TOKEN
207-
export TPA_2Q_SUBSCRIPTION_TOKEN
208-
fi
235+
# Use libsecret for my secret env vars now
236+
#
237+
# Store or update with:
238+
#
239+
# echo -n 'xxsecretxx' | secret-tool store --label 'Environment variable TPA_2Q_SUBSCRIPTION_TOKEN' ENV_VAR TPA_2Q_SUBSCRIPTION_TOKEN
240+
#
241+
242+
declare -a secret_env_vars=(TPA_2Q_SUBSCRIPTION_TOKEN SECONDQ_GITLAB_READ_ONLY_TOKEN)
243+
244+
for secret_env_var in "${secret_env_vars[@]}"; do
245+
read -r $secret_env_var < <(secret-tool lookup ENV_VAR $secret_env_var)
246+
done
247+
248+
TPA_GIT_CREDENTIALS=${SECONDQ_GITLAB_READ_ONLY_TOKEN:-"unable to read SECONDQ_GITLAB_READ_ONLY_TOKEN"}
249+
export TPA_GIT_CREDENTIALS
209250

210251
# Launch a psql against a running pg_regress instance
211252
# without messing around reading the logs.
@@ -253,7 +294,7 @@ export PROMPT_COMMAND PROMPT_DIRTRIM
253294

254295

255296
function pg() {
256-
local ver=${1:-2q1136}
297+
local ver=${1:-2q1137}
257298
local subdir
258299
case "${ver}" in
259300
2[qQ]10)
@@ -268,7 +309,13 @@ function pg() {
268309
2[qQ]12)
269310
subdir=2QREL_12_STABLE_dev
270311
;;
271-
10|11|12)
312+
2[qQ]13)
313+
subdir=2QREL_13_STABLE_dev
314+
;;
315+
2[qQ]14)
316+
subdir=2QREL_14_STABLE_dev
317+
;;
318+
10|11|12|13|14)
272319
subdir=REL_${ver}_STABLE
273320
;;
274321
9*4)
@@ -303,4 +350,7 @@ function bdr() {
303350
pushd ~/projects/2Q/bdr/bdr-${subdir}
304351
}
305352

353+
PAGER="less -x 4"
354+
export PAGER
355+
306356
# vim: ts=4 sw=4 et ai

0 commit comments

Comments
 (0)