Mailing List Archive

[PATCH] tools/gpgsm-gencert.sh
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




_______________________________________________
Gnupg-devel mailing list
Gnupg-devel@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-devel
Re: [PATCH] tools/gpgsm-gencert.sh [ In reply to ]
On 2012-04-25 at 11:33 +0900, NIIBE Yutaka wrote:
> gpgsm-gencert.sh doesn't work well with dash (version 0.5.7).

Sorry, my bug report is incomplete.

I noticed that gpgsm-gencert.sh is deprecated, so it would
be irrelevant now.

I found that it doesn't work well with bash version 4.1.5 either.

In a different environment, I ran this script to create CSR and it
went well last year. In the previous mail, I thought it's because of
shell difference, but this is wrong.

> Following is a patch to fix this problem, by not using subshell.
>
> This works with both of dash and bash.

Anyway, I believe that this fix is correct.
--



_______________________________________________
Gnupg-devel mailing list
Gnupg-devel@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-devel
Re: [PATCH] tools/gpgsm-gencert.sh [ In reply to ]
On Wed, 25 Apr 2012 05:21, gniibe@fsij.org said:

> I noticed that gpgsm-gencert.sh is deprecated, so it would
> be irrelevant now.

Right. For the Windows port I had to write in C (with better error
reporting): gpgsm --gen-key

>> This works with both of dash and bash.
>
> Anyway, I believe that this fix is correct.

{ } does not work with old shells.


Salam-Shalom,

Werner

--
Die Gedanken sind frei. Ausnahmen regelt ein Bundesgesetz.


_______________________________________________
Gnupg-devel mailing list
Gnupg-devel@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-devel