bind update error?
Kevin J. Cummings
cummings at kjchome.homeip.net
Mon May 28 21:22:03 UTC 2007
D. Hugh Redelmeier wrote:
> | From: Mitch <mitch48 at sbcglobal.net>
>
> | If you are running a name server check some things.
> | You have a new /etc/sysconfig/named file
> | and the line 224 in /usr/sbin/bind-chroot-admin
> | is making a test in this context:
> |
> | . /etc/sysconfig/named
> | if [ "$ENABLE_ZONE_WRITE" = [yY1]* ]; then
> | return 0;
> | fi;
>
> That test is bogus in several ways. Unless the man page expr(1) is
> bogus (never trust GNU-generated man pages).
>
> The shell command "[" is supposed to be another name for "expr".
No, "[" is another name for "test" See the CONDITIONAL EXPRESSIONS
section of "man bash"
> In expr, the binary operator "=" does not take regular expressions.
> So the "[yY1]*" makes no sense. The test does not do what the author
> appears to think it will do.
>
> But it is worse than that. The shell does globbing on this operand
> since it isn't quoted. So [yY1]* would get expanded to the list of
> filenames in the current directory whose names start with y, Y, or 1.
> If none match it would remain unchanged. The result would be passed
> to the expr. If it was a list, that would be a mess. If it were a
> single item, it would just be wrong.
>
> My guess is that the current directory has several matching files and
> the resulting list provokes a syntax error message from expr.
>
> Perhaps the correct test is
> if [ "$ENABLE_ZONE_WRITE" : '[yY1]*' ]; then
> ^ ^ ^
>
> Whoever wrote this script cannot have tested the "then" path of this
> if.
>
> I've added a Bugzilla entry:
> https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=241608
>
--
Kevin J. Cummings
kjchome at rcn.com
cummings at kjchome.homeip.net
cummings at kjc386.framingham.ma.us
Registered Linux User #1232 (http://counter.li.org)
More information about the fedora-list
mailing list