uutils / uutils/coreutils

`ptx`: Do not use regex when -W options is not provided

Open
#3,142 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

U - ptx wontfix
Dominant language
Rust
Stars
24.1k
Forks
2k
Avg merge
1d 5h
Merged PRs (30d)
365

Description

ptx rely on regex even when -W option is not provided.
https://github.com/uutils/coreutils/blob/65467ab317d885e14385aa0ff6bb55720160cc88/src/uu/ptx/src/ptx.rs#L118-L141

ptx should break words based on 8-bits charset when gnu extension is enabled or based on [' ', '\t', '\n'] chars when gnu extension is disabled, but don't use regex when -W is not specified.

Ref:
gnu ptx

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/uu/ptx/src/ptx.rs around lines 118-141 and compare the behavior with the GNU ptx reference at src/ptx.c around line 469. Verify how word boundaries should work with and without -W, including the GNU-extension and non-extension cases. Done means ptx avoids regex when -W is absent and uses the specified character sets instead.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.