From 0948e813044afa3956148779c44d27f9dd92e820 Mon Sep 17 00:00:00 2001 From: Richard T Bonhomme Date: Thu, 5 May 2022 12:37:35 +0100 Subject: [PATCH] Detect and filter erroneous duplicate "found 'vars' files" When 'vars' is in the same directory as 'easyrsa' and they are both in the current working directory, easyrsa would falsely warn about "conflicting" 'vars' files. Filter out this false error by checking if '$prog_dir' is './' Signed-off-by: Richard T Bonhomme --- easyrsa3/easyrsa | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/easyrsa3/easyrsa b/easyrsa3/easyrsa index 158387c..d4df426 100755 --- a/easyrsa3/easyrsa +++ b/easyrsa3/easyrsa @@ -2561,6 +2561,7 @@ vars_setup() { #prog_file2="$(which -- "$prog_file" 2>/dev/null)" && prog_file="$prog_file2" #prog_file2="$(readlink -f "$prog_file" 2>/dev/null)" && prog_file="$prog_file2" prog_dir="${prog_file%/*}" + if [ "$prog_dir" = . ]; then prog_in_pwd=1; else unset -v prog_in_pwd; fi # Program dir vars - This location is least wanted. prog_vars="${prog_dir}/vars" @@ -2611,6 +2612,11 @@ vars_setup() { # program location: { [ -e "$prog_vars" ] && e_prog_vars=1; } || unset -v prog_vars + # Filter duplicates + if [ "$prog_vars" ] && [ "$pwd_vars" ] && [ "$prog_in_pwd" ]; then + unset -v prog_vars e_prog_vars + fi + # Allow only one vars to be found, No exceptions! found_vars="$((e_pki_vars + e_easy_vars + e_pwd_vars + e_prog_vars))"