diff options
author | Rémi Lapeyre <remi.lapeyre@lenstra.fr> | 2020-03-30 00:01:24 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-06-11 18:47:43 +0200 |
commit | a60b7ec4dcdce874009b93fd79d53eefa39ad338 (patch) | |
tree | 2be85eda3d1fbfe5faaf31b375dcf7294d1e3caf | |
parent | d4db24bfc34b29a3a894ebea2caa3ed6724207d7 (diff) |
Ignore non-printable characters in calls to tree
In MacOS Catalina, pass fails on accents with 'sed: RE error: illegal
byte sequence'.
-rwxr-xr-x | src/password-store.sh | 4 | ||||
-rwxr-xr-x | tests/t0020-show-tests.sh | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/password-store.sh b/src/password-store.sh index e99b455..194b5ed 100755 --- a/src/password-store.sh +++ b/src/password-store.sh @@ -402,7 +402,7 @@ cmd_show() { else echo "${path%\/}" fi - tree -C -l --noreport "$PREFIX/$path" | tail -n +2 | sed -E 's/\.gpg(\x1B\[[0-9]+m)?( ->|$)/\1\2/g' # remove .gpg at end of line, but keep colors + tree -N -C -l --noreport "$PREFIX/$path" | tail -n +2 | sed -E 's/\.gpg(\x1B\[[0-9]+m)?( ->|$)/\1\2/g' # remove .gpg at end of line, but keep colors elif [[ -z $path ]]; then die "Error: password store is empty. Try \"pass init\"." else @@ -414,7 +414,7 @@ cmd_find() { [[ $# -eq 0 ]] && die "Usage: $PROGRAM $COMMAND pass-names..." IFS="," eval 'echo "Search Terms: $*"' local terms="*$(printf '%s*|*' "$@")" - tree -C -l --noreport -P "${terms%|*}" --prune --matchdirs --ignore-case "$PREFIX" | tail -n +2 | sed -E 's/\.gpg(\x1B\[[0-9]+m)?( ->|$)/\1\2/g' + tree -N -C -l --noreport -P "${terms%|*}" --prune --matchdirs --ignore-case "$PREFIX" | tail -n +2 | sed -E 's/\.gpg(\x1B\[[0-9]+m)?( ->|$)/\1\2/g' } cmd_grep() { diff --git a/tests/t0020-show-tests.sh b/tests/t0020-show-tests.sh index a4b782f..81b87b4 100755 --- a/tests/t0020-show-tests.sh +++ b/tests/t0020-show-tests.sh @@ -15,6 +15,11 @@ test_expect_success 'Test "show" command with spaces' ' [[ $("$PASS" show "I am a cred with lots of spaces") == "BLAH!!" ]] ' +test_expect_success 'Test "show" command with unicode' ' + "$PASS" generate 🏠 && + "$PASS" show | grep -q '🏠' +' + test_expect_success 'Test "show" of nonexistant password' ' test_must_fail "$PASS" show cred2 ' |