AF:
NF:0
PS:10
SRH:1
SFN:
DSR:
MID:<20080314182942.0d491dcd@ripper.onstor.net>
CFG:
PT:0
S:andy.sharp@onstor.com
RQ:
SSV:onstor-exch02.onstor.net
NSV:
SSH:
R:<sudharsan@onstor.com>,<tim.gardner@onstor.com>,<paul.hammer@onstor.com>,<sripal.surendiran@onstor.com>,<narain.ramadass@onstor.com>
MAID:1
X-Sylpheed-Privacy-System:
X-Sylpheed-Sign:0
SCF:#mh/Mailbox/sent
RMID:#imap/andys@onstor.net@onstor-exch02.onstor.net/INBOX	0	BB375AF679D4A34E9CA8DFA650E2B04E05B95C4A@onstor-exch02.onstor.net
X-Sylpheed-End-Special-Headers: 1
Date: Fri, 14 Mar 2008 18:35:50 -0700
From: Andrew Sharp <andy.sharp@onstor.com>
To: "Sudharsan Srinivasan" <sudharsan@onstor.com>
Cc: "Tim Gardner" <tim.gardner@onstor.com>, "Paul Hammer"
 <paul.hammer@onstor.com>, "Sripal Surendiran (HCL)"
 <sripal.surendiran@onstor.com>, "Narain Ramadass"
 <narain.ramadass@onstor.com>
Subject: Re: FTI code + Migration script review
Message-ID: <20080314183550.70e594cc@ripper.onstor.net>
In-Reply-To: <BB375AF679D4A34E9CA8DFA650E2B04E05B95C4A@onstor-exch02.onstor.net>
References: <BB375AF679D4A34E9CA8DFA650E2B04E05B95C4A@onstor-exch02.onstor.net>
Organization: Onstor
X-Mailer: Sylpheed-Claws 2.6.0 (GTK+ 2.8.20; x86_64-pc-linux-gnu)
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

On Thu, 13 Mar 2008 08:18:48 -0700 "Sudharsan Srinivasan"
<sudharsan@onstor.com> wrote:

> Hi Andy,
> While you continue your review of FTI, please pass on any review
> comments that you have so far. Sripal can take care of these
> comments. Also, I guess Larry has reviewed the makefiles. Kindly pass
> on any review comments that Larry might have. 
> Regards
> Sudharsan

Here you go.  There is some work to do.  ifdef {OpenBSD,Linux} has to
be removed, plus some other stuff.  I think there are one or two files
that appear to have been a name change and not much more, but they are
showing up as adds from perforce.  Did they start as integrates or were
they just done as adds?



linux/rootfs/Makefile


     See Larry Scheer's review of this file.


linux/rootfs/etc/init.d/onstor


     not happy with removal of initial-config script, but am happy
     with emrscron related changes.

     please preserve the code from initial-config that performed the
     auto-upgrade function, and keep that functionality here.

     line 40, the grep regex is hair-raising.  please make it sane
     and as simple as possible.  something like

     grep -v '^#' /etc/network/interfaces | egrep "iface eth[01][[space]]\+ dhcp"



linux/rootfs/etc/init.d/onstor-config


     I think someone else said this already, but I'll repeat it: fix
     the name and/or the logic surrounding the variable INITIALCONFIG.
     It is not intuitive or self-documenting as is.  For example, change
     the name to NOT_INITIALCONFIG or change the logic, or even better,
     change the possible values to yes/no, and have INITIALCONFIG=yes
     when the filer is in an initial config state.

     line 38, seriously dense sed script.  for maintainability,
     please turn it into 3 separate scripts, or better yet,
     three separate shell functions like "interfaces_reset_type",
     "interfaces_reset_address", "interfaces_reset_netmask" and
     call them from this function, for greater code reuseability.

     line 76, you can remove the call to newaliases, it is a no-op

     line 86, add back auto-upgrade logic from
     /etc/onstor/initial-config here.


linux/rootfs/etc/onstor/initial-config


     >>delete linux/rootfs/etc/onstor/initial-config

     don't delete it, just remove it from makefile for now


nfx-tree/code/sm-sct/taskmgr.c


     line 93-94; 112-113 indentation style does not match surrounding
     code.

     line 2333-2336, what does this do?


nfx-tree/code/ssc-initial-config/Makefile


     line 23 make this based on the value of $(OS) rather than $(PROD).


