Skip to content

Feat sdiff initial with parser#187

Open
GunterSchmidt wants to merge 6 commits intouutils:mainfrom
GunterSchmidt:feat--sdiff-inital-with-parser
Open

Feat sdiff initial with parser#187
GunterSchmidt wants to merge 6 commits intouutils:mainfrom
GunterSchmidt:feat--sdiff-inital-with-parser

Conversation

@GunterSchmidt
Copy link

@GunterSchmidt GunterSchmidt commented Mar 3, 2026

This is a first version of sdiff.

It implements the a new, fully working parser for the arg options, which also can easily be implemented for the other utils.
While it does not implement any functionality to compare the files, the parser is finished (pending bugs). This allows any developer to start working on the compare functionality with the prefilled Param struct having the options set.

The 'sdiff' seems to work largely identical to 'diff', with a different layout in the output. Code sharing should be possible.

The parser is written generically so it can be used in all diffutils tools. I already have a version for cmp as well.
After discarding clap as tool, as the requirements are very individual and would require extensive tweaking of the clap functionality.

There are a number of cases where the current parser does not yield the same results as GNU cmp, for instance 'cmp file_1 file_2 -bln50KiB'.

Since 'sdiff' does not exist yet, this is pure additional code. It also contains a help and version text, which needs to be finalized after discussion so no copyright infringement is taking place. I already reformulated some of the text.

I originally wanted to implement 'clap', but after some investigation I found the requirements of diffutils highly individual and it would require extensive tweaking of the clap functionality.

Relates to #16 and #97.

Gunter Schmidt added 4 commits March 1, 2026 22:37
fix: bumped up tempfile to "3.26.0"

The variables for --bytes, --ignore-initial and line count where size 'usize',
thus limiting the readable bytes on 32-bit systems.
GNU cmp is compiled with LFS (Large File Support) and allows i64 values.

This is now all u64, which works also on 32-bit systems with Rust.
There is no reason to implement a 32-bit barrier for 32 bit machines.

Additionally the --bytes limit can be set to 'u128' using the feature
"cmp_bytes_limit_128_bit".

The performance impact would be negligible, as there only few calculations
each time a full block is read from the file.
also add fn executable to DiffUtility
@codecov
Copy link

codecov bot commented Mar 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.00%. Comparing base (6f082c6) to head (d57b0c5).

Additional details and impacted files
@@     Coverage Diff     @@
##   main   #187   +/-   ##
===========================
===========================

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This is now a good option parser and has basic sdiff compare functionality. This is a good base for further development.
@GunterSchmidt
Copy link
Author

Merged sdiff logic from PR #159.

This is now a good option parser and has basic sdiff compare functionality. This is a good base for further development.

I suggest to merge #159 first to give @zxvfc credit. I then can update my PR as the changes are small.

@GunterSchmidt GunterSchmidt changed the title Feat sdiff inital with parser Feat sdiff initial with parser Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant