Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Aug 2010 13:46:55 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        "Dag-Erling =?utf-8?q?Sm=C3=B8rgrav?=" <des@des.no>
Cc:        Garrett Cooper <yanefbsd@gmail.com>, current@freebsd.org
Subject:   Re: RFC: etcupdate tool in base?
Message-ID:  <201008031346.56093.jhb@freebsd.org>
In-Reply-To: <864oh4poxa.fsf@ds4.des.no>
References:  <201006101346.59824.jhb@freebsd.org> <AANLkTikREfDupHi3mnCdUdwXt015KorPvbVGqxwW4MkC@mail.gmail.com> <864oh4poxa.fsf@ds4.des.no>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tuesday, June 15, 2010 6:31:45 am Dag-Erling Sm=C3=B8rgrav wrote:
> Garrett Cooper <yanefbsd@gmail.com> writes:
> > 1. Script doesn't check to see whether or not it has write access (and
> > doesn't catch some errors):
>=20
> IMHO, any shell script which is intended to be used more than twice
> should start with "set -e".

It turns out that this can be quite a PITA to workaround if you have comman=
ds=20
that don't fail, but return "status".  I use a shell function which uses $?=
 to=20
return an enum of the result of comparing two files.  Using -e for that=20
requires many odd workarounds.  A better case is diff(1).  I use diff(1) to=
=20
generate diff output for 'etcupdate diff' so you can generate a patch of yo=
ur=20
local changes to etc.  However, diff returns $? of 1 if it detects a=20
difference which is not a failure, but sh -e treats as a failure.  This wou=
ld=20
require gross hacks along the line of "|| true" or some such which obfuscat=
e=20
the code.

=2D-=20
John Baldwin



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