Rationalizing sed -i/-I (in-place editing) argument handling

Ed Maste emaste at freebsd.org
Thu Mar 11 22:24:38 UTC 2021


 On Mon, 8 Mar 2021 at 16:41, Ed Maste <emaste at freebsd.org> wrote:
>
> On Mon, 8 Mar 2021 at 15:55, Ian Lepore <ian at freebsd.org> wrote:
> >
> > I also hate the idea of requiring no space between -I and its related
> > value.  That seems like a huge POLA violation compared to how virtually
> > every other command's options and arguments work.
>
> On the other hand, -i.ext with no space is compatible with FreeBSD
> today and is portable to OpenBSD, NetBSD, macOS, and GNU. -i .ext
> works only with FreeBSD and macOS.

I'd like to go ahead with a man page update shortly. Even if we do not
modify sed, it is valuable to document and describe the compatibility
issues with our -i/-I, including the odd way we specify no backup
file.

On the topic of POLA our -i/-I support was based on perl's in-place
editing, except perl uses the optional argument style (-i / -i.bak).
I'd also argue that our -i "" is a POLA violation compared to how most
other commands work, and has caused significant confusion for folks
interested in cross-OS compatibility.

If anyone has suggestions or improvements to the proposed man page
text I'd appreciate a follow-up here or a comment in the review,
https://reviews.freebsd.org/D29128.


More information about the freebsd-hackers mailing list