[PATCH] tools/gpgsm-gencert.sh
NIIBE Yutaka
gniibe at fsij.org
Wed Apr 25 04:33:03 CEST 2012
Hello,
gpgsm-gencert.sh doesn't work well with dash (version 0.5.7).
When URI_ADDRESSES is null, it exits without emitting
CSR. It exits after the line:
[ -n "$URI_ADDRESSES" ] && echo "$URI_ADDRESSES"
When I change it to:
[ -n "$URI_ADDRESSES" ] && echo "$URI_ADDRESSES" || exit 0
it works.
It seems that dash's subshell with -e behavior is different.
Following is a patch to fix this problem, by not using subshell.
This works with both of dash and bash.
----------------------
diff --git a/tools/gpgsm-gencert.sh b/tools/gpgsm-gencert.sh
index b209c8e..28c3792 100755
--- a/tools/gpgsm-gencert.sh
+++ b/tools/gpgsm-gencert.sh
@@ -171,7 +171,7 @@ file_parameter=$(mktemp "/tmp/gpgsm.XXXXXX")
outfile=$(mktemp "/tmp/gpgsm.XXXXXX")
-(
+{
cat <<EOF
Key-Type: $KEY_TYPE
Key-Length: $KEY_LENGTH
@@ -182,7 +182,7 @@ EOF
[ -n "$EMAIL_ADDRESSES" ] && echo "$EMAIL_ADDRESSES"
[ -n "$DNS_ADDRESSES" ] && echo "$DNS_ADDRESSES"
[ -n "$URI_ADDRESSES" ] && echo "$URI_ADDRESSES"
-) > "$file_parameter"
+} > "$file_parameter"
echo 'Parameters for certificate request to create:' >&2
More information about the Gnupg-devel
mailing list