RFC: etcupdate tool in base?

John Baldwin jhb at freebsd.org
Tue Aug 3 19:39:49 UTC 2010


On Tuesday, June 15, 2010 6:31:45 am Dag-Erling Smørgrav wrote:
> Garrett Cooper <yanefbsd at gmail.com> writes:
> > 1. Script doesn't check to see whether or not it has write access (and
> > doesn't catch some errors):
> 
> 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 commands 
that don't fail, but return "status".  I use a shell function which uses $? to 
return an enum of the result of comparing two files.  Using -e for that 
requires many odd workarounds.  A better case is diff(1).  I use diff(1) to 
generate diff output for 'etcupdate diff' so you can generate a patch of your 
local changes to etc.  However, diff returns $? of 1 if it detects a 
difference which is not a failure, but sh -e treats as a failure.  This would 
require gross hacks along the line of "|| true" or some such which obfuscate 
the code.

-- 
John Baldwin


More information about the freebsd-current mailing list