Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 02 Jul 2014 17:21:07 -0500
From:      Bryan Drewery <bdrewery@FreeBSD.org>
To:        Jilles Tjoelker <jilles@stack.nl>
Cc:        Pedro Giffuni <pfg@freebsd.org>, freebsd-standards@FreeBSD.org
Subject:   Re: sed -i
Message-ID:  <53B485D3.1080602@FreeBSD.org>
In-Reply-To: <20140702221739.GB61834@stack.nl>
References:  <53556919.4010305@freebsd.org> <53ADD32C.5040503@FreeBSD.org> <20545470-A847-4835-A42B-382E5CC363ED@freebsd.org> <53B477E6.10103@FreeBSD.org> <20140702221739.GB61834@stack.nl>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
On 7/2/2014 5:17 PM, Jilles Tjoelker wrote:
> 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:
> 

Breaking -i '' is not acceptable.

I can't find the patch in question, but from the linked issue I found:

https://gist.github.com/jclulow/1394562

It seems to address the backwards-compat concern.

> 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.
> 


-- 
Regards,
Bryan Drewery


[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTtIXTAAoJEDXXcbtuRpfP/zwH/ipqgeGAla4hIT99Cnf9zTXM
xHsShd8tvFRUjzgVJH8zU+qYC5y0ltRniGhWsGARM0WwohfkY27M0znDhmB6uLIh
50o2rCXp2gmK/Vx6ZC4/X6DUy61IYTMByEyP1jlRT/jmeY1d1quQwgtVBAP7+aeo
YvlHpDjFjsuBpR2zZ/85SORPTjYep1HRQHGe236YxuUGXI7ffx3MkbfbA4Ra3kjQ
WpfG35BOZZV4U7/AZEQj02lcg5iy3tNowjob0pfHUigF0HYUl5XyQfGrNx5jL14i
bc43ACd63gqs/xvF3w4TVqGmopF0Ceuty1Ej6/2losRULn0HvDmORJWrSW2DYHs=
=UMik
-----END PGP SIGNATURE-----
help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?53B485D3.1080602>