News for hackers. Stuff that matters.
Re:Why Is SQLite Coded in C? (2017) by bluejekyll on Wednesday March 14, 2018 @11:19AM (#16585336)
Lets not create a false equivalency between Go and C.

Go is a good language, one of its core pieces is to increase memory safety through the use of a garbage collector.

Much of what the SQLite post states may not be safe operations in Go.

Rust would be a safer alternative that meets many of the SQLite requirements.

The thing is, SQLite is bulletproof at this point, so do we need to replace it?

Re:Why Is SQLite Coded in C? (2017) by chungy on Wednesday March 14, 2018 @11:26AM (#16585389)
> The thing is, SQLite is bulletproof at this point, so do we need to replace it?

No, probably not, it is fine as it is. Still, even SQLite started out as a "for fun" project. Who knows what might happen in the future to displace it? ;)

Re:Why Is SQLite Coded in C? (2017) by tangue on Wednesday March 14, 2018 @11:59AM (#16585692)
Sqllite didn’t start for fun it was built for navy destroyers and submarines. (1) that’s probably why parent called it bulletproof.

(1) https://en.wikipedia.org/wiki/SQLite#History

Re:Why Is SQLite Coded in C? (2017) by mzzter on Wednesday March 14, 2018 @12:07PM (#16585766)
It could also be a reference to the comprehensive SQLite test suite (1) or the fact that it has been in production systems for many years, though it’s initial purpose does make bulletproof quite apt.

(1) https://sqlite.org/testing.html

Re:Why Is SQLite Coded in C? (2017) by weberc2 on Wednesday March 14, 2018 @02:08PM (#16586922)
> Sqllite didn’t start for fun it was built for navy destroyers and submarines.

Those aren't mutually exclusive. I for one find destroyers to be an absolute riot.

Re:Why Is SQLite Coded in C? (2017) by bluejekyll on Wednesday March 14, 2018 @12:36PM (#16585968)
I admit that I was merely being metaphorical and referencing the comprehensive test suite, wide distribution and usage.

I wish I had intended that pun embedded in the comment, but from now on ;)

Re:Why Is SQLite Coded in C? (2017) by h1d on Wednesday March 14, 2018 @12:21PM (#16585856)
When Wikipedia simply says otherwise I wonder where you got the "for fun" reference from. I tend to almost blindly trust comments on HN but this one was quite off.
Re:Why Is SQLite Coded in C? (2017) by lV2ZUWnJUAGc on Wednesday March 14, 2018 @02:22PM (#16587061)
You baited me into making an account.

See https://changelog.com/podcast/201#transcript-100

>I had couple months off and I thought, "Hey, I'm just gonna go and cobble together a really quick and simple database engine that just does a few very simple SQL commands, insert the lead, update and select." No joints, wasn't trying to be efficient... All I needed to do was pull stuff off of a disk in that memory.

>And I put it out there and... I've been doing open source for years before this, putting things on my website, and people would find my thing -- or well, you know, I'd put things on my website and it'd get like five downloads per year, or something like that. I'd figured this would be just another one of those things, but for whatever reason it really resonated with people.

Re:Why Is SQLite Coded in C? (2017) by burner5692 on Wednesday March 14, 2018 @11:59AM (#16585687)
> The thing is, SQLite is bulletproof at this point, so do we need to replace it?

Nothing written in C is bulletproof.

Re:Why Is SQLite Coded in C? (2017) by saagarjha on Wednesday March 14, 2018 @04:09PM (#16587859)
You're free to write bugs in any language. C just makes them easier to write or more critical.
Re:Why Is SQLite Coded in C? (2017) by kennydude on Wednesday March 14, 2018 @11:28AM (#16585408)
OpenSSL was thought to be "bulletproof" and the "go to" option. And look where we are now
Re:Why Is SQLite Coded in C? (2017) by jcranmer on Wednesday March 14, 2018 @11:51AM (#16585623)
SQLite has a much more thorough testing process than OpenSSL did. Their acceptance tests have 100% MC/DC coverage [1], for example. While previous things like the IOC tester did find issues with SQLite, SQLite is very aggressive about including these sorts of tools into their ongoing testing process.

[1] MC/DC coverage is a slightly more rigorous form than branch coverage. A condition if (a && b) requires that you only test one of (a false, b true) and (a false, b false) for 100% coverage, whereas MC/DC coverage would insist on both being tested.

Re:Why Is SQLite Coded in C? (2017) by nathell on Wednesday March 14, 2018 @11:31AM (#16585441)
OpenSSL has always been nowhere near the level of robustness and bulletproofness that SQLite is at. Just look at how it's tested: https://www.sqlite.org/testing.html
Re:Why Is SQLite Coded in C? (2017) by vbezhenar on Wednesday March 14, 2018 @11:39AM (#16585515)
It's too bad some part of tests are proprietary. I think it someone would want to rewrite SQLite (keeping compatibility), those tests would be of huge value.
Re:Why Is SQLite Coded in C? (2017) by krylon on Wednesday March 14, 2018 @12:48PM (#16586110)
Yes, but that is also a source of funding for the project.
Re:Why Is SQLite Coded in C? (2017) by jeremiep on Wednesday March 14, 2018 @11:40AM (#16585524)
And how many more critical flaws would OpenSSL have if people kept rewriting it in the trending language of the week?

Rewriting just for the sake of rewriting or because you like another language better is an almost certain recipe for disaster.

Re:Why Is SQLite Coded in C? (2017) by jagger27 on Wednesday March 14, 2018 @11:42AM (#16585545)
I have a hard time believing this. It was common knowledge and lamented before Heartbleed that OpenSSL was bloated an unwieldy. People were surprised by the severity, not that it happened.
Re:Why Is SQLite Coded in C? (2017) by Sir_Cmpwn on Wednesday March 14, 2018 @11:33AM (#16585468)
I don't think this comparison is fair. SQLite is widely regarded as one of the best codebases in the world and it has 100% test coverage.
Re:Why Is SQLite Coded in C? (2017) by sidlls on Wednesday March 14, 2018 @11:44AM (#16585561)
That level of test coverage isn't as meaningful as people think. I'd bet that a significant fraction (> 10%) of those tests are redundant or cost more (in terms of maintenance, for one example) than the value they provide.
Re:Why Is SQLite Coded in C? (2017) by Sir_Cmpwn on Wednesday March 14, 2018 @11:51AM (#16585615)
I think you should read the full write-up on sqlite testing:

https://www.sqlite.org/testing.html

There's no question that sqlite is one of the most well understood and reliable codebases in the world.

Re:Why Is SQLite Coded in C? (2017) by saagarjha on Wednesday March 14, 2018 @04:10PM (#16587867)
OpenSSL is known to have a poorly documented, spaghetti codebase. The same is not true for SQLite.
Re:Why Is SQLite Coded in C? (2017) by protomyth on Wednesday March 14, 2018 @04:54PM (#16588206)
Bob Beck during his LibreSSL talk had a good overview of what was thought of OpenSSL https://youtu.be/GnBbhXBDmwU?t=2m11s

"we are all guilty"

Re:Why Is SQLite Coded in C? (2017) by d33 on Wednesday March 14, 2018 @11:32AM (#16585459)
I suspect there's a huge code quality difference between OpenSSL and SQLite. Also, keep in mind that SQLite was much easier to fuzz - it's basically one of the libraries that AFL has specific features for (dictionary-based coverage-guided fuzzing).
Re:Why Is SQLite Coded in C? (2017) by IncRnd on Wednesday March 14, 2018 @11:39AM (#16585516)
OpenSSL was never thought to be bulletproof. It is, however, the best of the worst for many scenarios.
Re:Why Is SQLite Coded in C? (2017) by lghh on Wednesday March 14, 2018 @11:32AM (#16585450)
But it was bulletproof until proven otherwise.