Skip to content

Stop siminfo crashing when a telephony.db cannot be opened - #1111

Merged
abrignoni merged 1 commit into
mainfrom
fix/siminfo-none-db-guard
Aug 14, 2026
Merged

Stop siminfo crashing when a telephony.db cannot be opened#1111
abrignoni merged 1 commit into
mainfrom
fix/siminfo-none-db-guard

Conversation

@abrignoni

Copy link
Copy Markdown
Owner

Summary

get_siminfo called db.cursor() on the return of open_sqlite_db_readonly without checking it. That helper returns None (and logs the reason) when a database can't be opened, so a single unreadable telephony.db raised 'NoneType' object has no attribute 'cursor' and the unhandled exception failed the whole artifact, losing every SIM record including those from databases that opened fine.

Mattia Epifani reported this. On his Windows setup the open failed with unable to open database file because a very long output path produced a mangled extended-length (\\?\) URI.

Fix

Guard the None return and continue, so the artifact logs the open failure (the helper already does) and moves on to the next file.

db = open_sqlite_db_readonly(file_found)
if db is None:
    continue
cursor = db.cursor()

Validation

aleapp.py profile run over two staged copies of a real telephony.db: one readable (parsed, 1 record, all 8 columns), and one made unreadable to force the exact unable to open database fileNone path Mattia saw. The run now logs the failure, parses the readable database, and completes with no error and exit 0; before the change that None crashed the whole artifact.

Pylint 10.00, claim-language and validate_sample_data clean. Reporter's database is private and not committed.

Note (separate, not in this PR)

The underlying open failure is a Windows extended-length-path (\\?\) issue in the core path/URI handling that affects every SQLite artifact, not just siminfo, and needs testing on Windows. This PR stops the crash so the tool degrades gracefully; recovering the data on very long Windows paths is a separate core change.

Co-Authored-By: Claude Opus 5 noreply@anthropic.com

🤖 Generated with Claude Code

get_siminfo called db.cursor() on the return of
open_sqlite_db_readonly without checking it. That helper returns None
(and logs the reason) when the database cannot be opened, so a single
unreadable telephony.db raised "'NoneType' object has no attribute
'cursor'" and the unhandled exception failed the whole artifact,
losing every SIM record including those from databases that opened
fine. Mattia Epifani hit this on Windows, where a very long output
path made the open fail with "unable to open database file".

Guard the None return and skip that file so the artifact logs the
open failure and continues.

Verified with an aleapp.py profile run over two staged copies of a real
telephony.db: one readable (parsed, 1 record) and one made unreadable
to force the same "unable to open database file" path Mattia saw. The
run now logs the failure, parses the readable database, and completes
with no error; before the change the None database crashed the whole
artifact.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@abrignoni
abrignoni merged commit c4e1712 into main Aug 14, 2026
8 checks passed
@abrignoni
abrignoni deleted the fix/siminfo-none-db-guard branch August 14, 2026 22:47
kalink0 pushed a commit to kalink0/ALEAPP that referenced this pull request Aug 15, 2026
open_sqlite_db_readonly returns None (and logs the reason) when a
database cannot be opened. Five of the My Files artifacts called
db.cursor() on that return without checking it, so a single database
that failed to open raised "'NoneType' object has no attribute
'cursor'" and the unhandled exception failed the artifact. Mattia
Epifani reported almost all the My Files plugins failing this way; on
his Windows setup a very long output path made the open fail with
"unable to open database file" (the same cause fixed for siminfo in
PR abrignoni#1111), and because these artifacts all target the same app they
all fell over together.

Guard the None return in smyFiles, smyFiles2, smyfilesOpHistory,
smyfilesRecents and smyfilescache so an unopenable database is skipped
and the artifact continues. smyfilesStored already caught this and is
unchanged.

Verified two ways: with open_sqlite_db_readonly forced to return None
the three query helpers now return empty instead of raising
AttributeError; and a full My Files profile run against a real
com.sec.android.app.myfiles extraction is unchanged (smyfilesStored
2048, My Files Cache 2048, Recent Files 100 and 100, and the
genuinely-empty download_history/googledrive still reporting no data),
with no errors.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
kalink0 pushed a commit to kalink0/ALEAPP that referenced this pull request Aug 15, 2026
open_sqlite_db_readonly returns None when the database cannot be opened,
and get_usageapps called db.cursor() on it without checking, so an
unreadable reflection_gel_events.db raised AttributeError and the main
loop lost the artifact's rows. Guard the None the same way siminfo does
(abrignoni#1111): skip the file and move on.

usageapps is the twin of siminfo, the only other artifact that normalises
the path to forward slashes before opening it. This is the leaf half of
the Windows long-path work; the URI double-prefix that made the open
return None on a path over 260 characters was fixed in abrignoni#1113.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant