From owner-freebsd-current@freebsd.org Mon Mar 8 21:19:56 2021 Return-Path: Delivered-To: freebsd-current@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E84A1558863; Mon, 8 Mar 2021 21:19:56 +0000 (UTC) (envelope-from steffen@sdaoden.eu) Received: from sdaoden.eu (sdaoden.eu [217.144.132.164]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DvWSq6yyRz3m1w; Mon, 8 Mar 2021 21:19:55 +0000 (UTC) (envelope-from steffen@sdaoden.eu) Received: from kent.sdaoden.eu (kent.sdaoden.eu [10.5.0.1]) by sdaoden.eu (Postfix) with ESMTP id 9C02E16056; Mon, 8 Mar 2021 22:19:47 +0100 (CET) Received: by kent.sdaoden.eu (Postfix, from userid 1000) id 68DDDFD24; Mon, 8 Mar 2021 22:19:46 +0100 (CET) Date: Mon, 08 Mar 2021 22:19:46 +0100 From: Steffen Nurpmeso To: Ian Lepore Cc: Ed Maste , FreeBSD Hackers , FreeBSD Current 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: <8e9983a4243d158789029ec8b16837b35ca4451a.camel@freebsd.org> Mail-Followup-To: Ian Lepore , Ed Maste , FreeBSD Hackers , FreeBSD Current User-Agent: s-nail v14.9.22-99-g733424fe OpenPGP: id=EE19E1C1F2F7054F8D3954D8308964B51883A0DD; url=https://ftp.sdaoden.eu/steffen.asc; preference=signencrypt BlahBlahBlah: Any stupid boy can crush a beetle. But all the professors in the world can make no bugs. X-Rspamd-Queue-Id: 4DvWSq6yyRz3m1w X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of steffen@sdaoden.eu designates 217.144.132.164 as permitted sender) smtp.mailfrom=steffen@sdaoden.eu X-Spamd-Result: default: False [-2.30 / 15.00]; RCVD_TLS_LAST(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_SPF_ALLOW(-0.20)[+a]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[sdaoden.eu]; RBL_DBL_DONT_QUERY_IPS(0.00)[217.144.132.164:from]; SPAMHAUS_ZRD(0.00)[217.144.132.164:from:127.0.2.255]; TO_DN_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15987, ipnet:217.144.128.0/20, country:DE]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[freebsd-current,freebsd-hackers] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 21:19:57 -0000 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)