News for hackers. Stuff that matters.
Re:Fish: A user-friendly command line shell for macOS, Linux... by GlitchMr on Wednesday December 13, 2017 @01:55AM (#15912543)
Supporting this, I don't think protobuf is a good format for storing history files. Backward compatibility is tricky with it - I don't think the history format is going to change all that much, but I think there were changes in history of fish shell like adding time field. If the choice would be on a binary format, I would much, much, much more prefer SQLite for that. Also, B-trees are perfectly fine choice for searching history, as they make prefix searches trivial.

TOML is definitely an interesting choice if a text format is deemed necessary however. Array of tables syntax should be a fine syntax choice for storing history.

Re:Fish: A user-friendly command line shell for macOS, Linux... by FRex on Wednesday December 13, 2017 @03:06PM (#15917171)
I was about to say SQLite, it seems perfect - binary, fast, easy to update cheaply in place, immune to escaping et al problems (if you use prepared statements, not glue SQL with + of course), reliable, available in most languages (even for C and C++ the integration is trivial - it's a single pair of files drop in) and on the CLI, stable, the history data is very row/item oriented and not totally heterogeneous or free form, etc.

I totally drank the SQLite koolaid a long time ago.

Re:Fish: A user-friendly command line shell for macOS, Linux... by cben on Sunday December 17, 2017 @12:04PM (#15946525)
History file may be read & updated simultaneously my multiple processes. Is that sufficiently safe from corruption with SQLite? (honest question, no FUD implied. same risks apply to alternatives too.)
Re:Fish: A user-friendly command line shell for macOS, Linux... by timdierks on Sunday December 17, 2017 @05:09PM (#15947966)
Yes, SQLite has robust multiprocess locking and transaction support. https://sqlite.org/faq.html#q5
Re:Fish: A user-friendly command line shell for macOS, Linux... by fpoling on Wednesday December 13, 2017 @03:30AM (#15912890)
In addition protobuf is designed for communications, not incremental updates in a local store. As such making things robust to store things on a development machine is non-trivial. SQLite is so much better for that. After Firefox switched to use it for its own history, most problems with history corruption disappeared.
Re:Fish: A user-friendly command line shell for macOS, Linux... by theshrike79 on Thursday December 14, 2017 @11:15AM (#15923405)
You can ad extra fields to protobufs just fine, they just need to be added to the end of the definition.