Re: [sqlite] Risk of damaging a non-sqlite file with `sqlite3 `?

2016-10-21 Thread Wade, William
> From: Clemens Ladisch [mailto:clem...@ladisch.de]
> Sent: Friday, October 21, 2016 1:31 AM
> It would be possible to open a 'wrong' file only if someone had created a 
> fake database file deliberately.

I think that is generally correct, but "possible ... only if" is perhaps a bit 
strong.

sqlite3.exe is willing to open and modify an existing empty file. In some sense 
that means that all empty files are sqlite databases. Often, the creator of the 
file had something else in mind.

If I run the unix command

split --bytes=360K foo.sqlite foo.sqlite

so that I can archive the file onto a collection of floppy disks, one of the 
files I get will be named foo.sqliteaa, and that file will have the sqlite 
header string. I'd call it a stretch to say that I deliberately created a fake 
database file.

Regards,
Bill

**
This e-mail and any attachments thereto may contain confidential information 
and/or information protected by intellectual property rights for the exclusive 
attention of the intended addressees named above. If you have received this 
transmission in error, please immediately notify the sender by return e-mail 
and delete this message and its attachments. Unauthorized use, copying or 
further full or partial distribution of this e-mail or its contents is 
prohibited.
**
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Risk of damaging a non-sqlite file with `sqlite3 `?

2016-10-21 Thread Clemens Ladisch
Rolf Ade wrote:
> If the cmd line tool sqlite3 is used, is it possible to damage a file,
> given as sqlite database file argument to sqlite3?

No.  A database file is uniquely identified by the magic header string:


It would be possible to open a 'wrong' file only if someone had created
a fake database file deliberately.


Regards,
Clemens
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Risk of damaging a non-sqlite file with `sqlite3 `?

2016-10-20 Thread Rolf Ade

Hello,

I'm asking this for further discussion of a deficiencies of emacs
sql-mode w/ sqlite databases
(https://debbugs.gnu.org/cgi/bugreport.cgi?bug=23566).

If the cmd line tool sqlite3 is used, is it possible to damage a file,
given as sqlite database file argument to sqlite3?

Just

sqlite3 existing.file

with any (non sqlite database file) file works for me and present me the
ordinary sqlite3 cmd line prompt. I'm able to make selects but as far as
I do something, that needs the database file (reading data or altering
it) I get the error:

Error: file is encrypted or is not a database

After exiting sqlite3, I find some.file unmodified.

While this is fine (and sane) (and expected) this is just some anecdotal
data by me.

It would help me in the above mentioned discussion, if I could point to
a more trusted source, that the sqlite developer activly care about (by
magic bytes et. al.) not mangling non sqlite database files erroneously
given as sqlite database file argument to sqlite3.

rolf


___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users