Bug 14691 - Confusing message when calling sed -i incorrectly
Summary: Confusing message when calling sed -i incorrectly
Status: NEW
Alias: None
Product: Busybox
Classification: Unclassified
Component: Other (show other bugs)
Version: 1.33.x
Hardware: All Linux
: P5 minor
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-03-26 10:20 UTC by Ruud Harmsen
Modified: 2022-03-26 10:20 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ruud Harmsen 2022-03-26 10:20:22 UTC
When calling sed in BusyBox v1.34.1 erroneously as:
sed -i -f script
where script exists and contains valid sed commands, the error message is:
sed: -i requires an argument

That is correct, but confusing. I first thought it referred to the optional argument of -i, a filename suffix for a backup of the file to be edited in place (or backups of the files ..., etc.). But being optional, that argument is not required.

GNU sed (4.7) in the same situation says:
sed: no input files
which I think makes it clearer what the actual error is: sed can edit a stdin stream, but not edit it in place. So when using the -i option, you must specify the names of one of more files to be edited, files that reside on disk. Without -i, that is not required.