fix: retain uncertain fixture owners and reject source overlap
This commit is contained in:
1 parent
b97556dcc1
commit
ca84bce24f
3 files changed
+74
-2
No files matched your search
@@ -112,7 +112,15 @@ class NativeManagementAdapter:
|
||||
if not acquired:
|
||||
raise RuntimeError('Another CBB operation owns the management mutex.')
|
||||
job = prepare_owned_fixture_add(job, evidence)
|
||||
return self._launch_worker(job, evidence)
|
||||
from .library_lock import LibraryLock
|
||||
owner_safe = False
|
||||
# Nest only after preparation proves an existing caller lease.
|
||||
# An unsafe result/exception retains that same owner even when
|
||||
# the caller used a plain LibraryLock without a callback.
|
||||
with LibraryLock(job['library'], safe_to_release=lambda: owner_safe):
|
||||
result = self._launch_worker(job, evidence)
|
||||
owner_safe = result.get('safe_to_continue') is True
|
||||
return result
|
||||
finally:
|
||||
if acquired: win32event.ReleaseMutex(mutex)
|
||||
mutex.Close()
|
||||
@@ -250,7 +258,8 @@ def prepare_owned_fixture_add(job, root):
|
||||
lease_handle = int(owner['handle'])
|
||||
source = Path(job['source']).resolve(strict=True)
|
||||
if (source.parent.is_relative_to(root.resolve()) or root.resolve().is_relative_to(source.parent)
|
||||
or source.parent.is_relative_to(library.parent.resolve())):
|
||||
or source.parent.is_relative_to(library.parent.resolve())
|
||||
or library.parent.resolve().is_relative_to(source.parent)):
|
||||
raise ValueError('Research source must be independent of fixture and transaction evidence.')
|
||||
source_manifest = copy_verified(source.parent, root/'source')
|
||||
backup = copy_verified(library.parent, root/'library-before',
|
||||
|
||||
Reference in new issue
Block a user