This is an archive of the discontinued Mercurial Phabricator instance.

persistent-nodemap: properly ignore non-existent `.nd` data file
ClosedPublic

Authored by SimonSapin on Dec 7 2020, 12:53 PM.

Details

Summary

This code was meant to handle the case of a nodemap docket file
pointing to a nodemap data file that doesn’t exist (anymore),
but most likely caused an UnboundLocalError exception instead
when data was used on the next line without being defined.

This case is theoretically possible with a race condition
between two hg processes, but is hard to reproduce or test:

  • Process A reads a docket file and finds a UID in it that points to a given data file name.
  • Process B decides that this same data file needs compacting. It writes a new one with a different UID, overwrites the docket file, then removes the old data file.
  • Only then process A tries to a open a file that doesn’t exist anymore.

Diff Detail

Repository
rHG Mercurial
Branch
default
Lint
No Linters Available
Unit
No Unit Test Coverage

Event Timeline

SimonSapin created this revision.Dec 7 2020, 12:53 PM
Alphare accepted this revision.Dec 7 2020, 2:43 PM
pulkit accepted this revision.Dec 10 2020, 3:46 AM
This revision is now accepted and ready to land.Dec 10 2020, 3:46 AM