sed -i empty argument compatibility issue
freebsd at dreamchaser.org
Tue Mar 9 17:11:56 UTC 2021
On 3/9/21 8:11 AM, Christian Weisgerber wrote:
> On 2021-03-05, Bob Proulx <bob at 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
> for i; do
> case $arg in
> -i) set - "$@" "$arg" '' ;;
> *) set - "$@" "$arg" ;;
> exec sed "$@"
> No, it doesn't handle all cases, but it is good enough in that context.
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
More information about the freebsd-questions