conf/94377 : [patch] /etc/rc.d/sshd improperly tests random dev state

Brooks Davis brooks at one-eyed-alien.net
Fri Jun 9 00:54:24 UTC 2006


On Thu, Jun 08, 2006 at 09:30:34PM +0000, Doug White wrote:
> The following reply was made to PR conf/94377; it has been noted by GNATS.
> 
> From: Doug White <dwhite at gumbysoft.com>
> To: Rostislav Krasny <rosti.bsd at gmail.com>
> Cc: Florent Thoumie <flz at FreeBSD.org>, Doug White <dwhite at FreeBSD.org>, 
>     bug-followup at FreeBSD.org
> Subject: Re: conf/94377 : [patch] /etc/rc.d/sshd improperly tests random dev
>  state
> Date: Thu, 8 Jun 2006 10:36:05 -0700 (PDT)
> 
>  On Thu, 8 Jun 2006, Rostislav Krasny wrote:
>  
>  > I've seen that patch just today, when it is already MFCed. I think it
>  > could be simpler. Instead of
>  >
>  > [ "x${seeded}" != "x" ] && [ ${seeded} -eq 0 ]
>  >
>  > you can write just
>  >
>  > [ "${seeded}" = "0" ]
>  >
>  > and it will be still correct against sysctl failing and returning an
>  > empty string.
>  
>  No, because if ${seeded} is empty, the shell interprets the test as
>  
>  [ = "0" ]
>  
>  which results in a syntax error. The 'x' in the first test is significant.

Not true.  The 'x' bit has been unnecessicary 31337 for quite some
time IMO.  If you didn't quote ${seeded} then it would be, but
"${variable_that_expands_to_null}" is "". Otherwise -z and -n wouldn't
work.

-- Brooks

-- 
Any statement of the form "X is the one, true Y" is FALSE.
PGP fingerprint 655D 519C 26A7 82E7 2529  9BF0 5D8E 8BE9 F238 1AD4
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-rc/attachments/20060609/0e067c07/attachment.pgp


More information about the freebsd-rc mailing list