fix deadlock on install (#2667)

* fix deadlock on install

* improve pruning script

* bump tokio
This commit is contained in:
Aiden McClelland
2024-07-11 14:55:13 -06:00
committed by GitHub
parent 87322744d4
commit 6def083b4f
20 changed files with 273 additions and 154 deletions

View File

@@ -65,7 +65,7 @@ impl<G: GenericMountGuard> BackupMountGuard<G> {
unencrypted_metadata.wrapped_key.as_ref(),
) {
let wrapped_key =
base32::decode(base32::Alphabet::RFC4648 { padding: true }, wrapped_key)
base32::decode(base32::Alphabet::Rfc4648 { padding: true }, wrapped_key)
.ok_or_else(|| {
Error::new(
eyre!("failed to decode wrapped key"),
@@ -76,7 +76,7 @@ impl<G: GenericMountGuard> BackupMountGuard<G> {
String::from_utf8(decrypt_slice(wrapped_key, password))?
} else {
base32::encode(
base32::Alphabet::RFC4648 { padding: false },
base32::Alphabet::Rfc4648 { padding: false },
&rand::random::<[u8; 32]>()[..],
)
};
@@ -93,7 +93,7 @@ impl<G: GenericMountGuard> BackupMountGuard<G> {
}
if unencrypted_metadata.wrapped_key.is_none() {
unencrypted_metadata.wrapped_key = Some(base32::encode(
base32::Alphabet::RFC4648 { padding: true },
base32::Alphabet::Rfc4648 { padding: true },
&encrypt_slice(&enc_key, password),
));
}
@@ -141,7 +141,7 @@ impl<G: GenericMountGuard> BackupMountGuard<G> {
.with_kind(crate::ErrorKind::PasswordHashGeneration)?,
);
self.unencrypted_metadata.wrapped_key = Some(base32::encode(
base32::Alphabet::RFC4648 { padding: false },
base32::Alphabet::Rfc4648 { padding: false },
&encrypt_slice(&self.enc_key, new_password),
));
Ok(())

View File

@@ -111,7 +111,7 @@ impl GenericMountGuard for MountGuard {
async fn tmp_mountpoint(source: &impl FileSystem) -> Result<PathBuf, Error> {
Ok(Path::new(TMP_MOUNTPOINT).join(base32::encode(
base32::Alphabet::RFC4648 { padding: false },
base32::Alphabet::Rfc4648 { padding: false },
&source.source_hash().await?[0..20],
)))
}