Fix mhsign for gpg2: Expiry date format
authormarkus schnalke <meillo@marmaro.de>
Mon, 17 Apr 2017 17:35:21 +0000 (19:35 +0200)
committermarkus schnalke <meillo@marmaro.de>
Mon, 17 Apr 2017 17:35:21 +0000 (19:35 +0200)
Gnupg2 uses --fixed-list-mode by default for --with-colons.
Gnupg1 needs this option explicitly to generate the same output
format (timestamps) for expiry dates.

Thanks to Jan Unterbrink for reporting the bug.

uip/mhsign.sh

index 9d6c747..39a3f69 100755 (executable)
@@ -22,10 +22,11 @@ if [ -z "$userid" ] ; then
        userid="`mhparam pgpkey`"
 fi
 if [ -z "$userid" ] ; then
-       userid="`gpg --list-secret-keys --with-colons 2>/dev/null |
+       userid="`gpg --list-secret-keys --with-colons --fixed-list-mode \
+                               2>/dev/null |
                        grep '^sec' | sort -t: -k3,3nr -k 6,6nr |
                        awk -F: '
-                               $7=="" || $7 > "'"\`date +%Y-%m-%d\`"'" {
+                               $7=="" || $7 > "'"\`date +%s\`"'" {
                                        print $5; exit;
                                }
                        '`"