Alon Bar-Lev has posted comments on this change.

Change subject: core: Compatibility of db scripts with MacOS.
......................................................................


Patch Set 4: (5 inline comments)

....................................................
File backend/manager/dbscripts/dbcustomfunctions.sh
Line 15:     USERNAME=""
Line 16:     VERBOSE=false
Line 17:     LOGFILE="$ME.log"
Line 18:     DBOBJECT_OWNER="engine"
Line 19:     LOCALE="us_EN.UTF8"
en_US.UTF8 ?
Line 20:     LC_ALL="C"
Line 21:     export LC_ALL
Line 22: 
Line 23:     # When running in development environments the .pgpass file may not


....................................................
File backend/manager/dbscripts/dbfunctions.sh
Line 269:     files=$(get_files "upgrade" 3)
Line 270:     md5sum_file=.${DATABASE}.scripts.md5
Line 271:     md5sum_tmp_file=${md5sum_file}.tmp
Line 272:     md5sumResult=$(md5calc $files create_*views.sql *_sp.sql)
Line 273:     echo $md5sumResult > ${md5sum_tmp_file}
md5calc $files create_*views.sql *_sp.sql > ${md5sum_tmp_file}

?
Line 274:     diff -s -q ${md5sum_file} ${md5sum_tmp_file} >& /dev/null
Line 275:     result=$?
Line 276: 
Line 277:     #  0 - identical , 1 - differ , 2 - error


....................................................
File backend/manager/dbscripts/sysfunctions.sh
Line 1: #!/bin/bash
Line 2: 
Line 3: function md5calc {
md5calc() {
}
Line 4:     #can be externalized
Line 5:     if [ -e "/usr/bin/md5sum" ]; then
Line 6:         MD5_CMD="md5sum";
Line 7:     fi


Line 14:     fi
Line 15: 
Line 16:     if [ $MD5_CMD == "md5" ]; then
Line 17:         local result=`/sbin/md5 $@ | awk -F' = ' '{print $2}'`
Line 18:         echo $result;
Just execute, no need subshell.

Do not use absolute directories for common utilities... you can use which, type 
to search for command.

Avoid using $@ as if there is space in file it is broken.

Try to avoid using awk it is too heavy to just print 2nd field.

There is no sense using MD5_CMD if arguments are different....

Should be something like:

 local md5sum
 md5sum="$(which md5sum 2> /dev/null)" && "${md5sum}" $@ | cut -d ' ' -f1

This is we do use $@, which is not nice....

So just loop over parameters execute md for every one and use shift...
Line 19:     else
Line 20:         local result=`/sbin/md5sum $@ | cut -d ' ' -f1`
Line 21:         echo $result;
Line 22:     fi


Line 23: }
Line 24: 
Line 25: function mkTempFile {
Line 26:     local result=$(mktemp ${TMPDIR:-/tmp/}tmp.XXXXXXXXXX)
Line 27:     echo $result;
again... should be:

 mkTempFile() {
    mktemp "${TMPDIR:-/tmp/}tmp.XXXXXXXXXX"
 }

But this is invalid... as function should use TMPDIR need to understand why you 
need this. please send me the exact man page of mktemp.


--
To view, visit http://gerrit.ovirt.org/13233
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I97df4a9c8ea0c2ca0fdf861932a97afb978e56c4
Gerrit-PatchSet: 4
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Asaf Shakarchi <[email protected]>
Gerrit-Reviewer: Alon Bar-Lev <[email protected]>
Gerrit-Reviewer: Asaf Shakarchi <[email protected]>
Gerrit-Reviewer: Juan Hernandez <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to