fix implicit embedcreds regression
Fix bug that made creds not be stored in git when a special remote was initialized with gpg encryption, but without an explicit embedcreds=yes. (Yet nother regression introduced in version 7.20200202.7. 5th so far.)
This commit is contained in:
parent
a1d4c8e4ec
commit
ad81feb053
7 changed files with 32 additions and 21 deletions
|
@ -104,11 +104,11 @@ commonFieldParsers =
|
||||||
, optionalStringParser sameasUUIDField HiddenField
|
, optionalStringParser sameasUUIDField HiddenField
|
||||||
, optionalStringParser typeField
|
, optionalStringParser typeField
|
||||||
(FieldDesc "type of special remote")
|
(FieldDesc "type of special remote")
|
||||||
, trueFalseParser autoEnableField False
|
, trueFalseParser autoEnableField (Just False)
|
||||||
(FieldDesc "automatically enable special remote")
|
(FieldDesc "automatically enable special remote")
|
||||||
, yesNoParser exportTreeField False
|
, yesNoParser exportTreeField (Just False)
|
||||||
(FieldDesc "export trees of files to this remote")
|
(FieldDesc "export trees of files to this remote")
|
||||||
, yesNoParser importTreeField False
|
, yesNoParser importTreeField (Just False)
|
||||||
(FieldDesc "import trees of files from this remote")
|
(FieldDesc "import trees of files from this remote")
|
||||||
, optionalStringParser preferreddirField
|
, optionalStringParser preferreddirField
|
||||||
(FieldDesc "directory whose content is preferred")
|
(FieldDesc "directory whose content is preferred")
|
||||||
|
@ -232,16 +232,16 @@ optionalStringParser f fielddesc = RemoteConfigFieldParser
|
||||||
p (Just v) _c = Right (Just (RemoteConfigValue (fromProposedAccepted v)))
|
p (Just v) _c = Right (Just (RemoteConfigValue (fromProposedAccepted v)))
|
||||||
p Nothing _c = Right Nothing
|
p Nothing _c = Right Nothing
|
||||||
|
|
||||||
yesNoParser :: RemoteConfigField -> Bool -> FieldDesc -> RemoteConfigFieldParser
|
yesNoParser :: RemoteConfigField -> Maybe Bool -> FieldDesc -> RemoteConfigFieldParser
|
||||||
yesNoParser f v fd = genParser yesno f v fd
|
yesNoParser f mdef fd = genParser yesno f mdef fd
|
||||||
(Just (ValueDesc "yes or no"))
|
(Just (ValueDesc "yes or no"))
|
||||||
where
|
where
|
||||||
yesno "yes" = Just True
|
yesno "yes" = Just True
|
||||||
yesno "no" = Just False
|
yesno "no" = Just False
|
||||||
yesno _ = Nothing
|
yesno _ = Nothing
|
||||||
|
|
||||||
trueFalseParser :: RemoteConfigField -> Bool -> FieldDesc -> RemoteConfigFieldParser
|
trueFalseParser :: RemoteConfigField -> Maybe Bool -> FieldDesc -> RemoteConfigFieldParser
|
||||||
trueFalseParser f v fd = genParser trueFalseParser' f v fd
|
trueFalseParser f mdef fd = genParser trueFalseParser' f mdef fd
|
||||||
(Just (ValueDesc "true or false"))
|
(Just (ValueDesc "true or false"))
|
||||||
|
|
||||||
-- Not using Git.Config.isTrueFalse because git supports
|
-- Not using Git.Config.isTrueFalse because git supports
|
||||||
|
@ -256,22 +256,22 @@ genParser
|
||||||
:: Typeable t
|
:: Typeable t
|
||||||
=> (String -> Maybe t)
|
=> (String -> Maybe t)
|
||||||
-> RemoteConfigField
|
-> RemoteConfigField
|
||||||
-> t -- ^ fallback value
|
-> Maybe t -- ^ default if not configured
|
||||||
-> FieldDesc
|
-> FieldDesc
|
||||||
-> Maybe ValueDesc
|
-> Maybe ValueDesc
|
||||||
-> RemoteConfigFieldParser
|
-> RemoteConfigFieldParser
|
||||||
genParser parse f fallback fielddesc valuedesc = RemoteConfigFieldParser
|
genParser parse f mdef fielddesc valuedesc = RemoteConfigFieldParser
|
||||||
{ parserForField = f
|
{ parserForField = f
|
||||||
, valueParser = p
|
, valueParser = p
|
||||||
, fieldDesc = fielddesc
|
, fieldDesc = fielddesc
|
||||||
, valueDesc = valuedesc
|
, valueDesc = valuedesc
|
||||||
}
|
}
|
||||||
where
|
where
|
||||||
p Nothing _c = Right (Just (RemoteConfigValue fallback))
|
p Nothing _c = Right (fmap RemoteConfigValue mdef)
|
||||||
p (Just v) _c = case parse (fromProposedAccepted v) of
|
p (Just v) _c = case parse (fromProposedAccepted v) of
|
||||||
Just b -> Right (Just (RemoteConfigValue b))
|
Just b -> Right (Just (RemoteConfigValue b))
|
||||||
Nothing -> case v of
|
Nothing -> case v of
|
||||||
Accepted _ -> Right (Just (RemoteConfigValue fallback))
|
Accepted _ -> Right (fmap RemoteConfigValue mdef)
|
||||||
Proposed _ -> Left $
|
Proposed _ -> Left $
|
||||||
"Bad value for " ++ fromProposedAccepted f ++
|
"Bad value for " ++ fromProposedAccepted f ++
|
||||||
case valuedesc of
|
case valuedesc of
|
||||||
|
|
|
@ -50,6 +50,10 @@ git-annex (8.20200523) UNRELEASED; urgency=medium
|
||||||
branch. git-annex-remote-googledrive one was special remote affected by
|
branch. git-annex-remote-googledrive one was special remote affected by
|
||||||
this bug.
|
this bug.
|
||||||
(Regression introduced in version 7.20200202.7)
|
(Regression introduced in version 7.20200202.7)
|
||||||
|
* Fix bug that made creds not be stored in git when a special remote
|
||||||
|
was initialized with gpg encryption, but without an explicit
|
||||||
|
embedcreds=yes.
|
||||||
|
(Regression introduced in version 7.20200202.7)
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Tue, 26 May 2020 10:20:52 -0400
|
-- Joey Hess <id@joeyh.name> Tue, 26 May 2020 10:20:52 -0400
|
||||||
|
|
||||||
|
|
|
@ -835,7 +835,7 @@ baseRemoteConfigParser = RemoteConfigParser
|
||||||
{ remoteConfigFieldParsers =
|
{ remoteConfigFieldParsers =
|
||||||
[ optionalStringParser externaltypeField
|
[ optionalStringParser externaltypeField
|
||||||
(FieldDesc "type of external special remote to use")
|
(FieldDesc "type of external special remote to use")
|
||||||
, trueFalseParser readonlyField False
|
, trueFalseParser readonlyField (Just False)
|
||||||
(FieldDesc "enable readonly mode")
|
(FieldDesc "enable readonly mode")
|
||||||
]
|
]
|
||||||
, remoteConfigRestPassthrough = Just
|
, remoteConfigRestPassthrough = Just
|
||||||
|
|
|
@ -59,7 +59,7 @@ encryptionConfigParsers =
|
||||||
, optionalStringParser cipherField HiddenField
|
, optionalStringParser cipherField HiddenField
|
||||||
, optionalStringParser cipherkeysField HiddenField
|
, optionalStringParser cipherkeysField HiddenField
|
||||||
, optionalStringParser pubkeysField HiddenField
|
, optionalStringParser pubkeysField HiddenField
|
||||||
, yesNoParser embedCredsField False
|
, yesNoParser embedCredsField Nothing
|
||||||
(FieldDesc "embed credentials into git repository")
|
(FieldDesc "embed credentials into git repository")
|
||||||
, macFieldParser
|
, macFieldParser
|
||||||
, optionalStringParser (Accepted "keyid")
|
, optionalStringParser (Accepted "keyid")
|
||||||
|
|
|
@ -128,8 +128,8 @@ gen r u rc gc rs = do
|
||||||
-- Things used by genRsyncOpts
|
-- Things used by genRsyncOpts
|
||||||
rsyncRemoteConfigs :: [RemoteConfigFieldParser]
|
rsyncRemoteConfigs :: [RemoteConfigFieldParser]
|
||||||
rsyncRemoteConfigs =
|
rsyncRemoteConfigs =
|
||||||
[ yesNoParser shellEscapeField True
|
[ yesNoParser shellEscapeField (Just True)
|
||||||
(FieldDesc "avoid usual shell escaping (not recommended)")
|
(FieldDesc "set to no to avoid usual shell escaping (not recommended)")
|
||||||
]
|
]
|
||||||
|
|
||||||
genRsyncOpts :: ParsedRemoteConfig -> RemoteGitConfig -> Annex [CommandParam] -> RsyncUrl -> RsyncOpts
|
genRsyncOpts :: ParsedRemoteConfig -> RemoteGitConfig -> Annex [CommandParam] -> RsyncUrl -> RsyncOpts
|
||||||
|
|
|
@ -87,10 +87,10 @@ remote = specialRemoteType $ RemoteType
|
||||||
(FieldDesc "storage class, eg STANDARD or STANDARD_IA or ONEZONE_IA")
|
(FieldDesc "storage class, eg STANDARD or STANDARD_IA or ONEZONE_IA")
|
||||||
, optionalStringParser fileprefixField
|
, optionalStringParser fileprefixField
|
||||||
(FieldDesc "prefix to add to filenames in the bucket")
|
(FieldDesc "prefix to add to filenames in the bucket")
|
||||||
, yesNoParser versioningField False
|
, yesNoParser versioningField (Just False)
|
||||||
(FieldDesc "enable versioning of bucket content")
|
(FieldDesc "enable versioning of bucket content")
|
||||||
, yesNoParser publicField False
|
, yesNoParser publicField (Just False)
|
||||||
(FieldDesc "allow public read access to the buckey")
|
(FieldDesc "allow public read access to the bucket")
|
||||||
, optionalStringParser publicurlField
|
, optionalStringParser publicurlField
|
||||||
(FieldDesc "url that can be used by public to download files")
|
(FieldDesc "url that can be used by public to download files")
|
||||||
, optionalStringParser protocolField
|
, optionalStringParser protocolField
|
||||||
|
@ -157,7 +157,7 @@ newtype SignatureVersion = SignatureVersion Int
|
||||||
|
|
||||||
signatureVersionParser :: RemoteConfigField -> FieldDesc -> RemoteConfigFieldParser
|
signatureVersionParser :: RemoteConfigField -> FieldDesc -> RemoteConfigFieldParser
|
||||||
signatureVersionParser f fd =
|
signatureVersionParser f fd =
|
||||||
genParser go f defver fd
|
genParser go f (Just defver) fd
|
||||||
(Just (ValueDesc "v2 or v4"))
|
(Just (ValueDesc "v2 or v4"))
|
||||||
where
|
where
|
||||||
go "v2" = Just (SignatureVersion 2)
|
go "v2" = Just (SignatureVersion 2)
|
||||||
|
|
|
@ -8,15 +8,22 @@ could break existing workflows in a surprising way, and even maybe result
|
||||||
in data loss if the user was relying on git-annex embedding the creds and
|
in data loss if the user was relying on git-annex embedding the creds and
|
||||||
didn't otherwise have a way to get them.
|
didn't otherwise have a way to get them.
|
||||||
|
|
||||||
The cause is that there's a externalConfigChanges that SETCONFIG
|
It's (yet another) regression caused by 7.20200202.7's sweeping changes to
|
||||||
|
remote configuration.
|
||||||
|
|
||||||
|
Problem is, there's a externalConfigChanges that SETCONFIG
|
||||||
updates, but SETCREDS does not, instead it swap in a new externalConfig.
|
updates, but SETCREDS does not, instead it swap in a new externalConfig.
|
||||||
But that externalConfig is not examined when extracting the config changes
|
But that externalConfig is not examined when extracting the config changes
|
||||||
to store in remote.log, because the types don't match up any longer.
|
to store in remote.log, because the types don't match up any longer.
|
||||||
|
|
||||||
So, SETCREDS needs to also update externalConfigChanges.
|
So, SETCREDS needs to also update externalConfigChanges.
|
||||||
|
|
||||||
Related reversion: When SETCONFIG is used, followed by GETCONFIG
|
Related regression: When SETCONFIG is used, followed by GETCONFIG
|
||||||
of the same value, it does not return the value. This doesn't affect
|
of the same value, it does not return the value. This doesn't affect
|
||||||
SETCONFIG at init time followed by GETCONFIG later, so it's unlikely to
|
SETCONFIG at init time followed by GETCONFIG later, so it's unlikely to
|
||||||
affect anything, but it's still wrong, and so I've fixed it.
|
affect anything, but it's still wrong, and so I've fixed it.
|
||||||
|
|
||||||
|
And they don't stop coming, yet another regression: Not setting embedcreds
|
||||||
|
was treated as embedcreds=no, because the bool parser defaulted to False.
|
||||||
|
So the implicit embedcreds when using encryption=pubkey broke.
|
||||||
"""]]
|
"""]]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue