Skip to content

expr: replace onig with fancy-regex - #14329

Open
wtcpython wants to merge 1 commit into
uutils:mainfrom
wtcpython:expr-replace-onig
Open

expr: replace onig with fancy-regex#14329
wtcpython wants to merge 1 commit into
uutils:mainfrom
wtcpython:expr-replace-onig

Conversation

@wtcpython

@wtcpython wtcpython commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Replace the onig C-dependency in expr with the pure-Rust fancy-regex crate.
This removes the onig_sys C library dependency while preserving full POSIX BRE,
backreference, multibyte UTF-8, and C locale compatibility.

Closes #1145

if is_start_of_expression {
re_string.push(curr);
} else {
match curr {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe move this into a new function?

@github-actions

github-actions Bot commented Aug 31, 2026

Copy link
Copy Markdown

Binary size comparison:

Individual binary size comparison VS main (threshold: >=5% AND >=4 KB).

Total size of compared binaries: 153.88 MB (+1.68 MB, +1.10%)

Significant per-binary changes:
  expr       2.76 MB ->    3.77 MB  (+1.01 MB, +36.49%)
  ptx        2.42 MB ->    2.56 MB  (+140 KB, +5.65%)
  csplit     2.38 MB ->    2.51 MB  (+136 KB, +5.59%)
  nl         2.35 MB ->    2.48 MB  (+136 KB, +5.66%)
  tac        2.34 MB ->    2.48 MB  (+136 KB, +5.67%)

@sylvestre

Copy link
Copy Markdown
Contributor

Binary size comparison:

Individual binary size comparison VS main (threshold: >=5% AND >=4 KB).

Total size of compared binaries: 153.89 MB (+1.70 MB, +1.12%)

Significant per-binary changes:
  expr       2.76 MB ->    3.79 MB  (+1.03 MB, +37.20%)
  ptx        2.42 MB ->    2.56 MB  (+140 KB, +5.65%)
  csplit     2.38 MB ->    2.51 MB  (+136 KB, +5.59%)
  nl         2.35 MB ->    2.48 MB  (+136 KB, +5.66%)
  tac        2.34 MB ->    2.48 MB  (+136 KB, +5.67%)

https://docs.rs/fancy-regex/latest/fancy_regex/#features

maybe we can disable some features

@wtcpython
wtcpython force-pushed the expr-replace-onig branch 3 times, most recently from ccb43d7 to 734f140 Compare August 31, 2026 13:02
@oech3

This comment was marked as resolved.

@oech3

This comment was marked as resolved.

Comment thread src/uu/expr/src/syntax_tree.rs Outdated
Comment on lines +390 to +406
&& !matches!(
curr,
'1'..='9'
| '.'
| '*'
| '^'
| '$'
| '['
| ']'
| '\\'
| 'w'
| 'W'
| 's'
| 'S'
| 'b'
| 'B'
)

This comment was marked as resolved.

This comment was marked as resolved.

Replace the onig C-dependency in expr with the pure-Rust fancy-regex crate.
This removes the onig_sys C library dependency while preserving full POSIX BRE,
backreference, multibyte UTF-8, and C locale compatibility.
@github-actions

Copy link
Copy Markdown

GNU testsuite comparison:

Skipping an intermittent issue tests/cut/bounded-memory (passes in this run but fails in the 'main' branch)
Note: The gnu test tests/dd/no-allocate is now being skipped but was previously passing.
Skip an intermittent issue tests/pr/bounded-memory (was skipped on 'main', now failing)

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.

Replace Oniguruma

3 participants