Date: Tue, 9 Mar 2021 10:06:44 -0700 From: Gary Aitken <freebsd@dreamchaser.org> To: Christian Weisgerber <naddy@mips.inka.de>, freebsd-questions@freebsd.org Subject: Re: sed -i empty argument compatibility issue Message-ID: <e3227d3f-27d8-0d7e-c44a-5d13f85971f0@dreamchaser.org> In-Reply-To: <slrns4f41h.2n79.naddy@lorvorc.mips.inka.de> References: <9178f6c5-631a-c2c2-c6b1-8def94a3397b@dreamchaser.org> <20210305142352297368817@bob.proulx.com> <slrns4f41h.2n79.naddy@lorvorc.mips.inka.de>
next in thread | previous in thread | raw e-mail | index | archive | help
On 3/9/21 8:11 AM, Christian Weisgerber wrote: > On 2021-03-05, Bob Proulx <bob@proulx.com> wrote: > >> 4. Introduce a "sed" wrapper in PATH that intercepts the call to the >> real sed, detects this problematic usage case, and then DTRT does the >> right thing with it. > > To save a lot of patching for the regression tests in the devel/got > port, I added this shell function: > > # compat wrapper > sed() > ( > for i; do > arg=$1 > shift > case $arg in > -i) set - "$@" "$arg" '' ;; > *) set - "$@" "$arg" ;; > esac > done > exec sed "$@" > ) > > No, it doesn't handle all cases, but it is good enough in that context. > ports/devel/got/files/patch-regress_cmdline_common.sh In my case, the folks maintaining the package (FreeCAD) were more than happy to fix the source of the problem to conform to POSIX and not use -i, but rather write a temp file and mv it. So with the next release it will "just work". Gary
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?e3227d3f-27d8-0d7e-c44a-5d13f85971f0>