Bug 240556 - Synopsis in sed(1) is wrong
Summary: Synopsis in sed(1) is wrong
Status: New
Alias: None
Product: Documentation
Classification: Unclassified
Component: Manual Pages (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-bugs mailing list
Keywords: patch
Depends on:
Reported: 2019-09-13 11:10 UTC by Oliver Fromme
Modified: 2019-09-13 11:48 UTC (History)
1 user (show)

See Also:

Patch for usr.bin/sed/sed.1 (454 bytes, patch)
2019-09-13 11:10 UTC, Oliver Fromme
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Oliver Fromme freebsd_committer 2019-09-13 11:10:03 UTC
Created attachment 207455 [details]
Patch for usr.bin/sed/sed.1

Short description:

Apparently, when the -u, -i and -I options where added to sed(1), it was forgotten to add them to both lines in the SYNOPSIS section. They were only added to the second line, although they apply to both.

Long description:

The SYNOPSIS section of the sed(1) manual page contains two distinct usage lines:

In the first usage, a separate <command> argument is present. In this case, the -e and -f options are NOT allowed.

In the second usage, one or more commands are specified using one or more -e and/or -f options. In this case, there is NO separate <command> argument.

ALL THE OTHER options (except -e and -f) can be used with BOTH usages, including the -u, -i and -I options.  This can be easily verified by looking at the source code (usr.bin/sed/main.c), or by just trying it. For example, this command works perfectly fine, but it's disallowed by the SYNOPSIS currently:

sed -i BAK s/foo/bar/g some_file

Please see the attached patch; it fixes the problem.  It applies cleanly to both head and stable/12.