fix gpg subkey support typo

initremote, enableremote: Really support gpg subkeys suffixed with an
exclamation mark, which forces gpg to use a specific subkey. (Previous try
had a bug.)

This commit was sponsored by Jake Vosloo on Patreon.
This commit is contained in:
Joey Hess 2017-12-05 13:58:53 -04:00
parent 4e38c4f57f
commit ed701667aa
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
3 changed files with 21 additions and 1 deletions

View file

@ -11,6 +11,9 @@ git-annex (6.20171125) UNRELEASED; urgency=medium
not media files. not media files.
* Removed no longer needed dependency on yesod-default. * Removed no longer needed dependency on yesod-default.
* Allow exporttree remotes to be marked as dead. * Allow exporttree remotes to be marked as dead.
* initremote, enableremote: Really support gpg subkeys suffixed with an
exclamation mark, which forces gpg to use a specific subkey.
(Previous try had a bug.)
-- Joey Hess <id@joeyh.name> Tue, 28 Nov 2017 13:48:44 -0400 -- Joey Hess <id@joeyh.name> Tue, 28 Nov 2017 13:48:44 -0400

View file

@ -171,7 +171,7 @@ findPubKeys cmd for
{- "subkey!" tells gpg to force use of a specific subkey -} {- "subkey!" tells gpg to force use of a specific subkey -}
isForcedSubKey :: String -> Bool isForcedSubKey :: String -> Bool
isForcedSubKey s = "!" `isSuffixOf` s && all isHexDigit (drop 1 s) isForcedSubKey s = "!" `isSuffixOf` s && all isHexDigit (drop 1 (reverse s))
type UserId = String type UserId = String

View file

@ -28,3 +28,20 @@ OS X 10.10.5
### Have you had any luck using git-annex before? (Sometimes we get tired of reading bug reports all day and a lil' positive end note does wonders) ### Have you had any luck using git-annex before? (Sometimes we get tired of reading bug reports all day and a lil' positive end note does wonders)
I love git annex. Thank you for your work on it. I love git annex. Thank you for your work on it.
> Yeah, so I had that working before but then I tightened the
> code to determine what is a forced subkey and broke it.
>
> [Fixed now; use a "!" at the _end_ to force subkey use:
joey@darkstar:~/tmp/a>git annex initremote testing type=directory directory=../d encryption=hybrid keyid='A4FEC0B5F031BA70!'
initremote testing (encryption setup) gpg: A4FEC0B5F031BA70!: skipped: Unusable public key
gpg: [stdin]: encryption failed: Unusable public key
> It failed to use that subkey because it is a sign-only key,
> and git-annex needs to encrypt, but that certainly shows I got
> git-annex to use the subkey..
>
> I made an encrypt-only subkey, and git-annex is able to use it,
> and it fully works as far as I can tell.
>
> [[done]] --[[Joey]]