Date: Thu, 3 Jul 2014 00:17:39 +0200 From: Jilles Tjoelker <jilles@stack.nl> To: Bryan Drewery <bdrewery@FreeBSD.org> Cc: Pedro Giffuni <pfg@freebsd.org>, freebsd-standards@FreeBSD.org Subject: Re: sed -i (was: regex(3): support for \< and \> word delimiters) Message-ID: <20140702221739.GB61834@stack.nl> In-Reply-To: <53B477E6.10103@FreeBSD.org> References: <53556919.4010305@freebsd.org> <53ADD32C.5040503@FreeBSD.org> <20545470-A847-4835-A42B-382E5CC363ED@freebsd.org> <53B477E6.10103@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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: > > https://www.illumos.org/issues/586 > > 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 issue. 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/functions-cleanup.sh: 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140702221739.GB61834>