svn commit: r217229 - head/usr.sbin/pc-sysinstall/backend

Garrett Cooper yanegomi at gmail.com
Tue Jan 11 07:59:54 UTC 2011


On Jan 10, 2011, at 11:26 PM, Pawel Jakub Dawidek wrote:

> On Mon, Jan 10, 2011 at 03:52:12PM -0800, Garrett Cooper wrote:
>>>> +        if [ "${FS}" != "UFS" -a "${FS}" != "UFS+S" -a "${FS}" != "UFS+J" -a "${FS}" != "UFS+SUJ" ] ; then
>>> 
>>> Something like this should work too:
>>> 
>>>        if [ "${FS%+*}" != "UFS" ]; then
>> 
>> Except they're catching less than that:
>> 
>> $ FS=UFS+FOO
>> $ echo ${FS%+*}
>> UFS
>> $
> 
> You mean that invalid ${FS} values are catched? The code as it is don't
> handle them too. I expect those are handled somewhere earlier. From my
> understanding the code wants to dected if this is any configuration of
> UFS, so in my opinion my version is better as there are no modifications
> needed if some other UFS variant will appear in the future.

	Better for reducing churn, not better for user input; user input will always ding you in the long run because users can do interesting things :/...

>>>> +  if [ "$?" != "0" ] ; then return ; fi
>>> 
>>> [ $? -eq 0 ] || return
>> 
>> if [ $? -eq 0 ]; then
>>    return
>> fi
> 
> In that case -ne, as you reverted the logic.

	Yeah, what you said :}...

>> is easier to follow for me because more people go buckwild with the
>> one-liners (and in some cases have introduced bugs that way because
>> they didn't properly think about precedence of the operations, etc).
> 
> I kinda started to like very simple and obvious one-liners in sh(1), but
> this is just a matter of taste.

	I used to like one-liners in perl, but that gets nasty too after a while. It's much easier to trace indentations and track down what's going on IMO than it is to trace down one-liners. python I live with just because their one-liners can also be used for assignment purposes (which is the only case I use it with).
Thanks!
-Garrett


More information about the svn-src-head mailing list