From 90dc874d566a3f55102aff21d883abbec3d5bf52 Mon Sep 17 00:00:00 2001 From: LE Manh Cuong Date: Fri, 6 Mar 2015 11:33:39 +0700 Subject: [PATCH] Register new file now work with space in filename. --- bin/blackbox_register_new_file | 12 +++++------- tools/confidence_test.sh | 7 +++++++ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/bin/blackbox_register_new_file b/bin/blackbox_register_new_file index f41fb94..1c7e70b 100755 --- a/bin/blackbox_register_new_file +++ b/bin/blackbox_register_new_file @@ -43,11 +43,9 @@ VCSCMD=$(which_vcs) if "$SECRETSEXPOSED" ; then vcs_remove "$unencrypted_file" vcs_add "$encrypted_file" - COMMIT_FILES="$BB_FILES $encrypted_file $unencrypted_file" + COMMIT_FILES=("$BB_FILES" "$encrypted_file" "$unencrypted_file") else - COMMIT_FILES="$BB_FILES $encrypted_file" - # FIXME(tal): This should be an array so that filenames with - # spaces aren't a problem. + COMMIT_FILES=("$BB_FILES" "$encrypted_file") fi # TODO(tlim): This should be moved to _blackbox_common.sh in a @@ -57,14 +55,14 @@ if [[ $VCS_TYPE = 'git' ]]; then ignored_file="$(echo "$unencrypted_file" | sed 's/\([\*\?]\)/\\\1/g' | sed 's/^\([!#]\)/\\\1/')" if ! grep -Fsx >/dev/null "$ignored_file" "$IGNOREFILE"; then echo "$ignored_file" >>"$IGNOREFILE" - COMMIT_FILES="$COMMIT_FILES $IGNOREFILE" + COMMIT_FILES+=("$IGNOREFILE") fi vcs_add "$IGNOREFILE" fi echo 'NOTE: "already tracked!" messages are safe to ignore.' -vcs_add "$BB_FILES" $encrypted_file -vcs_commit "registered in blackbox: ${unencrypted_file}" $COMMIT_FILES +vcs_add "$BB_FILES" "$encrypted_file" +vcs_commit "registered in blackbox: ${unencrypted_file}" "${COMMIT_FILES[@]}" echo "========== UPDATING VCS: DONE" echo "Local repo updated. Please push when ready." echo " $VCSCMD push" diff --git a/tools/confidence_test.sh b/tools/confidence_test.sh index 4b20e2f..7117103 100755 --- a/tools/confidence_test.sh +++ b/tools/confidence_test.sh @@ -335,6 +335,13 @@ assert_file_missing 'stars*bars?.txt' assert_file_exists 'stars*bars?.txt'.gpg assert_line_exists 'stars\*bars\?.txt' .gitignore +PHASE 'Bob enrolls stars bars.txt' +echo A very commented file >'stars bars.txt' +blackbox_register_new_file 'stars bars.txt' +assert_file_missing 'stars bars.txt' +assert_file_exists 'stars bars.txt'.gpg +assert_line_exists 'stars bars.txt' .gitignore + # TODO(tlim): Add test to make sure that now alice can NOT decrypt. #