You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the input paths match no files at all, analyze still creates the output database before
discovering there is nothing to do. SQLiteWriter.Begin truncates the file (File.WriteAllBytes)
and runs the full schema init, the run then finds zero files, and the (now empty) database is
deleted.
The destructive part is the truncation. A mistyped path is enough:
important.db is a previous, valid analysis. The command prints Warning: path not found, skipping: C:/typo/not-a-real-path, truncates important.db anyway, and
(since #115) deletes it. The old content is gone either way — this behaviour predates #115, which
only changed what is left behind afterwards.
Nothing needs to touch the filesystem in this case. A check before the database is created, e.g.
after CollectFiles() in AnalyzerTool.Analyze:
if(files.Count==0){Console.Error.WriteLine("Error: the input paths matched no files to analyze.");return1;}
avoids creating or truncating anything, and skips the schema init and finalize work that is
currently thrown away.
It also makes an existing database at -o survive this class of failure, while a run where every
file failed still deletes it. That difference is defensible (the file is only removed once its
content has already been destroyed) but it should be a deliberate choice.
Found while reviewing the fix for #115; left out of that PR to keep it to a single failure path.
When the input paths match no files at all,
analyzestill creates the output database beforediscovering there is nothing to do.
SQLiteWriter.Begintruncates the file (File.WriteAllBytes)and runs the full schema init, the run then finds zero files, and the (now empty) database is
deleted.
The destructive part is the truncation. A mistyped path is enough:
important.dbis a previous, valid analysis. The command printsWarning: path not found, skipping: C:/typo/not-a-real-path, truncatesimportant.dbanyway, and(since #115) deletes it. The old content is gone either way — this behaviour predates #115, which
only changed what is left behind afterwards.
Nothing needs to touch the filesystem in this case. A check before the database is created, e.g.
after
CollectFiles()inAnalyzerTool.Analyze:avoids creating or truncating anything, and skips the schema init and finalize work that is
currently thrown away.
Points to decide:
could share wording.
-osurvive this class of failure, while a run where everyfile failed still deletes it. That difference is defensible (the file is only removed once its
content has already been destroyed) but it should be a deliberate choice.
Found while reviewing the fix for #115; left out of that PR to keep it to a single failure path.