Skip to content

csplit: panic when empty file is suppressed with % pattern with offset #7251

@jfinkels

Description

@jfinkels

Environment: Ubuntu 24.04, uutils main branch (git commit c250584), GNU coreutils v9.4.

Steps to reproduce:

echo abc > f
csplit -z f %abc%1

(-z means suppress empty files, %abc% means scan to the first line that matches the pattern abc, and 1 means advance by one more line after the match is found.)

What happens now: uutils csplit panics with the following message:

thread 'main' panicked at src/uu/csplit/src/csplit.rs:205:36:
Failed to elide split: Os { code: 2, kind: NotFound, message: "No such file or directory" }

What I expected to happen: GNU csplit succeeds with no output.

Notes: this is causing the GNU test file tests/csplit/csplit-heap.sh to be skipped.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions