Skip to content

Commit ae5fd5e

Browse files
committed
exclude_from_backups_and_indexing can't fail
Ignore errors creating the registry directory
1 parent c45ab7d commit ae5fd5e

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

crates/cargo-util/src/paths.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -661,11 +661,12 @@ pub fn create_dir_all_excluded_from_backups_atomic(p: impl AsRef<Path>) -> Resul
661661
}
662662

663663
/// Mark an existing directory as excluded from backups and indexing.
664-
pub fn exclude_from_backups_and_indexing(p: impl AsRef<Path>) -> Result<()> {
664+
///
665+
/// Errors in marking it are ignored.
666+
pub fn exclude_from_backups_and_indexing(p: impl AsRef<Path>) {
665667
let path = p.as_ref();
666668
exclude_from_backups(path);
667669
exclude_from_content_indexing(path);
668-
Ok(())
669670
}
670671

671672
/// Marks the directory as excluded from archives/backups.

src/cargo/sources/git/source.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ impl<'cfg> Source for GitSource<'cfg> {
135135
// This does not use `create_dir_all_excluded_from_backups_atomic` for
136136
// the same reason: we want to exclude it even if the directory already
137137
// exists.
138-
exclude_from_backups_and_indexing(&git_path)?;
138+
exclude_from_backups_and_indexing(&git_path);
139139

140140
let db_path = git_path.join("db").join(&self.ident);
141141

src/cargo/sources/registry/mod.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -822,9 +822,12 @@ impl<'cfg> Source for RegistrySource<'cfg> {
822822
// This does not use `create_dir_all_excluded_from_backups_atomic` for
823823
// the same reason: we want to exclude it even if the directory already
824824
// exists.
825+
//
826+
// IO errors in creating and marking it are ignored, e.g. in case we're on a
827+
// read-only filesystem.
825828
let registry_base = self.config.registry_base_path();
826-
registry_base.create_dir()?;
827-
exclude_from_backups_and_indexing(&registry_base.into_path_unlocked())?;
829+
let _ = registry_base.create_dir()?;
830+
exclude_from_backups_and_indexing(&registry_base.into_path_unlocked());
828831

829832
self.ops.block_until_ready()
830833
}

0 commit comments

Comments
 (0)