rc.subr: disabling globbing while processing devfs rules

John Baldwin jhb at freebsd.org
Mon Apr 1 20:17:05 UTC 2013


On Monday, April 01, 2013 3:56:01 pm Jilles Tjoelker wrote:
> On Mon, Apr 01, 2013 at 02:06:50PM -0400, John Baldwin wrote:
> > Why not use 'local -' instead of the $- magic?  That is:
> 
> > devfs_rulesets_from_file()
> > {
> >    local file _err _me -
> > 
> >    ...
> >    set -f
> >    ...
> > }
> 
> > That would seem to be simpler.
> 
> I had mentioned this possibility on IRC, but this feature is specific to
> Almquist-derived shells (ash) and so something more portable was
> selected. (It's still not standard because POSIX does not specify
> "local" but it works on most shells in use.)

rc.subr isn't meant to be portable, it's a script that is part of the FreeBSD 
base system.  I find the 'local -' syntax more readable (and used the feature 
quite a bit in etcupdate).

-- 
John Baldwin


More information about the freebsd-rc mailing list