From owner-freebsd-bugs@freebsd.org Sun Mar 7 09:47:07 2021 Return-Path: Delivered-To: freebsd-bugs@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 1094755FFF8 for ; Sun, 7 Mar 2021 09:47:07 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mailman.nyi.freebsd.org (unknown [127.0.1.3]) by mx1.freebsd.org (Postfix) with ESMTP id 4Dtc7t3Z9jz4b5c for ; Sun, 7 Mar 2021 09:47:06 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: by mailman.nyi.freebsd.org (Postfix) id 7A74B560494; Sun, 7 Mar 2021 09:47:06 +0000 (UTC) Delivered-To: bugs@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 793B755FFF5 for ; Sun, 7 Mar 2021 09:47:06 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Dtc7t2vrhz4b7y for ; Sun, 7 Mar 2021 09:47:06 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 55E03142F7 for ; Sun, 7 Mar 2021 09:47:06 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 1279l6vV026850 for ; Sun, 7 Mar 2021 09:47:06 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 1279l6XV026849 for bugs@FreeBSD.org; Sun, 7 Mar 2021 09:47:06 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 254091] sed: Please fix -i behavior Date: Sun, 07 Mar 2021 09:47:06 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: Unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: tobik@freebsd.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Mar 2021 09:47:07 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D254091 Bug ID: 254091 Summary: sed: Please fix -i behavior Product: Base System Version: Unspecified Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: tobik@freebsd.org Created attachment 223048 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D223048&action= =3Dedit sed.diff This is one of the most frustrating things in FreeBSD userland for me and can be a PITA when creating new ports or updating them because the rest of the world expects sed to behave differently than our sed. I'm sure this has come up before but I could not find a bug for it. Our sed uses getopt("i:") instead of getopt("i::") like GNU sed or even NetBSD sed or OpenBSD sed. As a consequence something like `sed -i 's/foo/bar/' file` will not work on FreeBSD but works just fine on Linux/NetBSD/OpenBSD (our sed interprets `s/foo/bar/` as the backup file suffix and `file` as the expression, whereas GNU/NetBSD/OpenBSD sed see that we want no backup file). For a concrete example of something in the wild, this here is from the editors/mg configure script which is fine with the other seds sed -i 's,,"terminfo_term.h",g' display.c but errors out with ours sed: 1: "display.c": extra characters at the end of d command If have sent a patch for this upstream to "fix" it, but really it is sed(1) that should be fixed and should be made to work like the rest of the world. We should deal with the consequences on our side. I have a hard time sending patches like this upstream without flinching because I'm essentially pushing a fix for a FreeBSD bug onto upstream. It has been like this forever and FWICT it has been copied to macOS too, so maybe it is too late now... Changing this is obviously a POLA violation and will break scripts of many users but it would be nice if we could do it for FreeBSD 14 anyway. I'm attaching a patch that does what I want I think but most of the tests and other scripts in the tree are broken since they all use bad sed calls now. Ironically there also seem to be some scripts in the tree that are obviously broken with FreeBSD sed and expect GNU sed behavior (for example release/tools/gce.conf). I'd be willing to help fix any ports fallout caused by this. --=20 You are receiving this mail because: You are the assignee for the bug.=