[Patch] Fix issue for pass generate 0
mauli
mauli at chaostreff.at
Thu Feb 8 23:11:55 CET 2018
Hi,
in the IRC someone was having issues with 100% CPU use when generating a
password with length 0, I found that read -r -n 0 just keeps on going.
I cannot find this behavior documented if NCHARS is set to 0.
---
diff --git a/src/password-store.sh b/src/password-store.sh
index e3e5659..2afb51b 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -505,7 +505,7 @@ cmd_generate() {
local path="$1"
local length="${2:-$GENERATED_LENGTH}"
check_sneaky_paths "$path"
- [[ ! $length =~ ^[0-9]+$ ]] && die "Error: pass-length \"$length\"
must be a number."
+ [[ ! $length =~ ^[1-9][0-9]+$ ]] && die "Error: pass-length
\"$length\" must be a number greater 0."
mkdir -p -v "$PREFIX/$(dirname -- "$path")"
set_gpg_recipients "$(dirname -- "$path")"
local passfile="$PREFIX/$path.gpg"
More information about the Password-Store
mailing list