From 3594a3124e30172c92eb21666fab325d40f8327b Mon Sep 17 00:00:00 2001 From: Travis Paul Date: Fri, 30 Nov 2018 13:24:56 +0800 Subject: [PATCH] Bash from pkgsrc has a flag to disable importing functions unless explicitly enabled. The patch was created in response to ShellShock and still remains: https://www.mail-archive.com/smartos-discuss@lists.smartos.org/msg01247.html https://github.com/NetBSD/pkgsrc/blob/trunk/shells/bash/patches/patch-shell.c --- bin/blackbox_shred_all_files | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bin/blackbox_shred_all_files b/bin/blackbox_shred_all_files index 668c657..87ac1f6 100755 --- a/bin/blackbox_shred_all_files +++ b/bin/blackbox_shred_all_files @@ -39,7 +39,12 @@ export -f exported_internal_shred_file DEREFERENCED_BIN_DIR="${0%/*}" MAX_PARALLEL_SHRED=10 +bash_args= +if bash --help | grep import-functions >/dev/null 2>/dev/null; then + bash_args=--import-functions +fi + export IFS= -tr '\n' '\0' <"$BB_FILES" | xargs -0 -I{} -n 1 -P $MAX_PARALLEL_SHRED bash -c "exported_internal_shred_file $DEREFERENCED_BIN_DIR \"{}\"" $DEREFERENCED_BIN_DIR/fake +tr '\n' '\0' <"$BB_FILES" | xargs -0 -I{} -n 1 -P $MAX_PARALLEL_SHRED bash $bash_args -c "exported_internal_shred_file $DEREFERENCED_BIN_DIR \"{}\"" $DEREFERENCED_BIN_DIR/fake echo '========== DONE.'