From 1d6d65af13dc3880c7b30f1373f59fd7ae67a5f7 Mon Sep 17 00:00:00 2001 From: Bob Example Date: Fri, 10 Jul 2015 21:16:12 -0400 Subject: [PATCH] resolution to past zeal with double quotes. --- bin/_blackbox_common.sh | 2 +- bin/blackbox_register_new_file | 4 ++-- tools/confidence_test.sh | 29 +++++++++++++++-------------- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/bin/_blackbox_common.sh b/bin/_blackbox_common.sh index 6263eaf..23ea5ed 100755 --- a/bin/_blackbox_common.sh +++ b/bin/_blackbox_common.sh @@ -211,7 +211,7 @@ function encrypt_file() { encrypted="$2" echo "========== Encrypting: $unencrypted" >&2 - $GPG --use-agent --yes --trust-model=always --encrypt -o "$encrypted" "$(awk '{ print "-r" $1 }' < "$BB_ADMINS")" "$unencrypted" >&2 + $GPG --use-agent --yes --trust-model=always --encrypt -o "$encrypted" $(awk '{ print "-r" $1 }' < "$BB_ADMINS") "$unencrypted" >&2 echo '========== Encrypting: DONE' >&2 } diff --git a/bin/blackbox_register_new_file b/bin/blackbox_register_new_file index 7a59138..61fbf54 100755 --- a/bin/blackbox_register_new_file +++ b/bin/blackbox_register_new_file @@ -20,8 +20,8 @@ function register_new_file() { exit 1 fi - echo ========== PLAINFILE "$unencrypted_file" - echo ========== ENCRYPTED "$encrypted_file" + echo "========== PLAINFILE $unencrypted_file" + echo "========== ENCRYPTED $encrypted_file" fail_if_not_exists "$unencrypted_file" "Please specify an existing file." fail_if_exists "$encrypted_file" "Will not overwrite." diff --git a/tools/confidence_test.sh b/tools/confidence_test.sh index cd3d7f4..23e6591 100755 --- a/tools/confidence_test.sh +++ b/tools/confidence_test.sh @@ -44,7 +44,7 @@ function assert_file_missing() { function assert_file_exists() { if [[ ! -e "$1" ]]; then echo "ASSERT FAILED: ${1} should exist." - echo "PWD="$(/bin/pwd -P) + echo "PWD=$(/bin/pwd -P)" #echo "LS START" #ls -la #echo "LS END" @@ -55,7 +55,8 @@ function assert_file_md5hash() { local file="$1" local wanted="$2" assert_file_exists "$file" - local found=$(md5sum_file "$file") + local found + found=$(md5sum_file "$file") if [[ "$wanted" != "$found" ]]; then echo "ASSERT FAILED: $file hash wanted=$wanted found=$found" exit 1 @@ -69,10 +70,10 @@ function assert_file_group() { case $(uname -s) in Darwin|FreeBSD ) - found=$(stat -f '%Sg' $file) + found=$(stat -f '%Sg' "$file") ;; Linux ) - found=$(stat -c '%G' $file) + found=$(stat -c '%G' "$file") ;; CYGWIN* ) echo "ASSERT_FILE_GROUP: Running on Cygwin. Not being tested." @@ -95,9 +96,9 @@ function assert_line_not_exists() { assert_file_exists "$file" if grep -F -x -s -q >/dev/null "$target" "$file" ; then echo "ASSERT FAILED: line '$target' should not exist in file $file" - echo ==== file contents: START "$file" + echo "==== file contents: START $file" cat "$file" - echo ==== file contents: END "$file" + echo "==== file contents: END $file" exit 1 fi } @@ -107,9 +108,9 @@ function assert_line_exists() { assert_file_exists "$file" if ! grep -F -x -s -q >/dev/null "$target" "$file" ; then echo "ASSERT FAILED: line '$target' should exist in file $file" - echo ==== file contents: START "$file" + echo "==== file contents: START $file" cat "$file" - echo ==== file contents: END "$file" + echo "==== file contents: END $file" exit 1 fi } @@ -120,17 +121,17 @@ cd "$test_repository" make_self_deleting_tempdir fake_alice_home make_self_deleting_tempdir fake_bob_home export GNUPGHOME="$fake_alice_home" -eval $(gpg-agent --homedir "$fake_alice_home" --daemon) +eval "$(gpg-agent --homedir "$fake_alice_home" --daemon)" GPG_AGENT_INFO_ALICE="$GPG_AGENT_INFO" export GNUPGHOME="$fake_bob_home" -eval $(gpg-agent --homedir "$fake_bob_home" --daemon) +eval "$(gpg-agent --homedir "$fake_bob_home" --daemon)" GPG_AGENT_INFO_BOB="$GPG_AGENT_INFO" function become_alice() { export GNUPGHOME="$fake_alice_home" export GPG_AGENT_INFO="$GPG_AGENT_INFO_ALICE" - echo BECOMING ALICE: GNUPGHOME=$GNUPGHOME AGENT=$GPG_AGENT_INFO + echo BECOMING ALICE: GNUPGHOME="$GNUPGHOME AGENT=$GPG_AGENT_INFO" git config --global user.name "Alice Example" git config --global user.email alice@example.com } @@ -282,7 +283,7 @@ assert_file_exists secret.txt.gpg assert_file_md5hash secret.txt "d3e6bbdfc76fae7fd0a921f3408db1d1" ) -PHASE 'Bob appears.' +PHASE 'appears.' become_bob PHASE 'Bob makes sure he has all new keys.' @@ -293,7 +294,7 @@ gpg --import keyrings/live/pubring.gpg # This users's default group: DEFAULT_GID_NAME=$(id -gn) # Pick a group that is not the default group: -TEST_GID_NUM=$(id -G | fmt -1 | tail -n +2 | grep -xv $(id -u) | head -n 1) +TEST_GID_NUM=$(id -G | fmt -1 | tail -n +2 | grep -xv "$(id -u)" | head -n 1) TEST_GID_NAME=$(python -c 'import grp; print grp.getgrgid('"$TEST_GID_NUM"').gr_name') echo "DEFAULT_GID_NAME=$DEFAULT_GID_NAME" echo "TEST_GID_NUM=$TEST_GID_NUM" @@ -307,7 +308,7 @@ assert_file_md5hash secret.txt "08a3fa763a05c018a38e9924363b97e7" assert_file_group secret.txt "$DEFAULT_GID_NAME" PHASE 'Bob postdeploys... with a GID.' -blackbox_postdeploy $TEST_GID_NUM +blackbox_postdeploy "$TEST_GID_NUM" assert_file_exists secret.txt assert_file_exists secret.txt.gpg assert_file_md5hash secret.txt "08a3fa763a05c018a38e9924363b97e7"