# HG changeset patch # User Raphaël Gomès # Date 2023-02-27 14:18:50 # Node ID 53ca3e3bc0136209812255761c35a6091b692407 # Parent e30b9e43be7e9e01c3816a10365be4390db4dd50 rhg: fix race when a fixup file is deleted on disk See next changeset for the other race in the same kind of logic and why there are two different places. diff --git a/rust/rhg/src/commands/status.rs b/rust/rhg/src/commands/status.rs --- a/rust/rhg/src/commands/status.rs +++ b/rust/rhg/src/commands/status.rs @@ -436,9 +436,21 @@ pub fn run(invocation: &crate::CliInvoca // `unsure_is_clean` which was needed before reading // contents. Here we access metadata again after reading // content, in case it changed in the meantime. - let fs_metadata = repo + let metadata_res = repo .working_directory_vfs() - .symlink_metadata(&fs_path)?; + .symlink_metadata(&fs_path); + let fs_metadata = match metadata_res { + Ok(meta) => meta, + Err(err) => match err { + HgError::IoError { .. } => { + // The file has probably been deleted. In any + // case, it was in the dirstate before, so + // let's ignore the error. + continue; + } + _ => return Err(err.into()), + }, + }; if let Some(mtime) = TruncatedTimestamp::for_reliable_mtime_of( &fs_metadata, diff --git a/tests/test-dirstate-status-write-race.t b/tests/test-dirstate-status-write-race.t --- a/tests/test-dirstate-status-write-race.t +++ b/tests/test-dirstate-status-write-race.t @@ -382,7 +382,6 @@ The status process should return a consi ? p ? q $ cat $TESTTMP/status-race-lock.log - abort: when reading $TESTTMP/race-with-update/dir2/k: $ENOENT$ (known-bad-output rhg !) final cleanup @@ -479,7 +478,6 @@ The status process should return a consi ? p ? q $ cat $TESTTMP/status-race-lock.log - abort: when reading $TESTTMP/race-with-remove/dir2/l: $ENOENT$ (known-bad-output rhg !) final cleanup