nfx-tree/code/ssc-initial-config/initial-config-linux.c


     >>add nfx-tree/code/ssc-initial-config/initial-config-linux.c

     this should be an integrate of initial-config-linux.c

     please pare down that massive list of includes to only those that
     are actually needed.

     line 85, many whitespace violations, including trailing whitespace

     line 93, return the errno, not -1.  adjust callers accordingly.

     line 99,151 not needed, fgets does this

     line 136,233,244 trailing whitespace

     line 142,156,164,173,177,188,196,203,207 return some kind of
     errno value, like ENOTFOUND.  ok, i just made that up, but you
     know what i mean. EINVAL, ENOENT, something like that.

     line 244, spacing?  operators should be surrounded with a space,
     like ==, ?, : and so on.  and of course fix the trailing space.

     line 250 why not return the actual errno? same for all the returns
     in this function.

     line function initconf_updateInterfaceConf()
     Instead of writing shell scripts on the fly like
     this, create a library of commonly used shell
     functions for yourself that do these common tasks,
     and then just invoke from your C code like so:
     do_system(". /onstor/lib/system-config-lib.sh;
     function_name %s %s", argument, argument);

     Many of these functions can be culled from the current
     initial-config script, and other places.  See my comments
     for onstor-config.

     line 361 the description text and the argument variable name
     could use some clarifying.  This method updates the default
     gateway address in the configuration file.  gateway - ip address
     of the gateway.  you get the idea.

     line 374, trailing whitespace

     line 385, this is a bogus route command.  you can let the route
     program figure out the netmask, or specify it correctly, but
     0.0.0.0 is never right, obviously.  to let route figure it out,
     which is probably best, use this:

     fprintf(fp, "route add default gw %s", gateway);

     obviously that also implies that you change the variable name to
     gateway, which is what it really is.


nfx-tree/code/ssc-initial-config/initial-config-openbsd.c


     >>add nfx-tree/code/ssc-initial-config/initial-config-openbsd.c

     I seriously doubt you need all these include files.  Please pare
     these down to the absolute minimum.  Same goes for the Linux
     version of this file.

     same comments as for the Linux version.

     much trailing whitespace as well.


nfx-tree/code/ssc-initial-config/initial-config.c


     Please do not use if[n]def OpenBSD or Linux, or variants thereof.
     Read the porting guide wiki page under the Cougar project if you
     need pointers on how to do that.

     please clean up trailing whitespace.

     Error return paths: in initial-config-$(OS) I said return errno
     value instead of -1.  Well, you can do that, or you can return
     some NFX_error_value that is appropriate.  Your choice.

     line 10 spelling

     line 381 do not use parens in return statements.  return is not
     a function call.

     line 385, this logic is broken in several ways.  just because a
     string in the file is longer than INITCONF_MAX_STR_SIZE, whatever
     the heck that is, doesn't mean an automatic error.  errors should
     only come from the parsing part of the code. not to mention that if
     (buf[0] != '\0' && buf[strlen(buf) - 1] == '\n') might fail but the
     string be complete.  and the assignement on line 386 is redundant.

     line 458, is there some reason the last argument in this function
     call is on another line?

     line 519 there is a standard scanf way to specify a variable
     field width.  please use that.  barring that, at least add a
     comment about what this code is doing.

     these (void) casts are not needed.

     line 529,564, why did these lines change?

     line 646, all operators should be surrounded by space, like '|'


     After these issues have been addressed I'll re-review.

nfx-tree/code/ssc-initial-config/initial-config.h


     line 22 no ifdef OpenBSD/Linux, please.  portable files should
     remain that way, not to mention that we don't build on the target
     system, so these macros shouldn't be counted on.  put OS specific
     defines in $(OS).h.

     line 95 ditto



nfx-tree/code/ssc-initial-config/migrate.sh


     >>add nfx-tree/code/ssc-initial-config/migrate.sh

     please clean up trailing whitespace.

     line 117,147 do something like this instead: /bin/mount -o
     ro,ufstype=44bsd "$SEC_DEV_FILE"4 $MOUNT_PT > /dev/null 2>&1

     line 119,149 please use proper spacing -- operators like ']' and
     ';' should have space around them.

     line 229,242 use spaces or tabs to indent, not both.  tabs are
     always preferred, of course.

     line 388, please include the official list(s) of config files, in
     /onstor/lib.  see flash_install.sh or initial-config for examples.

     updateCrontab() - cannot emrscron be used for this?  in conjunction
     with the modify-cron command, of course.  that way, you don't have
     to "upgrade" the crontab file.  on boot up, root crontab file is
     wiped and rebuilt every time, so this should be necessary at all.

     line 513 s/send/set/

     I like the fact that you've added code to have the user set the
     root password in addition to the admin password.  Please put a
     message in here to the user informing them that we cannot recover
     this password if they lose it, so they should make a record of
     it and keep it in a safe place;  only a system config reset will
     allow them to get the root password again, and of course all
     config info will be lost.




nfx-tree/code/ssc-initial-config/minlabel.c


     >>add nfx-tree/code/ssc-initial-config/minlabel.c

     looks ok


nfx-tree/code/ssc-initial-config/minlabel.h


     >>add nfx-tree/code/ssc-initial-config/minlabel.h

     looks ok

nfx-tree/code/ssc-nfxsh/Makefile


     looks good


nfx-tree/code/ssc-nfxsh/cmd_flash.c


     looks good


nfx-tree/code/ssc-nfxsh/vtysh-linux.c


     >>delete nfx-tree/code/ssc-nfxsh/vtysh-linux.c

     looks good


nfx-tree/code/ssc-nfxsh/vtysh-openbsd.c


     >>delete nfx-tree/code/ssc-nfxsh/vtysh-openbsd.c

     looks good


nfx-tree/code/ssc-nfxsh/vtysh_initial.c


     >>add nfx-tree/code/ssc-nfxsh/vtysh_initial.c

     this should have been done as an integrate of vtysh-openbsd.c,
     not a delete/add

     opening description: please fix


nfx-tree/code/ssc-pm/rc.onstor


     looks good


openbsd/src/usr.sbin/dhcp/dhclient/scripts/dhclient-script

     revert unchanged file?


