<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Lucas Cañete</title>
    <description>The latest articles on DEV Community by Lucas Cañete (@lexluthorprimero).</description>
    <link>https://dev.to/lexluthorprimero</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4241963%2Fafe809a2-6752-4206-9be6-e689131e9ec7.jpg</url>
      <title>DEV Community: Lucas Cañete</title>
      <link>https://dev.to/lexluthorprimero</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/lexluthorprimero"/>
    <language>en</language>
    <item>
      <title>I reconstructed filenvercmp from disassembly — and it passed 34,145/34,145 after failing 791. Here's how.</title>
      <dc:creator>Lucas Cañete</dc:creator>
      <pubDate>Fri, 13 Nov 2026 00:45:07 +0000</pubDate>
      <link>https://dev.to/lexluthorprimero/i-reconstructed-filenvercmp-from-disassembly-and-it-passed-3414534145-after-failing-791-12ao</link>
      <guid>https://dev.to/lexluthorprimero/i-reconstructed-filenvercmp-from-disassembly-and-it-passed-3414534145-after-failing-791-12ao</guid>
      <description>&lt;h1&gt;
  
  
  I reconstructed &lt;code&gt;filenvercmp&lt;/code&gt; from disassembly — and it passed 34,145/34,145 after failing 791
&lt;/h1&gt;

&lt;p&gt;For the last weeks I've been rebuilding GNU coreutils &lt;code&gt;filenvercmp&lt;/code&gt; by hand from disassembly (no source code). The function is inside &lt;code&gt;/usr/bin/ls&lt;/code&gt; and handles version-aware sorting — the reason &lt;code&gt;ls -v&lt;/code&gt; orders &lt;code&gt;file1.2&lt;/code&gt;, &lt;code&gt;file1.9&lt;/code&gt;, &lt;code&gt;file1.10&lt;/code&gt; in the right order.&lt;br&gt;
This post is about how the differential-verification method worked for me, what failed, and why it matters for people who love low-level systems.&lt;br&gt;
I built two sealed corpora (34,145 pairs each, one per seed). The oracle was the native binary itself via &lt;code&gt;mmap&lt;/code&gt; (read-only). The reconstruction initially "passed" 32,000 synthetic cases, then failed 791. After debugging the exact mismatch classes (digit-run semantics, extension-chain handling, &lt;code&gt;~&lt;/code&gt; ordering, end-of-string sentinels), it passed the final matrices: 0/34,145 divergences across 2 independent generations.&lt;/p&gt;

&lt;h2&gt;
  
  
  I built two sealed corpora
&lt;/h2&gt;

&lt;p&gt;The corpora are mine — those are 34,145 pairs of filenames each (one per generation), sealed with SHA-256 before generating the matrix. The oracle is the native binary itself (&lt;code&gt;/usr/bin/ls&lt;/code&gt; mmap'd, read-only) — every line of &lt;code&gt;matrix_native.txt&lt;/code&gt; is one integer per case: the exact return value of the native function on that pair of names.&lt;br&gt;
The harness is 200 lines of C. It reads both files and compares the reconstruction against the native answer byte-by-byte. Tolerance zero.&lt;/p&gt;

&lt;h2&gt;
  
  
  What failed, and why it's interesting
&lt;/h2&gt;

&lt;p&gt;My first reconstruction "passed" 32,400 cases and was wrong. The mismatch rate with a larger corpus was ~3.4% — believable symptoms: &lt;code&gt;.&lt;/code&gt; inside names, extension chains, &lt;code&gt;~~&lt;/code&gt;, trailing digits with leading zeros, empty sides, UTF-8 bytes.&lt;br&gt;
None of those were caught by random testing — only by a dense corpus targeting the actual discriminators. The fix took multiple iterations (791 → 97 → 86 → 0).&lt;/p&gt;

&lt;h2&gt;
  
  
  What got verified and what didn't
&lt;/h2&gt;

&lt;p&gt;Verified (my host, my UID, my model):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;filenvercmp / verrevcmp / file_prefixlen: 0 divergences across 2 generations (2 × 34,145)&lt;/li&gt;
&lt;li&gt;wc (the full &lt;code&gt;wc&lt;/code&gt; behavior, default flags + &lt;code&gt;-c&lt;/code&gt;/&lt;code&gt;-l&lt;/code&gt;/&lt;code&gt;-w&lt;/code&gt;/&lt;code&gt;-L&lt;/code&gt; combinations): 0 divergences across 6 corpora (~37,000 cases), both &lt;code&gt;LC_ALL=C&lt;/code&gt; and &lt;code&gt;es_AR.utf8&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Byte-audit of all 256 byte classes in LC_ALL=C; NBSP (0xa0) discovered as a separator — found via the discriminating corpus, not by assumption
Not verified (honest):&lt;/li&gt;
&lt;li&gt;third-party verification — nobody independent has run the harness yet. That's the actual missing piece.&lt;/li&gt;
&lt;li&gt;port 1:1 of the LSM from disassembly — the reconstruction is semantic-equivalent, verified by differential testing, not by instruction-level identity.&lt;/li&gt;
&lt;li&gt;No PASS claim for any engine or project beyond these artifacts.
## Please reproduce, or refute — both are valuable
If you can run 4 commands, you can independently verify this. The package has everything you need:
git clone &lt;a href="https://github.com/LexLuthorPrimero/rxre-cleanroom.git" rel="noopener noreferrer"&gt;https://github.com/LexLuthorPrimero/rxre-cleanroom.git&lt;/a&gt;
cd rxre-cleanroom
sha256sum -c SHA256SUMS
gcc -std=c11 -Wall -Wextra -Werror -O2 -o verify2 src/filenvercmp.c harness/verify2.c
./verify2 oracle/cases_seed20261112.txt oracle/matrix_native.txt
./verify2 oracle/cases_seed20261113.txt oracle/matrix_native_20261113.txt
Expected: &lt;code&gt;total=34145 mismatches=0&lt;/code&gt; twice.
Also maybe interesting: &lt;code&gt;/usr/bin/wc&lt;/code&gt; reconstructed the same way, verified on two locales and multiple corpora.&lt;/li&gt;
&lt;li&gt;Repo: &lt;a href="https://github.com/LexLuthorPrimero/rxre-cleanroom" rel="noopener noreferrer"&gt;https://github.com/LexLuthorPrimero/rxre-cleanroom&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Issue #1 for reporting: &lt;a href="https://github.com/LexLuthorPrimero/rxre-cleanroom/issues/1" rel="noopener noreferrer"&gt;https://github.com/LexLuthorPrimero/rxre-cleanroom/issues/1&lt;/a&gt;
## Why I'm posting
Because I'm not allowed to verify myself — the project's own closure rule requires third-party verification, and asking strangers to help is the only honest way to close it. If you've ever wondered how to trust an AI-generated binary reconstruction, this is an opportunity to witness the closure protocol.
One verified result ("it works on my machine too") would be invaluable — both to make the project real, and to set a precedent for open-source AI-assisted verification pipelines.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>reverseengineering</category>
      <category>gnu</category>
      <category>linux</category>
      <category>c</category>
    </item>
  </channel>
</rss>
