News for hackers. Stuff that matters.
Re:We Need A Standard Layered Image Format by thristian on Tuesday April 30, 2013 @06:28PM (#5635283)
One downside would be that tools like file(1) that try to guess a file's format by examining its contents would return "SQLite database" for every image file, which isn't the most helpful result.

Since SQLite aims to be a generic way for applications to store data, it'd be nice if its "open database" and "create database" functions allowed you to supply, say, a 4- or 8-byte magic value that would be stored at a fixed location in the file's header so tools could distinguish your SQLite-based file-format from everybody else's, without having to load the thing up and examine the schema.

Re:We Need A Standard Layered Image Format by SQLite on Tuesday April 30, 2013 @07:58PM (#5635655)
There are currently 24 contiguous bytes of unused space in the SQLite header. If need be, and if SQLite catches on for use as a portable image format, I will be willing to allocate some or all of those 24 bytes to an identifier string for file(1).
Re:We Need A Standard Layered Image Format by aidos on Tuesday April 30, 2013 @08:01PM (#5635664)
This is surely one of the greatest responses I've ever seen on the internet. What was the intention with the unused space originally? Did you foresee this moment coming?
Re:We Need A Standard Layered Image Format by SQLite on Tuesday April 30, 2013 @08:23PM (#5635743)
When designing a file format, it is always a good idea to plan for enhancements. There were originally 36 bytes of unused space in the 100-byte header of the SQLite 3.0.0 file format, back in 2004 - bytes set aside specifically to deal with unforeseen needs. Over the years, 12 of those bytes have been allocated to various improvements. 24 bytes remain. (I'd prefer not to use them up all at once or on a whim, obviously.)
Re:We Need A Standard Layered Image Format by sneak on Wednesday May 01, 2013 @01:32AM (#5636626)
Thank heaven for people like you.
Re:We Need A Standard Layered Image Format by ceol on Tuesday April 30, 2013 @09:09PM (#5635893)
First, thanks so much for making what is one of the most awesome database tools around.

If you would be willing, what's your opinion on using SQLite as an image format like this? The "When to Use" page specifically sites application file formats as a good use, but would your header byte allocation be done begrudgingly or contentedly?

Re:We Need A Standard Layered Image Format by Sprint on Wednesday May 01, 2013 @04:31AM (#5637015)
Who are you to be able to speak on behalf of the SQLite developers? Anyone could be behind that username.
Re:We Need A Standard Layered Image Format by mahmud on Tuesday April 30, 2013 @09:58PM (#5636034)
What an awesome response.
Re:We Need A Standard Layered Image Format by eli on Tuesday April 30, 2013 @07:01PM (#5635443)
I'm not convinced this is actually a good idea overall, but...

There's no reason `file` couldn't be made to recognize special cases of SQLite databases. It certainly handles far uglier cases already.

And SQLite already provides a place to store meta-data about a table: http://www.sqlite.org/pragma.html#pragma_user_version Though the bummer is user_version is only 32 bits.

Re:We Need A Standard Layered Image Format by coldtea on Tuesday April 30, 2013 @07:43PM (#5635607)
>One downside would be that tools like file(1) that try to guess a file's format by examining its contents would return "SQLite database" for every image file

If the format catches on, they wont. For one, it would have it's own fixed file extension, and second, file(1) will be updated to perform and extra check even if something initially looks like a common SQLite database file.

Re:We Need A Standard Layered Image Format by takluyver on Tuesday April 30, 2013 @07:07PM (#5635471)
There's already a similar situation for files like ODT, which are actually just a zip file with specific contents. But maybe the zip format has more flexibility to stick magic values in than sqlite does.
Re:We Need A Standard Layered Image Format by bane on Tuesday April 30, 2013 @09:54PM (#5636023)
why not reserve a specially named table with the format identifier in there that file(1) could poke into and take a look at?