Comment by cryptonector

1 year ago

That was my take when LibSQL was announced. And it still is and would be my take if LibSQL remains C-coded. But a Rust-coded rewrite of SQLite3 or LibSQL is a different story.

The SQLite3 business model is that SQLite3 is open source but the best test suite for it is proprietary, and they don't accept contributions to any of either. This incentivizes anyone who needs support and/or new features in SQLite3 to join the SQLite Consortium. It's a great business model -- I love it. But there are many users who want more of a say than even being a consortium member would grant them, and they want to contribute. For those users only a fork would make sense. But a fork would never gain much traction given that test suite being proprietary, and the SQLite3 team being so awesome.

However, a memory-safe language re-implementation of SQLite3 is a very different story. The U.S. government wants everyone to abandon C/C++ -- how will they do this if they depend on SQLite3? Apart from that there's also just a general interest and need to use memory-safe languages.

That said, you're right that there are many other projects that call for a rewrite in Rust way before SQLite3. The thing is: if you have the need and the funding, why wouldn't you rewrite the things you need first? And if SQLite3 is the first thing you need rewritten, why not?

>> The SQLite3 business model is that SQLite3 is open source

This is going to sound pedantic, but SQLite is not Open Source. It's Public Domain. The distinction is subtle, but it is important.

  • >This is going to sound pedantic, but SQLite is not Open Source. It's Public Domain.

    Well, there are 2 different modes of communication:

    (1) official language-lawyer pedantic communication: "open source" != "public domain"

    (2) conversational casual chitchat : "open source" includes "public domain"

    Yes, the SQLite home page does say "public domain". However, when people interview SQLite create, Richard Hipp, he himself calls it "open source". He also doesn't correct others when they also call it "open source". Excerpt of R Hipp:

      So, I thought, well, why can't I have a database that just
      reads directly off the disc? And I looked around and
      there were none available. I thought, “oh, I'll just write
      my own, how hard can that be?” Well, it turns out to be
      harder than you might think at first, but I didn't know
      that at the time. But we got it out there and I just put it
      out as open source. And before long, I started getting
      these phone calls from the big tech companies of the
      day, like Motorola and AOL, and, “Hey, can you
      support this?”, and “Sure!” And it's like, wow, you can
      make money by supporting open source software?
    

    https://sigmodrecord.org/publications/sigmodRecord/1906/pdfs...

    • > (2) conversational casual chitchat : "open source" includes "public domain"

      it's wrong though. like, can't be more wrong than that. you can't do whatever you want with open source software, the license tells what you can and cannot do.

      with public domain software you can do most things.

      5 replies →

    • > conversational casual chitchat : "open source" includes "public domain"

      No. What are you talking about? They are not related... other than for people virtually completely new to, well, open source.

      You are also completely confused, here, too:

      > Yes, the SQLite home page does say "public domain". However, when people interview SQLite create, Richard Hipp, he himself calls it "open source". He also doesn't correct others when they also call it "open source".

      They are different things. A project can be both; a person can talk about these two aspects of one project.

      2 replies →

  • It's a difference only insofar that in many jurisdictions their claim that it's public domain has no legal value. If it was truly public domain (e.g. if the authors were long dead) it would be open source. But far from all places allow you to arbitrarily put things in the public domain.

    I'm a bit puzzled why SQLite doesn't solve this trivial issue by claiming the code is CC0-licensed. CC0 is made just for that: a very wordy way to make it as close to public domain as possible in each jurisdiction.

    On the other hand, hobbyists won't care. As long as you trust them in their intention to have it open source they won't sue you for infringement either. And if as a company you need more assurance than "it's public domain" they are so nice to sell you a fancy legally-satisfying piece of paper for an undisclosed price. It's a subtle but clever way to get income from users with too much money

  • > It's Public Domain.

    Is it though? The website does say "All of the code and documentation in SQLite has been dedicated to the public domain by the authors" but copyright law has no exception for "dedications" to the public domain. At best the authors are estopped from bringing suit but even that is unclear.

    • Companies can buy licences if they're uncomfortable with the Public Domain dedication:

      [quote]

      Licenses are available to satisfy the following needs:

          * You want indemnity against claims of copyright infringement.
          * You are using SQLite in a jurisdiction that does not recognize the public domain.
          * You are using SQLite in a jurisdiction that does not recognize the right of authors to dedicate their work to the public domain.
          * You want to hold a tangible legal document as evidence that you have the legal right to use and distribute SQLite.
          * Your legal department tells you that you have to purchase a license.
      

      [end quote]

      https://www.sqlite.org/purchase/license

      1 reply →

  • open source != Open Source. If I had meant the latter I would have written Open Source, but I wrote open source because I meant the former.

    How's that for being pedantic?

    • not helpful.

      capitalization is not bearing meaning in these contexts.

      open source means OSI compliant, broadly speaking, and licensed as such.

      in contrast, public domain doesn't exist in some jurisdictions, which is why sqlite as a company had to create an option to provide an official license. which they found so annoying that they charged a sweet fee to send a signed printed letter...

      1 reply →

  • Details if anyone is interested: https://opensource.org/blog/public-domain-is-not-open-source

    • They don't own the words "open source" no matter how much they might like to.

      > “Open Source” describes a subset of free software that is made available under a copyright license approved by the Open Source Initiative as conforming with the Open Source Definition.

      No it doesn't. It describes software whose source is "open" which is generally understood to mean that you can read, modify and reuse the code for free.

      Public domain definitely fits that. The "public domain doesn't exist in some countries" arguments are spurious as far as I can tell.

  • Public domain is a form of open source.

