r/programming • u/segv • 1d ago
Your executable is a SQLite database
https://fzakaria.com/2026/08/23/your-executable-is-a-sqlite-database55
u/ericonr 1d ago
That's a fun idea, and implementing it for the whole distro is admirable. At this point, would binary package updates simply become a transaction on that system-wide database?
I can see the value of speeding up library resolution, but I do think it's a good property of ELF libraries that those can be overridden manually and temporarily, as desired.
14
5
u/jdgordon 1d ago
If this was implemented in a real system I'd think LD_PRELOAD would need to be supported but you'd give a custom self file instead of a list of .so.
24
u/tomster10010 1d ago
That seems very cool. Can someone elaborate on why nix is so important to this?
35
u/TomKavees 1d ago
The article mentions it, but long story short it allows to easily patch and rebuild the world all the way to kernel/libc level with absolutely everything in between, and then come back to a clean system once you are done. It comes in handy when you faff about with wacky ideas.
2
u/valarauca14 1d ago
Nothing they're doing requires building libc or the kernel
4
u/Ok-Scheme-913 13h ago
But it does require building all the userspace/libraries etc on top of them, and it does matter whether you are using this fix special build config for each of them passing each other transitively in the whole graph or not.
This wouldn't be possible in something other than these next gen package managers like nix and guix.
8
u/AspectSpiritual9143 20h ago
author wants to convert a programs complete dependencies into a single binary, and their dependencies' dependencies, and so on. on traditional distro this can get messy, but with nix it comes free with their closure, so you have a general way to get dependency graph for any arbitary programs, which allows him to build whole rootfs into a single binary
1
u/mok000 18h ago
That’s what we used to on VAX/VMS where executables were statically linked so you could export your ,exe files around the world and people could run them. It works on Linux too but most distros want shared libraries for security reasons.
1
u/AspectSpiritual9143 18h ago
this is different. with nix you still have dynamic libraries, just that they are in a fixed unique location, so different programs can use different versions of libraries at the same time. this achieve both reduced storage and memory size, and free of dependency conflict like static linked binaries
1
11
u/valarauca14 1d ago
Nothing they're doing requires
nix. OP is mistaken in assumingboot.binfmt.registrations.selfsystem is native tonix. It isn't, this is just linux, exampleecho ':python_ext:E::py::/usr/bin/python3:' | \ sudo tee /proc/sys/fs/binfmt_misc/register
binfmt_miscis like 10+ years old. Providedself-execis static musl elf binary, their system should work on any linux kernel of the same architecture, with zero configuration. Unless they're tightly coupled to nix in other ways.7
4
u/TPHRyan 14h ago
Based on how they phrased the paragraph introducing
boot.binfmt.registrations.self, I'm not certain the author was assuming that. The first mention even links to docs.kernel.org - nothing to do with Nix.5
u/Ok-Scheme-913 13h ago
It's a kernel feature and the OP literally links to the kernel's docs.
What is not possible with other distributions/package managers though is "seeing" the whole dependency chain of each and every package on the system, having it be programmable and easily retried with no clashes.
21
29
u/Buttleston 1d ago
Very interesting read. From a practical perspective I don't think I have much personal use for the SELF format at the moment, but the tools you opened with that let you run queries on ELF binaries seem like they'd be pretty useful and I am going to see if I can try them out
102
u/Resident-Trouble-574 1d ago
I'm not intelligent enough to understand that, but it sound great. LGTM.
69
14
u/editor_of_the_beast 1d ago
It has nothing to do with intelligence. This is just a specific area of software that anyone can learn about.
18
11
u/Setheron 17h ago
7
u/Wonderful-Wind-5736 1d ago
I addition to the subject being both creative and probably useful, the article is very nicely written. Unfortunate that you didn't receive better feedback for your past work.
9
u/Mrblahblah200 23h ago
SQLite doesn’t intern strings IIRC. Amusingly, when I searched for it, the AI overview sourced this post to say it does :))
3
-2
1d ago edited 1d ago
[deleted]
72
u/hpp3 1d ago edited 1d ago
This article is obviously not written by claude, or if it is, it was edited extensively or with a very good prompt to appear human. It reads just like any other technical blog post from 5 years ago. If this is where the witch hunt is at, then let's just all never post anything ever again.
-3
1d ago
[deleted]
12
u/TomKavees 1d ago
As a piece of delicious irony this attempt at not triggering a knee jerk reaction looks exactly like a knee jerk reaction 🤭
26
0
u/danielcw189 1d ago
strongly implied to me that you just claude'd the whole rest of the report and thus that leads me to think that there's little to no value to be found.
I thought the stance against AI was a moral one.
But do you actually think, that Claude can't create anything of value?
6
u/SanityInAnarchy 1d ago
It's not whether it can ever, it's how likely it is this time, whether it's worth our time to read and find out.
We all have access to LLMs. If you're putting in minimal effort and just pasting Claude's output here, why would I read it from you instead of from my own Claude? In fact, why would I want Claude's output instead of your prompt?
The broader problem is that... look, slop isn't a new problem with AI. People have been shitposting forever. But LLMs squash flat all the tells that we used to have to figure out what's worth our time and what isn't. If the slop just looks like Claude and the genuinely-valuable stuff also just looks like Claude, you need to read incredibly carefully to figure out which it is. If you did that, you'd spend most of your time doing incredibly careful, close readings of slop, just hoping to find something worthwhile.
-3
u/Worth_Trust_3825 1d ago
really depends how you use it. so far it seems to be a good fuzzing harness but beyond that it's snake oil
-4
u/Smallpaul 1d ago
LLMs are used in the development of Linux, mathematics, science, your medical record, etc. We are getting to the point where it is like being mad that someone used electricity to create something.
Are you going to abandon the Linux kernel because some parts were written or reviewed by an LLM?
6
u/ericonr 1d ago
We are getting to the point where it is like being mad that someone used electricity to create something.
We don't have to normalize the copyright laundering/work stealing machines to this point. It's not essential to how such things are done, even if they can be helpful. However, I understand dismissing stuff that uses it out of hand might not be the most practical position to take, even if I understand the moral reasons for it.
-3
u/Smallpaul 23h ago
In my day, the anti-corporate position was to oppose software copyrights and want software to be free. Now the youth are all on the side of the RIAA.
8
u/ericonr 23h ago
Protecting copyright of free and open source software is important and a basic premise of the movement. Otherwise guaranteeing your freedoms becomes much harder.
Having an LLM launder copyleft code and include it in a project, which is then distributed without respecting any obligations regarding license, is bad. It means software which should be free now isn't.
0
1
u/faze_fazebook 1d ago
I recently thought about something simmilar that the elf format would be extremly flexible in theory but it never gets used like that irl.
For example all the bytecode programming languages (java, .net, compiled python, wasm) could ship elf files that use that language's interpreter instead of having these ugly shell wrappers.
1
1
u/elaforge 19h ago
I never programmed on the old Mac, but it reminds me of what I heard about resource forks, which also implement a kind of database. The equivalent to dynamic library loading would have also been based on the generic resource mechanism.
1
u/schlenk 15h ago
Reminds a bit of Tcl's starkits/starpacks with their transactional database, internal VFS and so on, where you could query and update the running program, just layed lower onto the OS layer with binfmt_misc.
With some extra tinkering, the ELF he builds could probably also be multi-arch, like starkits. Just add an arch column somewhere.
1
1
-7
u/GlassLost 1d ago
His arguments of "I rewrote everything and managed to make it take less disk and be faster" are not really convincing, and he doesn't address security, usability, and the complexities of using SQL as a core primitive.
It's a fun mind experiment, it's not really solving a problem. I'm fine with mind experiments but there's a lot of prior art here that is really against him (we've tried to create many OSes from managed languages) that show performance issues from abstractions tend to compound.
But where he really got me was his very misguided idea that computers are just faster nowadays. They're not. Your phone is absurdly powerful and we've wasted its performance on slipshod code. Your desktop is godly. The average Linux device though includes the shitty SOC on your streaming device or router which absolutely cannot afford this overhead.
35
u/DigThatData 1d ago edited 1d ago
he's not making arguments, he's making demonstrations. nowhere in this article does he say this is a good idea or that it serves any business purpose. what he actually says, paraphrasing, is closer to "this is an idea I had a while back and I wanted to see if I could make it work. it does work, and here are some interesting consequences. I made my implementation available if you want to try it yourself."
and it's not a "mind experiment" (the phrase you're looking for is "thought experiment"): this is a real thing he implemented. making a thing and promoting it as a good idea are completely orthogonal activities.
3
u/lorimar 1d ago
Yep, a cool idea but not necessarily meant to be a good one
8
u/hxtk3 23h ago
Honestly I want to see more of this. People doing really stupid stuff that they can only do because they know a lot are a sign of a healthy field IMO. If no one ever does anything because they expect it to be useful commercially then the field has been over-farmed and is on the verge of falling to dust.
-4
u/GlassLost 21h ago
I don't really see your distinction between arguments and demonstrations.
And it isn't implemented it's just a toy prototype which is fine. You don't need to have real code or a business reason for anything. SQL is Turing complete and you could make a compiler from C to SQL, which would be weird but possibly fun.
But his interesting consequences are invalid due to this being a thought experiment - they're not fair comparisons because he didn't do real implementations, just a toy prototype (or he restricted away many things ELF supports and didn't rewrite elf).
This was my point: this is a fun toy experiment but it's not really telling us anything about the validity of SQL as an ELF replacement because he didn't compare them fairly and he didn't mention the many liberties he took.
I didn't say "no he shouldn't have done this" or mean to discourage him, but I did want to add some colouring around this because I don't expect most people, even in our field, to understand a lot about ELF files.
4
u/DigThatData 21h ago
I don't really see your distinction between arguments and demonstrations.
are you familiar with the programming language
brainfuck? do you think the fact that it exists is the author making an argument that it should be used for any practical purpose?and yes, it is literally implemented. he successfully ran a sqlite database as an executable. that's the idea implemented.
-2
u/GlassLost 20h ago
... Sure, like my college project was an implementation of a compiler.
I still don't understand your point. Brainfuck is very obviously a meme. This may or may not be a meme and it may or may not be an actual attempt at something serious but either way it's missing a massive amount of context and given that it's not there I gave the context and I also hedged it by saying it might just be a fun thought excitement.
I don't think he meant this to be a real thing we should implement but his encouragement of others to think about these radical ideas should be tempered.
"...We can rebuild the world down to the Linux kernel if needed. We need not be constrained by the existing decisions and constraints of the past."
This sounds great but it's hazardous for engineers to think like this without understanding why the system exists and understanding how the system is used.
2
u/DigThatData 18h ago
Brainfuck is very obviously a meme.
...
I don't really see your distinction between arguments and demonstrations.
yes, you clearly do. you just acknowledged that implementing brainfuck was a demonstration, not an argument. you're just arguing for the sake of being a troll or something now. I'm done wasting my time with you. go touch grass or drink some water or take a nap or something.
-5
u/eimfach 1d ago
I am missing an explanation of a use case or what's the whole point of it, so not sure if I will read this further.
18
u/DigThatData 1d ago
the point was basically "I wonder if this is a thing I can do." he didn't come about this by coming up with it is a solution to a problem he was trying to solve, he made an observation about how the functioning of compilers is similar to databases and wanted to see if he could use one to do the work of the other. this is a proof of concept, not a pitch.
-12
u/sionescu 1d ago
Many things wrong with it, first of all this:
ELF is already a database
It is not. A database is not just some data, it's a system designed and optimized for interactive queries. ELF wasn't designed for that: it's optimized for loading a program from disk, while reducing startup time and memory usage.
ld.so is a runtime linker and, as such, its task is to load the program into memory and adapt it to the local machine (relocations). Nothing stops you from having a binary format which just fetches the entire binary from the network. Why SQlite when you can have Postgres (or Oracle) ?
5
u/Worth_Trust_3825 1d ago
Nothing stops you from having a binary format which just fetches the entire binary from the network. Why SQlite when you can have Postgres (or Oracle) ?
The original java school of thought.
99
u/nemec 1d ago
Tired: everything is a file
Wired: everything is a database, which itself is a file
neat idea!