[Updated] D12202: status: fix hg status race against file deletion

aalekseyev (Arseniy Alekseyev) phabricator at mercurial-scm.org
Fri Feb 18 10:55:28 UTC 2022


Closed by commit rHGdcec16e799dd: status: fix hg status race against file deletion (authored by aalekseyev).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D12202?vs=32261&id=32266

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D12202/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D12202

AFFECTED FILES
  rust/hg-core/src/dirstate_tree/status.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/dirstate_tree/status.rs b/rust/hg-core/src/dirstate_tree/status.rs
--- a/rust/hg-core/src/dirstate_tree/status.rs
+++ b/rust/hg-core/src/dirstate_tree/status.rs
@@ -713,7 +713,17 @@
         let mut results = Vec::new();
         for entry in path.read_dir()? {
             let entry = entry?;
-            let metadata = entry.metadata()?;
+            let metadata = match entry.metadata() {
+                Ok(v) => v,
+                Err(e) => {
+                    // race with file deletion?
+                    if e.kind() == std::io::ErrorKind::NotFound {
+                        continue;
+                    } else {
+                        return Err(e);
+                    }
+                }
+            };
             let name = get_bytes_from_os_string(entry.file_name());
             // FIXME don't do this when cached
             if name == b".hg" {



To: aalekseyev, #hg-reviewers, Alphare
Cc: Alphare, mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20220218/d4abcb84/attachment-0002.html>


More information about the Mercurial-patches mailing list