fix(release): validate SQLite archive member format

This commit is contained in:
cesnimda
2026-11-18 13:18:13 +01:00
parent 2fb10f7b4e
commit 10abd22f1a
15 changed files with 1009 additions and 16 deletions
+4 -8
View File
@@ -453,19 +453,15 @@ verify_volume_backup() {
# Prove this is the DATABASE volume, not merely a non-empty tar. This is what
# catches an archive taken from the wrong volume, or from a freshly created
# empty one.
# Listed in the same container that wrote it, not with the host's tar: GNU tar
# reads a leading "C:/" as an rsh host and fails outright when this script runs
# from Git Bash. Docker is already required to have produced the archive.
# Python is already required by deployment validation. Its tar reader handles
# Windows paths and checks regular-file/header bytes without extracting files.
local has_db=1
if docker run --rm \
-v "$(dirname "$target")":/backup:ro \
-e ARCHIVE_NAME="$(basename "$target")" \
alpine:3 sh -c 'tar tzf "/backup/$ARCHIVE_NAME" > /tmp/backup-members && grep -Eq "(^|/)jobtracker[.]db$" /tmp/backup-members' >/dev/null 2>&1; then
if python3 scripts/validate-sqlite-backup.py "$target"; then
has_db=0
fi
if [ "$has_db" -ne 0 ]; then
echo "Archive ${target} contains no jobtracker.db — it is not a SQLite data backup. Aborting deploy."
echo "Archive ${target} has no valid regular SQLite database member. Aborting deploy."
rm -f "$target"
return 1
fi
@@ -0,0 +1,14 @@
# RR-17: SQLite archive database member validation
Baseline2fb10f7b, isolated codex/recovery-archive-validation. The old name-only tar listing accepted symlinks/hardlinks/FIFO/device entries, empty or unrelated bytes named jobtracker.db, and database paths outside the archive root. Ten negative subtests freshly reproduced successful verification and continuation to the mocked next deployment gate.
The existing deployment verifier now calls a small Python standard-library streaming tar reader. Python3 is already required by the mandatory ingress validator. It checks each matching database basename for a safe relative path, regular-file type and the16-byte SQLite signature; it reads through the archive without extracting members. Root, dot-prefixed and nested supported database names remain accepted. Real SQLite test fixtures are created with stdlib sqlite3. No package, database/schema, production configuration or persistent data is changed by these tests.
- Final29/29 backup methods PASSED,0skips; includes earlier26 and three new methods/ten negative subtests. Bash syntax/whitespace PASSED. Existing dump/parser, upload, retention and permission checks remain. Real local gzip and Python tar/SQLite fixture creation were exercised; no Docker, actual backup, recovery or deployment.
- Initial red fixture had14 Windows cleanup errors because a context-managed sqlite connection had not been closed. After explicitly closing it, corrected red had10 failures and0errors; these are the valid application defect reproductions. Original draft errors are retained and are not product defects.
- First whole-suite green exposed three inherited permission-fixture failures: those tests mocked the old Docker validator over arbitrary bytes. Recovery permission fixtures now use a genuine gzip/tar with a format header and the real Python validator, preserving byte-equality/no-removal/next-gate assertions. Final29 rerun adds a Docker trap in member tests to prove no container validation occurs. Intermediate results overlap29.
- Exact native logs/gzip plus final source hashes: [receipts](SOURCE_RECEIPTS.json). Original production baseline is bound. Red test fixture bytes were not frozen at execution; don't claim an immutable full red-test snapshot. Test helper changes after red and all intermediate failures are documented.
This checks **format**, not SQLite integrity or usefulness: a signature-only regular file satisfies this bounded predicate. It does not validate arbitrary other archive members, select an authoritative database among multiple compatible paths, prove WAL consistency, restore records, verify keys/tombstones/off-host encryption, qualify RPO/RTO or replace recovery rehearsal. MariaDB's dump path is unchanged. Actual Linux/container/host deployment remains NOT RUN. No release/security approval is granted.
Rollback restores verify_volume_backup and removes the helper/associated fixture changes on this isolated branch. No data rollback is required. Original release worktree and A3 application branch remain untouched by this package.
@@ -0,0 +1,59 @@
{
"baseline": "2fb10f7b4e1968e40158773aff68b9136b6366b6",
"sources": [
{
"file": "deploy/deploy.sh",
"sha256Lf": "f0b23f3a94ce62df037995e24514806e0dfe390d8bab83cc98f0006c004b7bf3"
},
{
"file": "scripts/test-deploy-backup.py",
"sha256Lf": "b5d78c98cb3fac20e6a5a01de45ffaed6c039445f04e9af4b6e4fdca5a5cd763"
},
{
"file": "scripts/validate-sqlite-backup.py",
"sha256Lf": "b643ca6997b735014634efc64e47175e7e94a8d2e26efce58a15c30af45dadbb"
}
],
"nativeArtifacts": [
{
"file": "archive-red.txt",
"rawSha256": "b6b74f520908b9dbdab1795394e6b060418fa81d6960bdcc95e57618b6761f7e",
"gzipSha256": "da9cdc67fd3788f5fee37116cc3f28f172e6af41f64018f1801071df49a14d47",
"canonicalSha256": "8fbe782bcb534264b8ec67c78b4d4f13b93bb799313267f76985f3398c1d149a"
},
{
"file": "archive-red-corrected.txt",
"rawSha256": "f609f90035c2ad3a6ad892cc1889b899c64d40e38b5d76b4e0d2b5f0f4fd5296",
"gzipSha256": "8b88d44088d8c2414b9568d669ab7aca03c81397ede832aa70e24c6dbe7e445e",
"canonicalSha256": "e975026e58575724c8de19997a6754023da8b4f390772b4a3c0eedd060eb2682"
},
{
"file": "archive-green.txt",
"rawSha256": "099a5507befb5a39b24925a56974b35ae022926012297c8bc51b2ee8c9f8ecac",
"gzipSha256": "82a57389cdcd7753ceea35b88ca03bc4db9b592a46cca65ae319e1f296e05bde",
"canonicalSha256": "cd869864c07943aae4c87105d9b352dce9fedacc41b1a64516f27bce08696807"
},
{
"file": "archive-green-final.txt",
"rawSha256": "fe75805217c87fe7e31601ac226015c754a385fab40e81bb32569b88ea69bdc7",
"gzipSha256": "ffa1a1f6e34c4acff97476abd315fd8d5cd81046436ca3b781fed7f3fd2da335",
"canonicalSha256": "55ac699218412a437daaeb3b0d6de51cbcb21809a2b9d1a81fa95b08e3160a39"
},
{
"file": "archive-qualified.txt",
"rawSha256": "be26b9a73900d322f4f6b417ad9e7d1800e5d71b42e5809b37b51adf3a383252",
"gzipSha256": "aad2d2295d57a6d3ac8b7f8d89b816f8f959ce14a78bd9fed573504ec2fb9d8a",
"canonicalSha256": "5f397b90c78a3fecde2eed7a3a41d8549cf70944d4ea0e0d0e04ec14630a4d2a"
}
],
"checks": {
"backupMethods": 29,
"backupExitCode": 0,
"bashSyntaxExitCode": 0
},
"limits": [
"SQLite header/type/path format only; no integrity check/restore/container/recovery acceptance",
"Red test fixture bytes were not frozen at execution; original production baseline and native failure logs retained."
],
"baselineDeployBlob": "77a5781ff22b2b7fc11cef3d3969b0f47bb9dded"
}
@@ -0,0 +1,11 @@
python : .............................
At line:1 char:124
+ ... =$env:TEMP; python scripts/test-deploy-backup.py *> ".tmp/archive-gre ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (.............................:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
----------------------------------------------------------------------
Ran 29 tests in 15.186s
OK
@@ -0,0 +1,62 @@
python : ...........FFF...............
At line:1 char:124
+ ... =$env:TEMP; python scripts/test-deploy-backup.py *> ".tmp/archive-gre ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (...........FFF...............:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
======================================================================
FAIL: test_both_permission_failures_block_verification_and_next_gate
(__main__.BackupPermissionTests.test_both_permission_failures_block_verification_and_next_gate) (kind='recovery')
----------------------------------------------------------------------
Traceback (most recent call last):
File "E:\Storage\Projects\Active\temp
docs\jobjakt-local-build\recovery-archive-validation\scripts\test-deploy-backup.py", line 358, in
test_both_permission_failures_block_verification_and_next_gate
result = self.permission_gate(kind, 1, 23)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\Storage\Projects\Active\temp
docs\jobjakt-local-build\recovery-archive-validation\scripts\test-deploy-backup.py", line 334, in permission_gate
self.assertNotIn('UNEXPECTED REMOVAL', result.stdout)
AssertionError: 'UNEXPECTED REMOVAL' unexpectedly found in 'Archive E:/Storage/Projects/Active/temp
docs/jobjakt-local-build/recovery-archive-validation/.tmp/backup-permission-wekbjtnf/synthetic-backup.gz has no valid
regular SQLite database member. Aborting deploy.\nUNEXPECTED REMOVAL\n'
======================================================================
FAIL: test_fallback_permission_success_preserves_verification
(__main__.BackupPermissionTests.test_fallback_permission_success_preserves_verification) (kind='recovery')
----------------------------------------------------------------------
Traceback (most recent call last):
File "E:\Storage\Projects\Active\temp
docs\jobjakt-local-build\recovery-archive-validation\scripts\test-deploy-backup.py", line 349, in
test_fallback_permission_success_preserves_verification
result = self.permission_gate(kind, 1, 0)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\Storage\Projects\Active\temp
docs\jobjakt-local-build\recovery-archive-validation\scripts\test-deploy-backup.py", line 334, in permission_gate
self.assertNotIn('UNEXPECTED REMOVAL', result.stdout)
AssertionError: 'UNEXPECTED REMOVAL' unexpectedly found in 'Archive E:/Storage/Projects/Active/temp
docs/jobjakt-local-build/recovery-archive-validation/.tmp/backup-permission-56pyov4f/synthetic-backup.gz has no valid
regular SQLite database member. Aborting deploy.\nUNEXPECTED REMOVAL\n'
======================================================================
FAIL: test_host_permission_success_does_not_need_fallback
(__main__.BackupPermissionTests.test_host_permission_success_does_not_need_fallback) (kind='recovery')
----------------------------------------------------------------------
Traceback (most recent call last):
File "E:\Storage\Projects\Active\temp
docs\jobjakt-local-build\recovery-archive-validation\scripts\test-deploy-backup.py", line 340, in
test_host_permission_success_does_not_need_fallback
result = self.permission_gate(kind, 0, 23)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\Storage\Projects\Active\temp
docs\jobjakt-local-build\recovery-archive-validation\scripts\test-deploy-backup.py", line 334, in permission_gate
self.assertNotIn('UNEXPECTED REMOVAL', result.stdout)
AssertionError: 'UNEXPECTED REMOVAL' unexpectedly found in 'Archive E:/Storage/Projects/Active/temp
docs/jobjakt-local-build/recovery-archive-validation/.tmp/backup-permission-fwk2luv_/synthetic-backup.gz has no valid
regular SQLite database member. Aborting deploy.\nUNEXPECTED REMOVAL\n'
----------------------------------------------------------------------
Ran 29 tests in 17.076s
FAILED (failures=3)
@@ -0,0 +1,11 @@
python : .............................
At line:1 char:124
+ ... =$env:TEMP; python scripts/test-deploy-backup.py *> ".tmp/archive-qua ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (.............................:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
----------------------------------------------------------------------
Ran 29 tests in 13.104s
OK
@@ -0,0 +1,144 @@
python : FFF.FFFF.FFF.
At line:1 char:124
+ ... =$env:TEMP; python scripts/test-deploy-backup.py BackupDatabaseMember ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (FFF.FFFF.FFF.:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
======================================================================
FAIL: test_empty_or_non_sqlite_database_bytes_block_the_next_gate
(__main__.BackupDatabaseMemberTests.test_empty_or_non_sqlite_database_bytes_block_the_next_gate) (contents=b'')
----------------------------------------------------------------------
Traceback (most recent call last):
File "E:\Storage\Projects\Active\temp
docs\jobjakt-local-build\recovery-archive-validation\scripts\test-deploy-backup.py", line 499, in
test_empty_or_non_sqlite_database_bytes_block_the_next_gate
self.assertNotEqual(0, result.returncode, result.stdout + result.stderr)
AssertionError: 0 == 0 : FORMAT VERIFIED
NEXT DEPLOY GATE WOULD START
======================================================================
FAIL: test_empty_or_non_sqlite_database_bytes_block_the_next_gate
(__main__.BackupDatabaseMemberTests.test_empty_or_non_sqlite_database_bytes_block_the_next_gate) (contents=b'unrelated
application bytes')
----------------------------------------------------------------------
Traceback (most recent call last):
File "E:\Storage\Projects\Active\temp
docs\jobjakt-local-build\recovery-archive-validation\scripts\test-deploy-backup.py", line 499, in
test_empty_or_non_sqlite_database_bytes_block_the_next_gate
self.assertNotEqual(0, result.returncode, result.stdout + result.stderr)
AssertionError: 0 == 0 : FORMAT VERIFIED
NEXT DEPLOY GATE WOULD START
======================================================================
FAIL: test_empty_or_non_sqlite_database_bytes_block_the_next_gate
(__main__.BackupDatabaseMemberTests.test_empty_or_non_sqlite_database_bytes_block_the_next_gate) (contents=b'SQLite
format 3X\x00')
----------------------------------------------------------------------
Traceback (most recent call last):
File "E:\Storage\Projects\Active\temp
docs\jobjakt-local-build\recovery-archive-validation\scripts\test-deploy-backup.py", line 499, in
test_empty_or_non_sqlite_database_bytes_block_the_next_gate
self.assertNotEqual(0, result.returncode, result.stdout + result.stderr)
AssertionError: 0 == 0 : FORMAT VERIFIED
NEXT DEPLOY GATE WOULD START
======================================================================
FAIL: test_links_and_special_members_do_not_substitute_for_database_bytes
(__main__.BackupDatabaseMemberTests.test_links_and_special_members_do_not_substitute_for_database_bytes) (kind=b'2')
----------------------------------------------------------------------
Traceback (most recent call last):
File "E:\Storage\Projects\Active\temp
docs\jobjakt-local-build\recovery-archive-validation\scripts\test-deploy-backup.py", line 491, in
test_links_and_special_members_do_not_substitute_for_database_bytes
self.assertNotEqual(0, result.returncode, result.stdout + result.stderr)
AssertionError: 0 == 0 : FORMAT VERIFIED
NEXT DEPLOY GATE WOULD START
======================================================================
FAIL: test_links_and_special_members_do_not_substitute_for_database_bytes
(__main__.BackupDatabaseMemberTests.test_links_and_special_members_do_not_substitute_for_database_bytes) (kind=b'1')
----------------------------------------------------------------------
Traceback (most recent call last):
File "E:\Storage\Projects\Active\temp
docs\jobjakt-local-build\recovery-archive-validation\scripts\test-deploy-backup.py", line 491, in
test_links_and_special_members_do_not_substitute_for_database_bytes
self.assertNotEqual(0, result.returncode, result.stdout + result.stderr)
AssertionError: 0 == 0 : FORMAT VERIFIED
NEXT DEPLOY GATE WOULD START
======================================================================
FAIL: test_links_and_special_members_do_not_substitute_for_database_bytes
(__main__.BackupDatabaseMemberTests.test_links_and_special_members_do_not_substitute_for_database_bytes) (kind=b'6')
----------------------------------------------------------------------
Traceback (most recent call last):
File "E:\Storage\Projects\Active\temp
docs\jobjakt-local-build\recovery-archive-validation\scripts\test-deploy-backup.py", line 491, in
test_links_and_special_members_do_not_substitute_for_database_bytes
self.assertNotEqual(0, result.returncode, result.stdout + result.stderr)
AssertionError: 0 == 0 : FORMAT VERIFIED
NEXT DEPLOY GATE WOULD START
======================================================================
FAIL: test_links_and_special_members_do_not_substitute_for_database_bytes
(__main__.BackupDatabaseMemberTests.test_links_and_special_members_do_not_substitute_for_database_bytes) (kind=b'3')
----------------------------------------------------------------------
Traceback (most recent call last):
File "E:\Storage\Projects\Active\temp
docs\jobjakt-local-build\recovery-archive-validation\scripts\test-deploy-backup.py", line 491, in
test_links_and_special_members_do_not_substitute_for_database_bytes
self.assertNotEqual(0, result.returncode, result.stdout + result.stderr)
AssertionError: 0 == 0 : FORMAT VERIFIED
NEXT DEPLOY GATE WOULD START
======================================================================
FAIL: test_unsafe_database_member_paths_block_the_next_gate
(__main__.BackupDatabaseMemberTests.test_unsafe_database_member_paths_block_the_next_gate) (name='../jobtracker.db')
----------------------------------------------------------------------
Traceback (most recent call last):
File "E:\Storage\Projects\Active\temp
docs\jobjakt-local-build\recovery-archive-validation\scripts\test-deploy-backup.py", line 507, in
test_unsafe_database_member_paths_block_the_next_gate
self.assertNotEqual(0, result.returncode, result.stdout + result.stderr)
AssertionError: 0 == 0 : FORMAT VERIFIED
NEXT DEPLOY GATE WOULD START
======================================================================
FAIL: test_unsafe_database_member_paths_block_the_next_gate
(__main__.BackupDatabaseMemberTests.test_unsafe_database_member_paths_block_the_next_gate) (name='/jobtracker.db')
----------------------------------------------------------------------
Traceback (most recent call last):
File "E:\Storage\Projects\Active\temp
docs\jobjakt-local-build\recovery-archive-validation\scripts\test-deploy-backup.py", line 507, in
test_unsafe_database_member_paths_block_the_next_gate
self.assertNotEqual(0, result.returncode, result.stdout + result.stderr)
AssertionError: 0 == 0 : FORMAT VERIFIED
NEXT DEPLOY GATE WOULD START
======================================================================
FAIL: test_unsafe_database_member_paths_block_the_next_gate
(__main__.BackupDatabaseMemberTests.test_unsafe_database_member_paths_block_the_next_gate)
(name='data/../../jobtracker.db')
----------------------------------------------------------------------
Traceback (most recent call last):
File "E:\Storage\Projects\Active\temp
docs\jobjakt-local-build\recovery-archive-validation\scripts\test-deploy-backup.py", line 507, in
test_unsafe_database_member_paths_block_the_next_gate
self.assertNotEqual(0, result.returncode, result.stdout + result.stderr)
AssertionError: 0 == 0 : FORMAT VERIFIED
NEXT DEPLOY GATE WOULD START
----------------------------------------------------------------------
Ran 6 tests in 3.674s
FAILED (failures=10)
@@ -0,0 +1,619 @@
python : FFFEEEEEEEEEEEEEE
At line:1 char:182
+ ... | Out-Null; python scripts/test-deploy-backup.py BackupDatabaseMember ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (FFFEEEEEEEEEEEEEE:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
======================================================================
ERROR: test_exact_database_member_at_root_or_in_a_directory_is_accepted
(__main__.BackupDatabaseMemberTests.test_exact_database_member_at_root_or_in_a_directory_is_accepted)
(member='jobtracker.db')
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\shutil.py", line 633, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process:
'E:\\Storage\\Projects\\Active\\temp
docs\\jobjakt-local-build\\recovery-archive-validation\\.tmp\\tmpxsvw39ie\\fixture.db'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "E:\Storage\Projects\Active\temp
docs\jobjakt-local-build\recovery-archive-validation\scripts\test-deploy-backup.py", line 475, in
test_exact_database_member_at_root_or_in_a_directory_is_accepted
result = self.verify_archive(name)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\Storage\Projects\Active\temp
docs\jobjakt-local-build\recovery-archive-validation\scripts\test-deploy-backup.py", line 424, in verify_archive
with tempfile.TemporaryDirectory() as temporary:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 950, in __exit__
self.cleanup()
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 954, in cleanup
self._rmtree(self.name, ignore_errors=self._ignore_cleanup_errors)
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 934, in _rmtree
_shutil.rmtree(name, onexc=onexc)
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\shutil.py", line 781, in rmtree
return _rmtree_unsafe(path, onexc)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\shutil.py", line 635, in _rmtree_unsafe
onexc(os.unlink, fullname, err)
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 909, in onexc
_os.unlink(path)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process:
'E:\\Storage\\Projects\\Active\\temp
docs\\jobjakt-local-build\\recovery-archive-validation\\.tmp\\tmpxsvw39ie\\fixture.db'
======================================================================
ERROR: test_exact_database_member_at_root_or_in_a_directory_is_accepted
(__main__.BackupDatabaseMemberTests.test_exact_database_member_at_root_or_in_a_directory_is_accepted)
(member='./jobtracker.db')
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\shutil.py", line 633, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process:
'E:\\Storage\\Projects\\Active\\temp
docs\\jobjakt-local-build\\recovery-archive-validation\\.tmp\\tmpxal3zgni\\fixture.db'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "E:\Storage\Projects\Active\temp
docs\jobjakt-local-build\recovery-archive-validation\scripts\test-deploy-backup.py", line 475, in
test_exact_database_member_at_root_or_in_a_directory_is_accepted
result = self.verify_archive(name)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\Storage\Projects\Active\temp
docs\jobjakt-local-build\recovery-archive-validation\scripts\test-deploy-backup.py", line 424, in verify_archive
with tempfile.TemporaryDirectory() as temporary:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 950, in __exit__
self.cleanup()
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 954, in cleanup
self._rmtree(self.name, ignore_errors=self._ignore_cleanup_errors)
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 934, in _rmtree
_shutil.rmtree(name, onexc=onexc)
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\shutil.py", line 781, in rmtree
return _rmtree_unsafe(path, onexc)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\shutil.py", line 635, in _rmtree_unsafe
onexc(os.unlink, fullname, err)
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 909, in onexc
_os.unlink(path)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process:
'E:\\Storage\\Projects\\Active\\temp
docs\\jobjakt-local-build\\recovery-archive-validation\\.tmp\\tmpxal3zgni\\fixture.db'
======================================================================
ERROR: test_exact_database_member_at_root_or_in_a_directory_is_accepted
(__main__.BackupDatabaseMemberTests.test_exact_database_member_at_root_or_in_a_directory_is_accepted)
(member='data/jobtracker.db')
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\shutil.py", line 633, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process:
'E:\\Storage\\Projects\\Active\\temp
docs\\jobjakt-local-build\\recovery-archive-validation\\.tmp\\tmpbf17iu6o\\fixture.db'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "E:\Storage\Projects\Active\temp
docs\jobjakt-local-build\recovery-archive-validation\scripts\test-deploy-backup.py", line 475, in
test_exact_database_member_at_root_or_in_a_directory_is_accepted
result = self.verify_archive(name)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\Storage\Projects\Active\temp
docs\jobjakt-local-build\recovery-archive-validation\scripts\test-deploy-backup.py", line 424, in verify_archive
with tempfile.TemporaryDirectory() as temporary:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 950, in __exit__
self.cleanup()
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 954, in cleanup
self._rmtree(self.name, ignore_errors=self._ignore_cleanup_errors)
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 934, in _rmtree
_shutil.rmtree(name, onexc=onexc)
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\shutil.py", line 781, in rmtree
return _rmtree_unsafe(path, onexc)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\shutil.py", line 635, in _rmtree_unsafe
onexc(os.unlink, fullname, err)
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 909, in onexc
_os.unlink(path)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process:
'E:\\Storage\\Projects\\Active\\temp
docs\\jobjakt-local-build\\recovery-archive-validation\\.tmp\\tmpbf17iu6o\\fixture.db'
======================================================================
ERROR: test_links_and_special_members_do_not_substitute_for_database_bytes
(__main__.BackupDatabaseMemberTests.test_links_and_special_members_do_not_substitute_for_database_bytes) (kind=b'2')
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\shutil.py", line 633, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process:
'E:\\Storage\\Projects\\Active\\temp
docs\\jobjakt-local-build\\recovery-archive-validation\\.tmp\\tmpp54g45zx\\fixture.db'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "E:\Storage\Projects\Active\temp
docs\jobjakt-local-build\recovery-archive-validation\scripts\test-deploy-backup.py", line 489, in
test_links_and_special_members_do_not_substitute_for_database_bytes
result = self.verify_archive('jobtracker.db', member_type=kind)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\Storage\Projects\Active\temp
docs\jobjakt-local-build\recovery-archive-validation\scripts\test-deploy-backup.py", line 424, in verify_archive
with tempfile.TemporaryDirectory() as temporary:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 950, in __exit__
self.cleanup()
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 954, in cleanup
self._rmtree(self.name, ignore_errors=self._ignore_cleanup_errors)
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 934, in _rmtree
_shutil.rmtree(name, onexc=onexc)
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\shutil.py", line 781, in rmtree
return _rmtree_unsafe(path, onexc)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\shutil.py", line 635, in _rmtree_unsafe
onexc(os.unlink, fullname, err)
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 909, in onexc
_os.unlink(path)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process:
'E:\\Storage\\Projects\\Active\\temp
docs\\jobjakt-local-build\\recovery-archive-validation\\.tmp\\tmpp54g45zx\\fixture.db'
======================================================================
ERROR: test_links_and_special_members_do_not_substitute_for_database_bytes
(__main__.BackupDatabaseMemberTests.test_links_and_special_members_do_not_substitute_for_database_bytes) (kind=b'1')
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\shutil.py", line 633, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process:
'E:\\Storage\\Projects\\Active\\temp
docs\\jobjakt-local-build\\recovery-archive-validation\\.tmp\\tmpr68bdxgv\\fixture.db'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "E:\Storage\Projects\Active\temp
docs\jobjakt-local-build\recovery-archive-validation\scripts\test-deploy-backup.py", line 489, in
test_links_and_special_members_do_not_substitute_for_database_bytes
result = self.verify_archive('jobtracker.db', member_type=kind)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\Storage\Projects\Active\temp
docs\jobjakt-local-build\recovery-archive-validation\scripts\test-deploy-backup.py", line 424, in verify_archive
with tempfile.TemporaryDirectory() as temporary:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 950, in __exit__
self.cleanup()
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 954, in cleanup
self._rmtree(self.name, ignore_errors=self._ignore_cleanup_errors)
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 934, in _rmtree
_shutil.rmtree(name, onexc=onexc)
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\shutil.py", line 781, in rmtree
return _rmtree_unsafe(path, onexc)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\shutil.py", line 635, in _rmtree_unsafe
onexc(os.unlink, fullname, err)
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 909, in onexc
_os.unlink(path)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process:
'E:\\Storage\\Projects\\Active\\temp
docs\\jobjakt-local-build\\recovery-archive-validation\\.tmp\\tmpr68bdxgv\\fixture.db'
======================================================================
ERROR: test_links_and_special_members_do_not_substitute_for_database_bytes
(__main__.BackupDatabaseMemberTests.test_links_and_special_members_do_not_substitute_for_database_bytes) (kind=b'6')
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\shutil.py", line 633, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process:
'E:\\Storage\\Projects\\Active\\temp
docs\\jobjakt-local-build\\recovery-archive-validation\\.tmp\\tmpvy0f3suo\\fixture.db'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "E:\Storage\Projects\Active\temp
docs\jobjakt-local-build\recovery-archive-validation\scripts\test-deploy-backup.py", line 489, in
test_links_and_special_members_do_not_substitute_for_database_bytes
result = self.verify_archive('jobtracker.db', member_type=kind)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\Storage\Projects\Active\temp
docs\jobjakt-local-build\recovery-archive-validation\scripts\test-deploy-backup.py", line 424, in verify_archive
with tempfile.TemporaryDirectory() as temporary:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 950, in __exit__
self.cleanup()
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 954, in cleanup
self._rmtree(self.name, ignore_errors=self._ignore_cleanup_errors)
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 934, in _rmtree
_shutil.rmtree(name, onexc=onexc)
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\shutil.py", line 781, in rmtree
return _rmtree_unsafe(path, onexc)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\shutil.py", line 635, in _rmtree_unsafe
onexc(os.unlink, fullname, err)
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 909, in onexc
_os.unlink(path)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process:
'E:\\Storage\\Projects\\Active\\temp
docs\\jobjakt-local-build\\recovery-archive-validation\\.tmp\\tmpvy0f3suo\\fixture.db'
======================================================================
ERROR: test_links_and_special_members_do_not_substitute_for_database_bytes
(__main__.BackupDatabaseMemberTests.test_links_and_special_members_do_not_substitute_for_database_bytes) (kind=b'3')
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\shutil.py", line 633, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process:
'E:\\Storage\\Projects\\Active\\temp
docs\\jobjakt-local-build\\recovery-archive-validation\\.tmp\\tmpgd_8ky4z\\fixture.db'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "E:\Storage\Projects\Active\temp
docs\jobjakt-local-build\recovery-archive-validation\scripts\test-deploy-backup.py", line 489, in
test_links_and_special_members_do_not_substitute_for_database_bytes
result = self.verify_archive('jobtracker.db', member_type=kind)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\Storage\Projects\Active\temp
docs\jobjakt-local-build\recovery-archive-validation\scripts\test-deploy-backup.py", line 424, in verify_archive
with tempfile.TemporaryDirectory() as temporary:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 950, in __exit__
self.cleanup()
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 954, in cleanup
self._rmtree(self.name, ignore_errors=self._ignore_cleanup_errors)
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 934, in _rmtree
_shutil.rmtree(name, onexc=onexc)
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\shutil.py", line 781, in rmtree
return _rmtree_unsafe(path, onexc)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\shutil.py", line 635, in _rmtree_unsafe
onexc(os.unlink, fullname, err)
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 909, in onexc
_os.unlink(path)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process:
'E:\\Storage\\Projects\\Active\\temp
docs\\jobjakt-local-build\\recovery-archive-validation\\.tmp\\tmpgd_8ky4z\\fixture.db'
======================================================================
ERROR: test_sidecar_or_similar_name_is_not_the_database_member
(__main__.BackupDatabaseMemberTests.test_sidecar_or_similar_name_is_not_the_database_member)
(member='jobtracker.db-wal')
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\shutil.py", line 633, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process:
'E:\\Storage\\Projects\\Active\\temp
docs\\jobjakt-local-build\\recovery-archive-validation\\.tmp\\tmpqyiwrtov\\fixture.db'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "E:\Storage\Projects\Active\temp
docs\jobjakt-local-build\recovery-archive-validation\scripts\test-deploy-backup.py", line 467, in
test_sidecar_or_similar_name_is_not_the_database_member
result = self.verify_archive(name)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\Storage\Projects\Active\temp
docs\jobjakt-local-build\recovery-archive-validation\scripts\test-deploy-backup.py", line 424, in verify_archive
with tempfile.TemporaryDirectory() as temporary:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 950, in __exit__
self.cleanup()
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 954, in cleanup
self._rmtree(self.name, ignore_errors=self._ignore_cleanup_errors)
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 934, in _rmtree
_shutil.rmtree(name, onexc=onexc)
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\shutil.py", line 781, in rmtree
return _rmtree_unsafe(path, onexc)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\shutil.py", line 635, in _rmtree_unsafe
onexc(os.unlink, fullname, err)
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 909, in onexc
_os.unlink(path)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process:
'E:\\Storage\\Projects\\Active\\temp
docs\\jobjakt-local-build\\recovery-archive-validation\\.tmp\\tmpqyiwrtov\\fixture.db'
======================================================================
ERROR: test_sidecar_or_similar_name_is_not_the_database_member
(__main__.BackupDatabaseMemberTests.test_sidecar_or_similar_name_is_not_the_database_member)
(member='old-jobtracker.db')
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\shutil.py", line 633, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process:
'E:\\Storage\\Projects\\Active\\temp
docs\\jobjakt-local-build\\recovery-archive-validation\\.tmp\\tmp4j8sqngn\\fixture.db'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "E:\Storage\Projects\Active\temp
docs\jobjakt-local-build\recovery-archive-validation\scripts\test-deploy-backup.py", line 467, in
test_sidecar_or_similar_name_is_not_the_database_member
result = self.verify_archive(name)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\Storage\Projects\Active\temp
docs\jobjakt-local-build\recovery-archive-validation\scripts\test-deploy-backup.py", line 424, in verify_archive
with tempfile.TemporaryDirectory() as temporary:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 950, in __exit__
self.cleanup()
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 954, in cleanup
self._rmtree(self.name, ignore_errors=self._ignore_cleanup_errors)
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 934, in _rmtree
_shutil.rmtree(name, onexc=onexc)
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\shutil.py", line 781, in rmtree
return _rmtree_unsafe(path, onexc)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\shutil.py", line 635, in _rmtree_unsafe
onexc(os.unlink, fullname, err)
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 909, in onexc
_os.unlink(path)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process:
'E:\\Storage\\Projects\\Active\\temp
docs\\jobjakt-local-build\\recovery-archive-validation\\.tmp\\tmp4j8sqngn\\fixture.db'
======================================================================
ERROR: test_sidecar_or_similar_name_is_not_the_database_member
(__main__.BackupDatabaseMemberTests.test_sidecar_or_similar_name_is_not_the_database_member)
(member='jobtracker.db.backup')
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\shutil.py", line 633, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process:
'E:\\Storage\\Projects\\Active\\temp
docs\\jobjakt-local-build\\recovery-archive-validation\\.tmp\\tmpdn9dgzlq\\fixture.db'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "E:\Storage\Projects\Active\temp
docs\jobjakt-local-build\recovery-archive-validation\scripts\test-deploy-backup.py", line 467, in
test_sidecar_or_similar_name_is_not_the_database_member
result = self.verify_archive(name)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\Storage\Projects\Active\temp
docs\jobjakt-local-build\recovery-archive-validation\scripts\test-deploy-backup.py", line 424, in verify_archive
with tempfile.TemporaryDirectory() as temporary:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 950, in __exit__
self.cleanup()
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 954, in cleanup
self._rmtree(self.name, ignore_errors=self._ignore_cleanup_errors)
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 934, in _rmtree
_shutil.rmtree(name, onexc=onexc)
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\shutil.py", line 781, in rmtree
return _rmtree_unsafe(path, onexc)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\shutil.py", line 635, in _rmtree_unsafe
onexc(os.unlink, fullname, err)
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 909, in onexc
_os.unlink(path)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process:
'E:\\Storage\\Projects\\Active\\temp
docs\\jobjakt-local-build\\recovery-archive-validation\\.tmp\\tmpdn9dgzlq\\fixture.db'
======================================================================
ERROR: test_unsafe_database_member_paths_block_the_next_gate
(__main__.BackupDatabaseMemberTests.test_unsafe_database_member_paths_block_the_next_gate) (name='../jobtracker.db')
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\shutil.py", line 633, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process:
'E:\\Storage\\Projects\\Active\\temp
docs\\jobjakt-local-build\\recovery-archive-validation\\.tmp\\tmp1qtpiiuf\\fixture.db'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "E:\Storage\Projects\Active\temp
docs\jobjakt-local-build\recovery-archive-validation\scripts\test-deploy-backup.py", line 505, in
test_unsafe_database_member_paths_block_the_next_gate
result = self.verify_archive(name)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\Storage\Projects\Active\temp
docs\jobjakt-local-build\recovery-archive-validation\scripts\test-deploy-backup.py", line 424, in verify_archive
with tempfile.TemporaryDirectory() as temporary:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 950, in __exit__
self.cleanup()
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 954, in cleanup
self._rmtree(self.name, ignore_errors=self._ignore_cleanup_errors)
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 934, in _rmtree
_shutil.rmtree(name, onexc=onexc)
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\shutil.py", line 781, in rmtree
return _rmtree_unsafe(path, onexc)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\shutil.py", line 635, in _rmtree_unsafe
onexc(os.unlink, fullname, err)
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 909, in onexc
_os.unlink(path)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process:
'E:\\Storage\\Projects\\Active\\temp
docs\\jobjakt-local-build\\recovery-archive-validation\\.tmp\\tmp1qtpiiuf\\fixture.db'
======================================================================
ERROR: test_unsafe_database_member_paths_block_the_next_gate
(__main__.BackupDatabaseMemberTests.test_unsafe_database_member_paths_block_the_next_gate) (name='/jobtracker.db')
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\shutil.py", line 633, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process:
'E:\\Storage\\Projects\\Active\\temp
docs\\jobjakt-local-build\\recovery-archive-validation\\.tmp\\tmphovjwsze\\fixture.db'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "E:\Storage\Projects\Active\temp
docs\jobjakt-local-build\recovery-archive-validation\scripts\test-deploy-backup.py", line 505, in
test_unsafe_database_member_paths_block_the_next_gate
result = self.verify_archive(name)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\Storage\Projects\Active\temp
docs\jobjakt-local-build\recovery-archive-validation\scripts\test-deploy-backup.py", line 424, in verify_archive
with tempfile.TemporaryDirectory() as temporary:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 950, in __exit__
self.cleanup()
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 954, in cleanup
self._rmtree(self.name, ignore_errors=self._ignore_cleanup_errors)
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 934, in _rmtree
_shutil.rmtree(name, onexc=onexc)
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\shutil.py", line 781, in rmtree
return _rmtree_unsafe(path, onexc)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\shutil.py", line 635, in _rmtree_unsafe
onexc(os.unlink, fullname, err)
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 909, in onexc
_os.unlink(path)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process:
'E:\\Storage\\Projects\\Active\\temp
docs\\jobjakt-local-build\\recovery-archive-validation\\.tmp\\tmphovjwsze\\fixture.db'
======================================================================
ERROR: test_unsafe_database_member_paths_block_the_next_gate
(__main__.BackupDatabaseMemberTests.test_unsafe_database_member_paths_block_the_next_gate)
(name='data/../../jobtracker.db')
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\shutil.py", line 633, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process:
'E:\\Storage\\Projects\\Active\\temp
docs\\jobjakt-local-build\\recovery-archive-validation\\.tmp\\tmp00j9gsus\\fixture.db'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "E:\Storage\Projects\Active\temp
docs\jobjakt-local-build\recovery-archive-validation\scripts\test-deploy-backup.py", line 505, in
test_unsafe_database_member_paths_block_the_next_gate
result = self.verify_archive(name)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\Storage\Projects\Active\temp
docs\jobjakt-local-build\recovery-archive-validation\scripts\test-deploy-backup.py", line 424, in verify_archive
with tempfile.TemporaryDirectory() as temporary:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 950, in __exit__
self.cleanup()
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 954, in cleanup
self._rmtree(self.name, ignore_errors=self._ignore_cleanup_errors)
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 934, in _rmtree
_shutil.rmtree(name, onexc=onexc)
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\shutil.py", line 781, in rmtree
return _rmtree_unsafe(path, onexc)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\shutil.py", line 635, in _rmtree_unsafe
onexc(os.unlink, fullname, err)
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 909, in onexc
_os.unlink(path)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process:
'E:\\Storage\\Projects\\Active\\temp
docs\\jobjakt-local-build\\recovery-archive-validation\\.tmp\\tmp00j9gsus\\fixture.db'
======================================================================
ERROR: test_valid_gzip_with_truncated_tar_database_member_is_rejected
(__main__.BackupDatabaseMemberTests.test_valid_gzip_with_truncated_tar_database_member_is_rejected)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\shutil.py", line 633, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process:
'E:\\Storage\\Projects\\Active\\temp
docs\\jobjakt-local-build\\recovery-archive-validation\\.tmp\\tmpx9s_a2rf\\fixture.db'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "E:\Storage\Projects\Active\temp
docs\jobjakt-local-build\recovery-archive-validation\scripts\test-deploy-backup.py", line 481, in
test_valid_gzip_with_truncated_tar_database_member_is_rejected
result = self.verify_archive('jobtracker.db', truncated_tar=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\Storage\Projects\Active\temp
docs\jobjakt-local-build\recovery-archive-validation\scripts\test-deploy-backup.py", line 424, in verify_archive
with tempfile.TemporaryDirectory() as temporary:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 950, in __exit__
self.cleanup()
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 954, in cleanup
self._rmtree(self.name, ignore_errors=self._ignore_cleanup_errors)
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 934, in _rmtree
_shutil.rmtree(name, onexc=onexc)
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\shutil.py", line 781, in rmtree
return _rmtree_unsafe(path, onexc)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\shutil.py", line 635, in _rmtree_unsafe
onexc(os.unlink, fullname, err)
File "C:\Users\Connor\AppData\Local\Programs\Python\Python312\Lib\tempfile.py", line 909, in onexc
_os.unlink(path)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process:
'E:\\Storage\\Projects\\Active\\temp
docs\\jobjakt-local-build\\recovery-archive-validation\\.tmp\\tmpx9s_a2rf\\fixture.db'
======================================================================
FAIL: test_empty_or_non_sqlite_database_bytes_block_the_next_gate
(__main__.BackupDatabaseMemberTests.test_empty_or_non_sqlite_database_bytes_block_the_next_gate) (contents=b'')
----------------------------------------------------------------------
Traceback (most recent call last):
File "E:\Storage\Projects\Active\temp
docs\jobjakt-local-build\recovery-archive-validation\scripts\test-deploy-backup.py", line 498, in
test_empty_or_non_sqlite_database_bytes_block_the_next_gate
self.assertNotEqual(0, result.returncode, result.stdout + result.stderr)
AssertionError: 0 == 0 : FORMAT VERIFIED
NEXT DEPLOY GATE WOULD START
======================================================================
FAIL: test_empty_or_non_sqlite_database_bytes_block_the_next_gate
(__main__.BackupDatabaseMemberTests.test_empty_or_non_sqlite_database_bytes_block_the_next_gate) (contents=b'unrelated
application bytes')
----------------------------------------------------------------------
Traceback (most recent call last):
File "E:\Storage\Projects\Active\temp
docs\jobjakt-local-build\recovery-archive-validation\scripts\test-deploy-backup.py", line 498, in
test_empty_or_non_sqlite_database_bytes_block_the_next_gate
self.assertNotEqual(0, result.returncode, result.stdout + result.stderr)
AssertionError: 0 == 0 : FORMAT VERIFIED
NEXT DEPLOY GATE WOULD START
======================================================================
FAIL: test_empty_or_non_sqlite_database_bytes_block_the_next_gate
(__main__.BackupDatabaseMemberTests.test_empty_or_non_sqlite_database_bytes_block_the_next_gate) (contents=b'SQLite
format 3X\x00')
----------------------------------------------------------------------
Traceback (most recent call last):
File "E:\Storage\Projects\Active\temp
docs\jobjakt-local-build\recovery-archive-validation\scripts\test-deploy-backup.py", line 498, in
test_empty_or_non_sqlite_database_bytes_block_the_next_gate
self.assertNotEqual(0, result.returncode, result.stdout + result.stderr)
AssertionError: 0 == 0 : FORMAT VERIFIED
NEXT DEPLOY GATE WOULD START
----------------------------------------------------------------------
Ran 6 tests in 3.889s
FAILED (failures=3, errors=14)
+48 -8
View File
@@ -5,6 +5,7 @@ import gzip
from pathlib import Path
import shlex
import shutil
import sqlite3
import subprocess
import sys
import tarfile
@@ -310,11 +311,19 @@ class BackupPermissionTests(unittest.TestCase):
with tempfile.TemporaryDirectory(prefix='backup-permission-') as directory:
target = Path(directory) / 'synthetic-backup.gz'
payload = b'synthetic permission fixture'
if kind == 'recovery':
output = io.BytesIO()
with tarfile.open(fileobj=output, mode='w:gz') as bundle:
member = tarfile.TarInfo('jobtracker.db')
member.size = 16
bundle.addfile(member, io.BytesIO(b'SQLite format 3\x00'))
payload = output.getvalue()
target.write_bytes(payload)
script = '\n'.join([
'set -euo pipefail',
'BACKUP_DIR=' + shlex.quote(Path(directory).as_posix()),
'TARGET=' + shlex.quote(target.as_posix()),
'python3() { ' + shlex.quote(Path(sys.executable).as_posix()) + ' "$@"; }',
'chmod() { echo "HOST PERMISSIONS"; return ' + str(host_status) + '; }',
'docker() { if [[ "${@: -1}" == *chmod* ]]; then echo "FALLBACK PERMISSIONS"; return ' + str(fallback_status) + '; fi; return 0; }',
'du() { printf "1K\\tsynthetic\\n"; }',
@@ -414,7 +423,7 @@ class BackupSqlTrailerTests(unittest.TestCase):
class BackupDatabaseMemberTests(unittest.TestCase):
def verify_archive(self, member_name, truncated_tar=False):
def verify_archive(self, member_name, truncated_tar=False, member_type=tarfile.REGTYPE, contents=None):
source = (ROOT / 'deploy/deploy.sh').read_text(encoding='utf-8')
functions = []
for name in ['verify_backup_file_shape', 'verify_volume_backup']:
@@ -424,23 +433,30 @@ class BackupDatabaseMemberTests(unittest.TestCase):
folder = Path(temporary)
archive = folder / 'synthetic.tar.gz'
member = tarfile.TarInfo(member_name)
member.type = member_type
if member_type in (tarfile.SYMTYPE, tarfile.LNKTYPE):
member.linkname = 'missing-database'
if contents is None:
database = folder / 'fixture.db'
with sqlite3.connect(database) as connection:
connection.execute('CREATE TABLE synthetic (id INTEGER PRIMARY KEY, value TEXT)')
connection.execute("INSERT INTO synthetic(value) VALUES ('fixture only')")
connection.close()
contents = database.read_bytes()
if truncated_tar:
member.size = 4096
with gzip.open(archive, 'wb') as bundle:
bundle.write(member.tobuf())
else:
member.size = len(b'synthetic bytes')
member.size = len(contents) if member_type == tarfile.REGTYPE else 0
with tarfile.open(archive, 'w:gz') as bundle:
bundle.addfile(member, io.BytesIO(b'synthetic bytes'))
bundle.addfile(member, io.BytesIO(contents) if member_type == tarfile.REGTYPE else None)
script = '\n'.join([
'set -euo pipefail',
'BACKUP_DIR=' + shlex.quote(folder.as_posix()),
'python3() { ' + shlex.quote(Path(sys.executable).as_posix()) + ' "$@"; }',
'report_backup() { echo "FORMAT VERIFIED"; }',
# Replace container-only paths; run its actual tar and grep commands.
r'docker() { local argument script="${!#}"; '
r'for argument in "$@"; do case "$argument" in ARCHIVE_NAME=*) export "$argument";; esac; done; '
r'script="${script//\/backup\//./}"; script="${script//\/tmp\/backup-members/backup-members}"; '
r'(cd "$BACKUP_DIR" && sh -c "$script"); }',
'docker() { echo "Unexpected Docker validation call" >&2; return 99; }',
*functions,
'if ! verify_volume_backup "$BACKUP_DIR/synthetic.tar.gz"; then exit 1; fi',
'echo "NEXT DEPLOY GATE WOULD START"',
@@ -472,6 +488,30 @@ class BackupDatabaseMemberTests(unittest.TestCase):
self.assertNotIn('FORMAT VERIFIED', result.stdout)
self.assertNotIn('NEXT DEPLOY GATE WOULD START', result.stdout)
def test_links_and_special_members_do_not_substitute_for_database_bytes(self):
for kind in [tarfile.SYMTYPE, tarfile.LNKTYPE, tarfile.FIFOTYPE, tarfile.CHRTYPE]:
with self.subTest(kind=kind):
result = self.verify_archive('jobtracker.db', member_type=kind)
self.assertNotEqual(0, result.returncode, result.stdout + result.stderr)
self.assertNotIn('FORMAT VERIFIED', result.stdout)
self.assertNotIn('NEXT DEPLOY GATE WOULD START', result.stdout)
def test_empty_or_non_sqlite_database_bytes_block_the_next_gate(self):
for contents in [b'', b'unrelated application bytes', b'SQLite format 3X\x00']:
with self.subTest(contents=contents):
result = self.verify_archive('jobtracker.db', contents=contents)
self.assertNotEqual(0, result.returncode, result.stdout + result.stderr)
self.assertNotIn('FORMAT VERIFIED', result.stdout)
self.assertNotIn('NEXT DEPLOY GATE WOULD START', result.stdout)
def test_unsafe_database_member_paths_block_the_next_gate(self):
for name in ['../jobtracker.db', '/jobtracker.db', 'data/../../jobtracker.db']:
with self.subTest(name=name):
result = self.verify_archive(name)
self.assertNotEqual(0, result.returncode, result.stdout + result.stderr)
self.assertNotIn('FORMAT VERIFIED', result.stdout)
self.assertNotIn('NEXT DEPLOY GATE WOULD START', result.stdout)
if __name__ == '__main__':
unittest.main()
+37
View File
@@ -0,0 +1,37 @@
"""Check database member identity/type/header without extracting an archive.
This is format qualification, not SQLite integrity, a restore or recovery-set proof.
"""
from pathlib import PurePosixPath
import sys
import tarfile
def validate(archive):
found = False
with tarfile.open(archive, mode='r|gz') as bundle:
for member in bundle:
path = PurePosixPath(member.name)
if path.name != 'jobtracker.db':
continue
if path.is_absolute() or '..' in path.parts or '\\' in member.name:
raise ValueError('SQLite backup has an unsafe database member path.')
if not member.isfile() or member.size < 16:
raise ValueError('SQLite backup database must be a nonempty regular file.')
with bundle.extractfile(member) as data:
if data.read(16) != b'SQLite format 3\x00':
raise ValueError('SQLite backup database header is invalid.')
found = True
if not found:
raise ValueError('SQLite backup contains no database member.')
if __name__ == '__main__':
try:
if len(sys.argv) != 2:
raise ValueError('Provide one SQLite backup archive.')
validate(sys.argv[1])
except (ValueError, OSError, EOFError, tarfile.TarError):
# Archive names, member names and database contents may contain private data.
print('SQLite backup member validation failed.', file=sys.stderr)
sys.exit(1)