sed -i empty argument compatibility issue

Kyle Evans kevans at
Sat Mar 6 16:12:21 UTC 2021

On Sat, Mar 6, 2021 at 9:40 AM Gary Aitken <freebsd at> wrote:
> On 3/5/21 10:42 PM, Kyle Evans wrote:
> > Is this used only at build-time, or at runtime? The former can just
> > pull in gsed as a BUILD_DEPENDS and use a BINARY_ALIAS to stash it
> > first. Autoconfig takes some more work;
> > ac_cv_path_SED=${LOCALBASE}/bin/gsed instead, maybe. At runtime, your
> > best option is to patch the script to use gsed and slap a RUN_DEPENDS
> > on that bad boy.
> It's a build-time only issue, but I'm trying to come up with a solution
> that "just works" on both the linux end and the fbsd end, so porting
> doesn't involve any patch files.  A BUILD_DEPENDS and BINARY_ALIAS would
> work, thanks.  I see that now in the porter's hb, 5.17.  That may be a
> better solution, as it would deal with any future instances of non-standard
> usage, although convincing the linux and windoze folks to use only
> standard features would be a good thing.

Excellent, good to hear.

Also, some of the other comments in this thread have been a little
discouraging. In an ideal world, FreeBSD would have adopted the same
argument-optional approach, because that's what *Perl* does. We
originally adopted the feature from Perl back in 839af0c1039fbde.
Calling the GNU sed behavior "broken" is just outright wrong, given
that there is no prior Unix art for this and it's a much more useful
interpretation of '-i'.


Kyle Evans

More information about the freebsd-questions mailing list