`snapshot_sqlite.py` hangs when source and destination are the same database
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 82/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- python, sqlite
- Domain
- cli, databases, testing-qa
Research direction
Start with sdk/typescript/_bundled_plugin/scripts/snapshot_sqlite.py and run the provided reproduction using identical source and destination paths. Check the existing-destination handling before source_connection.backup(destination_connection), including aliases to the same filesystem object. Done means the helper fails fast with a clear diagnostic and a regression test uses a process timeout to prevent an unbounded hang.
Written by the indexing model from the issue text.
Description
Summary
sdk/typescript/_bundled_plugin/scripts/snapshot_sqlite.py can hang indefinitely when the destination refers to the same SQLite database file as the source.
The helper opens the source read-only, opens the destination separately, and then calls source_connection.backup(destination_connection). SQLite's backup API does not make progress when both connections refer to the same database file.
Reproduction
python3 - <<'PY'
import sqlite3
path = "/tmp/codex-security-snapshot-repro.sqlite3"
with sqlite3.connect(path) as connection:
connection.execute("CREATE TABLE IF NOT EXISTS t(value TEXT)")
PY
python3 sdk/typescript/_bundled_plugin/scripts/snapshot_sqlite.py \
/tmp/codex-security-snapshot-repro.sqlite3 \
/tmp/codex-security-snapshot-repro.sqlite3
The second command does not return.
Aliases to the same file can reach the same condition, so comparing path strings alone would not be sufficient.
Expected behavior
The helper should reject an existing destination that identifies the same filesystem object as the source before calling SQLite backup.
Suggested fix
Use filesystem identity (Path.samefile / os.path.samefile) when the destination already exists, fail fast with a clear diagnostic, and add a regression with a process timeout so this cannot silently become an unbounded test hang.
- Dominant language
- TypeScript
- Stars
- 10.8k
- Forks
- 802
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 257
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from openai/codex-security
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
openai/codex-security#528 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
openai/codex-security#521 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
openai/codex-security#516 ·
-
area:cli documentation priority:p3
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
openai/codex-security#234 · 1 comment ·
-
scan.target.remote accepts embedded tab/newline/CR because new URL() strips them before validating Openarea:reports bug priority:p2
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
openai/codex-security#231 ·
All issues in openai/codex-security
Similar issues
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 91/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100