Repository navigation
Rust sed 0.3.0 Release:
We are happy to announce the release of Rust sed 0.3.0.
The GNU-specific commands F, W and R are now implemented. Most of the remaining work went into the details scripts actually depend on: how n and Q end a cycle, when text queued by a, r and R is written or dropped, how l shows an empty pattern space, and how -i treats each file as a separate input.
Diagnostics were reworked as well: errors now follow the modern style used by Rust Coreutils, point at the right position in the script (even at its very end), and report where an unmatched { was opened.
At a terminal, the offending character is underlined in the script. Here is the same typo with both implementations:
GNU sed 4.9:
$ sed 's/foo/bar/gq' file.txt
sed: -e expression #1, char 12: unknown option to `s'Rust sed 0.3.0:
$ sed 's/Normandie/Bretagne/gq' fromages.txt
sed: <script argument 1>:1:23: error: invalid substitute flag: 'q'
╭─[ <script argument 1>:1:23 ]
│
1 │ s/Normandie/Bretagne/gq
│ ─
───╯Test in the playground: https://uutils.org/playground/?cmd=sed+%27s%2FNormandie%2FBretagne%2Fgq%27+fromages.txt
GNU sed reports an unknown option somewhere in the s command. We name the faulty flag, give the line and column, and show where it is. Pipes keep the single-line message; set UUTILS_DIAG=always to force the full output.
We are now at 18 passing, 39 failing, 0 errors on the GNU sed test suite.
GNU Test Suite Compatibility:
| Result | 0.2.0 | 0.3.0 | Change 0.2.0 to 0.3.0 | % Total 0.2.0 | % Total 0.3.0 | % Change 0.2.0 to 0.3.0 |
|---|---|---|---|---|---|---|
| Pass | 14 | 18 | +4 | 21.54% | 27.69% | +6.15% |
| Skip | 10 | 8 | -2 | 15.38% | 12.31% | -3.07% |
| Fail | 41 | 39 | -2 | 63.08% | 60.00% | -3.08% |
| Error | 0 | 0 | 0 | 0% | 0% | 0% |
| Total | 65 | 65 | 0 |
Note: four tests now pass:
cmd-R,distrib,inplace-holdandstdin-prog. The CI now also generates the multibyte locales the suite needs, sotitle-caseandutf8-ruare no longer skipped; they run and fail for now, which is why the failure count only drops by two. Counting only the tests that actually run, we are at 18/57 (31.6%), up from 14/55 (25.5%). We are comparing against GNU sed from its upstream repository.
Highlights:
-
New GNU Commands
F: print the current input file nameW: write the first line of the pattern space to a fileR: read one line from a file and queue it for output
-
GNU Compatibility
ncontinues with the next command instead of starting a new cycleQdiscards text queued bya,randR, and no longer writes a missing final newline- Appended text,
Rtext andeoutput are written at the same point as in GNU sed lshows an empty pattern space as$, even without a trailing newline; Unicode listing matches GNU sed-itreats each file as a separate input, and takes its suffix only when attached (-i.bak), as GNU sed does- A range whose numeric first address was already passed now starts, as GNU sed does
-
Diagnostics
- Error messages use the modern style of Rust Coreutils
- The script position is kept for errors at the end of the script
- An unmatched
{reports where it was opened - An unterminated
sorycommand is reported instead of aborting - At a terminal, the offending character is underlined in the script (see the example above)
-
Robustness
- Panics and zero steps fixed in
~and,addresses
- Panics and zero steps fixed in
-
Performance
- Literal regex needles are stored in an
Arc, avoiding copies
- Literal regex needles are stored in an
-
Distribution
cargo binstallsupport- Extensions and incompatibilities are now documented in
docs/src/extensions.md
-
Contributions: This release landed 57 pull requests from 5 new contributors
Call to Action:
Sponsor us on GitHub to accelerate development: github.com/sponsors/uutils
What's Changed
New Commands
- Support F (output filename) command by @dspinellis in #528
- Implement GNU W (write pattern first line) command by @dspinellis in #531
- Implement GNU R (read one line from file) command by @Jorge-Polanco-Roque in #544
GNU Compatibility
- Make Unicode listing GNU-sed compatible by @dspinellis in #537
- in-place editing: treat each file as a separate input by @SichenLiang in #569
- sed: take the
-isuffix only when attached, as GNU sed does by @DePasqualeOrg in #583 - sed: continue with the next command after n instead of starting a new cycle by @DePasqualeOrg in #592
- sed: show an empty pattern space as $ in l, even without a newline by @DePasqualeOrg in #595
- sed: discard text queued by a, r and R on Q, as GNU sed does by @DePasqualeOrg in #594
- sed: write appended text, R text and e output as GNU sed does by @DePasqualeOrg in #589
- sed: start a range whose numeric first address was already passed by @sap1110 in #581
- sed: don't write a missing final newline on Q, as GNU sed does by @DePasqualeOrg in #597
Diagnostics & Robustness
- sed: fix panics and zero steps in ~ and , addresses by @sylvestre in #578
- sed: keep script position for errors at end of script by @sylvestre in #579
- sed: implement modern diagnostic like coreutils by @sylvestre in #576
- compiler: report an unterminated s or y command instead of aborting by @SichenLiang in #571
- sed: report where an unmatched { was opened by @sylvestre in #580
Performance
- perf: fast_regex: store literal needles in an Arc by @Omkar-Wagholikar in #604
Testing
- Fix failing test under Windows by @dspinellis in #529
- Add tests for non-pattern-print on deletion by @dspinellis in #535
Code Quality & Cleanup
- clippy: fix warnings from
assert_is_emptylint by @cakebaker in #588
CI & Build
- Add binstall support by @sylvestre in #520
- ci: generate multibyte locales for the GNU testsuite by @sylvestre in #539
- ci: use an absolute LLVM_PROFILE_FILE path so coverage includes the sed binary by @DePasqualeOrg in #591
- ci.yml: avoid full git clone (--depth=1) by @oech3 in #600
Documentation
- docs: move extensions and incompatibilities to docs/src/extensions.md by @sylvestre in #575
Dependency Updates
- Update Rust crate ctor to v1.0.13 by @renovate[bot] in #521
- Update Rust crate clap_mangen to v0.3.3 by @renovate[bot] in #523
- Update dawidd6/action-download-artifact action to v23 by @renovate[bot] in #524
- Update Rust crate similar to v3.2.0 by @renovate[bot] in #526
- fix(deps): refactor sha2 package configuration by @xtqqczze in #534
- Update dawidd6/action-download-artifact action to v24 by @renovate[bot] in #536
- Update Rust crate uucore to 0.11.0 by @renovate[bot] in #546
- Update Rust crate uufuzz to 0.11.0 by @renovate[bot] in #547
- Update Rust crate uutests to 0.11.0 by @renovate[bot] in #548
- Bump
getrandomfrom0.4.2to0.4.3by @cakebaker in #554 - Bump
chacha20from0.10.0to0.10.2by @cakebaker in #553 - Update Rust crate console to v0.16.6 by @renovate[bot] in #555
- Update Rust crate uufuzz to 0.12.0 by @renovate[bot] in #563
- Update Rust crate divan to v5.0.2 by @renovate[bot] in #561
- Update Rust crate uucore to 0.12.0 by @renovate[bot] in #562
- Update Rust crate uutests to 0.12.0 by @renovate[bot] in #564
- Update Rust crate rand to v0.10.3 by @renovate[bot] in #566
- Bump
cargo-distfrom0.30.3to0.33.0by @cakebaker in #556 - Update Rust crate clap to v4.6.7 by @renovate[bot] in #558
- Update Rust crate clap_complete to v4.6.11 by @renovate[bot] in #559
- Update Rust crate rustix to v1.1.5 by @renovate[bot] in #560
- Update dawidd6/action-download-artifact action to v25 by @renovate[bot] in #572
- Update dawidd6/action-download-artifact action to v26 by @renovate[bot] in #582
- Update dawidd6/action-download-artifact action to v27 by @renovate[bot] in #584
- build(deps): update rust crates by @xtqqczze in #586
- Remove unused
chronoby @cakebaker in #587 - Update Rust crate libc to v0.2.190 by @renovate[bot] in #593
- chore(deps): update rust crate sha2 to v0.11.1 by @renovate[bot] in #601
- chore(deps): update rust crate divan to v5.0.3 by @renovate[bot] in #603
- chore(deps): update rust crate libc to v0.2.191 by @renovate[bot] in #605
Version Management
- prepare version 0.3.0 by @sylvestre in #573
New Contributors
- @Jorge-Polanco-Roque made their first contribution in #544
- @SichenLiang made their first contribution in #569
- @DePasqualeOrg made their first contribution in #583
- @sap1110 made their first contribution in #581
- @Omkar-Wagholikar made their first contribution in #604
Download sed 0.3.0
| File | Platform | Checksum |
|---|---|---|
| sed-aarch64-apple-darwin.tar.xz | Apple Silicon macOS | checksum |
| sed-x86_64-apple-darwin.tar.xz | Intel macOS | checksum |
| sed-x86_64-pc-windows-msvc.zip | x64 Windows | checksum |
| sed-aarch64-unknown-linux-gnu.tar.xz | ARM64 Linux | checksum |
| sed-x86_64-unknown-linux-gnu.tar.xz | x64 Linux | checksum |
| sed-x86_64-unknown-linux-musl.tar.xz | x64 MUSL Linux | checksum |
Full Changelog: 0.2.0...0.3.0