sed -i (was: regex(3): support for \< and \> word delimiters)

Jilles Tjoelker jilles at
Wed Jul 2 22:17:43 UTC 2014

On Wed, Jul 02, 2014 at 04:21:42PM -0500, Bryan Drewery wrote:
> On 6/27/2014 4:15 PM, Pedro Giffuni wrote:
> > While here, there is also the sed(1) syntax issue:

> >

> > Adopting both changes would probably reduce to a minimum the use of
> > GNU sed in the ports tree, but such changes are likely to be
> > controversial(?) and I don’t feel like wearing asbestos underwear at
> > this time .. at least not for sed ;).

> IMHO yes that is a good thing to bring over as it helps with people
> coming from other platforms and improves portability with scripts. I
> started on Linux and kept wondering why I had FILEe files all over my
> system until I realized -i '' was required on FreeBSD.

What are your ideas about the breakage this will cause? sed -i was
proposed in the Austin Group, but standardization broke down on this

Even a simple grep for 'sed -i' finds a few dozen uses in FreeBSD base
that would be broken, for example:

etc/Makefile:	sed -i "" -e 's;.*/usr/libexec/atrun;#&;' ${DESTDIR}/etc/crontab

On the other hand,

usr.sbin/pc-sysinstall/backend/	sed -i -e "s|my.domain|${HOSTNAME} ${HOSTNAME}|g" ${FSMNT}/etc/hosts

appears to attempt to use the GNU form.

Also, where a backup suffix is deliberately given, it is always attached
to -i. Therefore, it would work for the scripts in FreeBSD base to use
the GNU behaviour except that an empty argument after an argumentless -i
option counts as an argument to that -i option anyway.

Jilles Tjoelker

More information about the freebsd-standards mailing list