Bugs are fixed along with regression tests. Here's a recent example: https://www.sqlite.org/src/info/289daf6cee39625e

As far as I can see, these tests come with the same public domain dedication as the rest of the code.

You may be referring to the TH3 tests (https://sqlite.org/th3.html). The main goal (100% branch coverage, 100% MC/DC) would not be achievable for a Rust implementation (or at least an idiomatic Rust implementation …) because of the remaining dynamic run-time checks Rust requires for safety.

  • sqlite also has some runtime checks that are expected to be always true or always false, and solves that by using a custom macro that removes these branches during branch coverage test.

    The same would be possible in Rust. Everything that could panic has a non-panicking alternative, and you could conditionally insert `unreachable_unchecked()` to error handling branches to remove them. That wouldn't be most idiomatic, but SQLite's solution is also a custom one.

> The SQLite3 business model is that SQLite3 is open source but the best test suite for it is proprietary

no.

the business model is services, and a red phone to companies who use sqlite in production. like nokia back in the days when we had these little flip phones, or desk phones had a "rolodesk" built in, or many other embedded uses of a little lovely dependable data store.

the services include porting to and "certification" on specifically requested hardware and OS combinations, with indeed proprietary test suites. now these are not owned by sqlite, but by third parties. which license them to sqlite (the company).

and it started with being paid by the likes of nokia or IBM to make sqlite production ready, add mc/dc coverage, implement fuzzing, etc etc etc.,

their license asks you to do good not evil. and they take that serious and try their best to do the same. their own stuff is to an extreme extend in the public domain.

  • > companies who use sqlite in production

    It's not just old Nokias or desktop phones, nor just embedded sytsems. sqlite is almost everywhere. Adobe, Apple, Microsoft, Google, Mozilla and many other companies use it in very widely deployed software.

  • > > The SQLite3 business model is that SQLite3 is open source but the best test suite for it is proprietary

    > no.

    > the business model is services, and a red phone to companies who use sqlite in production. like nokia back in the days when we had these little flip phones, or desk phones had a "rolodesk" built in, or many other embedded uses of a little lovely dependable data store.

    Members of the SQLite Consortium surely have this "red phone" you speak of. So in what way was my characterization of their business model wrong?

> The U.S. government wants everyone to abandon C/C++

That's the position of two federal agencies, namely, FBI and CISA. They don't describe how this change will reduce CVEs or why the languages they prefer still produce projects with CVEs.

I don't particularly hold the technical or social acumen of FBI or CISA in particularly high regard and I'm not sure why anyone would by default either. Mostly because they say things like "switch to python!" without once accounting for the fact that python is written in C.

It's an absurd point to invoke as a defense of this idea.

Why does the fork have to gain traction?

You keep and maintain your local fork that does what you need it to do. perhaps if you are charitable you share it with others. but you don't need to do this. and it just adds support burden.

  • If you don't care about traction then you wouldn't seek press for your fork to begin with. TFA is clearly seeking traction.

Also the very rigid testing makes the rewrite a lot easier to validate.

  • ...as long as you can persuade the keepers of the proprietary test suite to agree to run it against your code.

    • Even without that, it’s helpful. It means there is less (no?) undefined behavior that you will need to emulate to maintain compatibility. You can just follow the spec.

      2 replies →

> The U.S. government wants everyone to abandon C/C++ -- how will they do this if they depend on SQLite3?

ABI, the same way you don't need the Linux kernel to be rewritten to remove your app dependency on C/C++

Just stumbled onto this forum. Really, appreciated such a thoughtful and insightful comment. Nice corner of the internet you have here.

  • Welcome to HN! (I'm a mod here.) I'm curious—how did you find us?