uutils / uutils/sed

Improper sed -i Behavior

Open Beginner friendly
#549 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
106
Forks
28
Avg merge
14h 12m
Merged PRs (30d)
16

Description

When -i is provided without an attached suffix, uutils/sed incorrectly consumes the subsequent positional argument (the sed expression) as the backup suffix. This causes the target filename to be evaluated as a sed script, resulting in parsing errors.
In GNU sed, the suffix for -i is optional and must be concatenated directly without whitespace

Reproduction Steps:

echo "foo" > test.txt
sed -i 's/foo/bar/' test.txt

Observed Output:

sed: <script argument 1>:1:1: error: undefined label `est.txt'

Expected Output:

Exit code 0, test.txt modified in-place with contents "bar", no backup file created.

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 by tracing uutils/sed's command-line parsing for -i when no suffix is attached, using the reported shell reproduction as the first check. Done means the following sed expression is no longer consumed as a backup suffix, the command exits successfully, test.txt contains "bar", and no backup file is created.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.