uutils / uutils/coreutils

`seq`: propogate errors to `uumain`

Open
#3,165 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

In reference to https://github.com/uutils/coreutils/pull/3112#discussion_r804508653 and the comment afterwards, it would be nice if we could propagate InvalidSpec errors from that PR through seq.rs's uu_main. Currently, we do the following in seq.rs in two places:

if let Err(x) = Memo::run_all(f, &[s]) {
    show!(x);
    exit(1);
}

Propagating this error as opposed to the above proves to be non-trivial, however, because of this ErrorKind check - if we generalize print_seq()/print_seq_integers() to return a UResult as opposed to an io::Result then we lose the ability to handle BrokenPipes gracefully.

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/seq/src/seq.rs, especially uu_main, the two Memo::run_all calls, print_seq(), print_seq_integers(), and the ErrorKind check around lines 141–145. Trace how InvalidSpec is currently shown and exited, then preserve graceful BrokenPipe handling while propagating the error through uu_main. Done means InvalidSpec reaches uu_main without losing BrokenPipe behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.