@@ -23,7 +23,6 @@ function pgbuild() {
23
23
declare -a configure_args=(--enable-debug --enable-cassert --enable-tap-tests --enable-dtrace)
24
24
local CPP=" /usr/lib64/ccache/gcc -E"
25
25
local CC=" /usr/lib64/ccache/gcc"
26
- local LD=" /usr/bin/ld"
27
26
local CPPFLAGS=
28
27
local CFLAGS=" -Og -ggdb3"
29
28
case " ${variant:- } " in
@@ -35,7 +34,38 @@ function pgbuild() {
35
34
" CLANG" )
36
35
CPP=" /usr/lib64/ccache/clang -E"
37
36
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"
39
69
;;
40
70
* )
41
71
echo " unrecognised build variant $variant "
@@ -76,7 +106,7 @@ function pgbuild() {
76
106
cd $builddir
77
107
set -e
78
108
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[@]} "
80
110
echo " configured, making"
81
111
make $SILENT clean
82
112
make $SILENT -j4
@@ -202,10 +232,21 @@ function bdr3build() {
202
232
alias pgl3make=pgl3build
203
233
alias bdr3make=bdr3build
204
234
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
209
250
210
251
# Launch a psql against a running pg_regress instance
211
252
# without messing around reading the logs.
@@ -253,7 +294,7 @@ export PROMPT_COMMAND PROMPT_DIRTRIM
253
294
254
295
255
296
function pg() {
256
- local ver=${1:- 2q1136 }
297
+ local ver=${1:- 2q1137 }
257
298
local subdir
258
299
case " ${ver} " in
259
300
2[qQ]10)
@@ -268,7 +309,13 @@ function pg() {
268
309
2[qQ]12)
269
310
subdir=2QREL_12_STABLE_dev
270
311
;;
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)
272
319
subdir=REL_${ver} _STABLE
273
320
;;
274
321
9* 4)
@@ -303,4 +350,7 @@ function bdr() {
303
350
pushd ~ /projects/2Q/bdr/bdr-${subdir}
304
351
}
305
352
353
+ PAGER=" less -x 4"
354
+ export PAGER
355
+
306
356
# vim: ts=4 sw=4 et ai
0 commit comments