I have been sending small fixes to uutils, the Rust rewrites of coreutils, findutils, sed and procps. The way I find the bugs is simple: record how the GNU tool behaves on a few hundred cases (stdout, stderr, exit code, files it touches), then replay the same cases against the uutils build and read the diffs.

The write-up is about what that turned up. Almost nothing was a crash. It was error message wording, option parsing edge cases like a bare - being eaten as an option value, exit codes, and a few GNU version differences that look like bugs but are really version pins.

So far that is 44 bug reports and 51 fix PRs upstream, 34 of them merged. The recorder is a small open source tool I wrote: https://github.com/emirmrkaljevic/behave

Happy to hear how others test rewrites for compatibility.

  • INeedMana@piefed.zip
    link
    fedilink
    English
    arrow-up
    1
    ·
    4 days ago

    You can keep the loop as it is. My point is, you could have used existing tools for extraction and confirmation of behavior instad of reinventing the wheel

    • emirmrkaljevic@programming.devOP
      link
      fedilink
      arrow-up
      2
      ·
      3 days ago

      Fair enough. Before writing it I looked at expect/autoexpect and the usual golden-test tools, and none of them generated the cases from --help and the man page or diffed a second binary against the recording, which was the part I needed. If there is an existing tool that does that, I’d honestly like to know, I’d rather use it than maintain my own.