Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 08 Mar 2021 22:19:46 +0100
From:      Steffen Nurpmeso <steffen@sdaoden.eu>
To:        Ian Lepore <ian@freebsd.org>
Cc:        Ed Maste <emaste@freebsd.org>, FreeBSD Hackers <freebsd-hackers@freebsd.org>, FreeBSD Current <freebsd-current@freebsd.org>
Subject:   Re: Rationalizing sed -i/-I (in-place editing) argument handling
Message-ID:  <20210308211946.6CWxa%steffen@sdaoden.eu>
In-Reply-To: <8e9983a4243d158789029ec8b16837b35ca4451a.camel@freebsd.org>
References:  <CAPyFy2DJcNsDd0tmfyuumDkxXoBDYDmNTqGL8VOsMjk3cr2=3A@mail.gmail.com> <8e9983a4243d158789029ec8b16837b35ca4451a.camel@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Ian Lepore wrote in
 <8e9983a4243d158789029ec8b16837b35ca4451a.camel@freebsd.org>:
 |On Mon, 2021-03-08 at 15:13 -0500, Ed Maste wrote:
 |> A relatively minor but longstanding incompatibility between FreeBSD
 |> and many other systems is the way sed handles backup files for
 |> in-place editing -- sed's -I and -i options. GNU sed and other BSDs
 |> accept an optional argument: -I.bak will save a backup file with a
 |> .bak extension, and -I with no argument will not create a backup
 |> file.
 |> FreeBSD currently accepts either -I.bak or -I .bak to save a backup
 |> with the given extension, and -I "" (an empty argument) to specify no
 |> backup.
 |> 
 |> I've been tripped up by this in the past and I know many others have.
 |> Most recently tobik@  filed PR 254091 for this. Now, I think a single
 ...
 |> change to make -i/-I to be compatible with other sed implementations
 |> in one step is too much of a POLA violation, but I think it can
 |> reasonably be done in stages:
 |> 
 |> 1. Update the man page to indicate that -i/-I should not have a space
 |> between the flag and the extension. This is compatible with current
 |> FreeBSD sed, other BSDs sed, GNU sed, and my proposed changes below.
 |> No backup is still a special case and remains as -I "".
 ...
 |As someone who has to take care of common software that runs on
 |everything from freebsd 8 through -current, I HATE the very idea of
 |this.  If we keep whittling away at the backwards compatibility freebsd
 |is so famous for, I'll have abosolutely zero arguments left for why
 |$work shouldn't just switch to the much more popular and better-
 |supported linux.
 |
 |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.

I hate it too.  But just wanted to note that sccs used this (and
still does, even standardized) decades ago already (and i always
did it wrong).

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20210308211946.6CWxa%steffen>