The branch, master has been updated via f62972b s4/scripting/ktpass: make shell code portable and eliminate another bash requirement via a42c731 s4/ldb: fix shell syntax error in test script via 72a322e s3/selftest: add some FIXMEs via eeade15 tests: avoid bash in shebang and fix wrong "==" in test via e8f9ee6 fix Ñome == to correct shell test in commented stuff via 9329d0a smbprinting: fix wrong == in shell tests via 8c365d5 waf/buildtools: remove more bash shebangs and fix a == to = via fca9d05 waf/buildtools: use /bin/sh instead of /bin/bash and put ^ in quotes from beb0181 buildtools: fix --git-local-changes option
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit f62972b7617c6349f238f1420e7b7296065e866b Author: Björn Jacke <b...@sernet.de> Date: Thu Dec 2 10:34:34 2010 +0100 s4/scripting/ktpass: make shell code portable and eliminate another bash requirement Autobuild-User: Björn Jacke <b...@sernet.de> Autobuild-Date: Thu Dec 2 11:20:42 CET 2010 on sn-devel-104 commit a42c731a4bff181f61e29cd16464ea240f76eeeb Author: Björn Jacke <b...@sernet.de> Date: Thu Dec 2 10:29:18 2010 +0100 s4/ldb: fix shell syntax error in test script commit 72a322ed9c2dd3eb0177f91fac8b4368938695ac Author: Björn Jacke <b...@sernet.de> Date: Thu Dec 2 10:24:52 2010 +0100 s3/selftest: add some FIXMEs this needs some rework. Sourced shell code cannot take arguments, at least no portable shell. This generates errors on the buildfarm sind quite a while. commit eeade1596df7bd52fab3b3a4b39266f39ffa6fb1 Author: Björn Jacke <b...@sernet.de> Date: Thu Dec 2 10:20:59 2010 +0100 tests: avoid bash in shebang and fix wrong "==" in test commit e8f9ee64a71d788a8ed1e1d7d5715f248c4fa107 Author: Björn Jacke <b...@sernet.de> Date: Thu Dec 2 10:18:39 2010 +0100 fix Ñome == to correct shell test in commented stuff commit 9329d0a91ed07178bc9117a675a0e2a5cd99ae19 Author: Björn Jacke <b...@sernet.de> Date: Thu Dec 2 10:16:38 2010 +0100 smbprinting: fix wrong == in shell tests commit 8c365d5d4de925d6b548acb3f55a57b35cf4056d Author: Björn Jacke <b...@sernet.de> Date: Thu Dec 2 10:14:07 2010 +0100 waf/buildtools: remove more bash shebangs and fix a == to = commit fca9d052304971659366f00ee7105d70d7460b66 Author: Björn Jacke <b...@sernet.de> Date: Thu Dec 2 09:40:21 2010 +0100 waf/buildtools: use /bin/sh instead of /bin/bash and put ^ in quotes - some Unix shells actually don't like grep ^foo, use grep "^foo" instead. - bash is not installed on every system, please avoid #!/bin/bash and use #!/bin/sh instead ----------------------------------------------------------------------- Summary of changes: buildtools/compare_config_h3.sh | 6 +++--- buildtools/compare_config_h4.sh | 6 +++--- buildtools/compare_generated.sh | 2 +- buildtools/compare_install.sh | 2 +- buildtools/mktowscript/rebuild_all.sh | 2 +- buildtools/testwaf.sh | 4 ++-- examples/printing/smbprint | 4 ++-- lib/dnspython/examples/ddns.py | 2 +- lib/subunit/shell/README | 2 +- lib/subunit/shell/tests/test_function_output.sh | 10 +++++----- lib/subunit/shell/tests/test_source_library.sh | 14 +++++++------- source3/script/tests/test_smbclient_s3.sh | 2 +- source3/selftest/tests.sh | 7 +++++++ source4/lib/ldb/tests/test-schema.sh | 4 ++-- source4/scripting/bin/ktpass.sh | 8 ++++---- 15 files changed, 41 insertions(+), 34 deletions(-) Changeset truncated at 500 lines: diff --git a/buildtools/compare_config_h3.sh b/buildtools/compare_config_h3.sh index 742aa1b..0f640a9 100755 --- a/buildtools/compare_config_h3.sh +++ b/buildtools/compare_config_h3.sh @@ -1,10 +1,10 @@ -#!/bin/bash +#!/bin/sh # compare the generated config.h from a waf build with existing samba # build -grep ^.define bin/default/source3/include/config.h | sort > waf-config.h -grep ^.define $HOME/samba_old/source3/include/config.h | sort > old-config.h +grep "^.define" bin/default/source3/include/config.h | sort > waf-config.h +grep "^.define" $HOME/samba_old/source3/include/config.h | sort > old-config.h comm -23 old-config.h waf-config.h diff --git a/buildtools/compare_config_h4.sh b/buildtools/compare_config_h4.sh index 6daa743..b78b36f 100755 --- a/buildtools/compare_config_h4.sh +++ b/buildtools/compare_config_h4.sh @@ -1,10 +1,10 @@ -#!/bin/bash +#!/bin/sh # compare the generated config.h from a waf build with existing samba # build -grep ^.define bin/default/source4/include/config.h | sort > waf-config.h -grep ^.define $HOME/samba_old/source4/include/config.h | sort > old-config.h +grep "^.define" bin/default/source4/include/config.h | sort > waf-config.h +grep "^.define" $HOME/samba_old/source4/include/config.h | sort > old-config.h comm -23 old-config.h waf-config.h diff --git a/buildtools/compare_generated.sh b/buildtools/compare_generated.sh index ae20fef..ebef8a9 100755 --- a/buildtools/compare_generated.sh +++ b/buildtools/compare_generated.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # compare the generated files from a waf diff --git a/buildtools/compare_install.sh b/buildtools/compare_install.sh index 5ddbffb..b964117 100755 --- a/buildtools/compare_install.sh +++ b/buildtools/compare_install.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh prefix1="$1" prefix2="$2" diff --git a/buildtools/mktowscript/rebuild_all.sh b/buildtools/mktowscript/rebuild_all.sh index 23622b2..e3ed7cf 100755 --- a/buildtools/mktowscript/rebuild_all.sh +++ b/buildtools/mktowscript/rebuild_all.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh cat mklist.txt | while read line; do diff --git a/buildtools/testwaf.sh b/buildtools/testwaf.sh index a9a17cf..d08ea83 100755 --- a/buildtools/testwaf.sh +++ b/buildtools/testwaf.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh set -e set -x @@ -49,7 +49,7 @@ pushd lib/talloc versions="python2.4 python2.5 python2.6 python3.0 python3.1" for p in $versions; do ret=$(which $p || echo "failed") - if [ $ret == "failed" ]; then + if [ $ret = "failed" ]; then echo "$p not found, skipping" continue fi diff --git a/examples/printing/smbprint b/examples/printing/smbprint index 3d4b53f..375f29f 100755 --- a/examples/printing/smbprint +++ b/examples/printing/smbprint @@ -81,7 +81,7 @@ if [ "x$password" = "x" ] ; then password="-N" fi -if [ "x$username" == "x" ] ; then +if [ "x$username" = "x" ] ; then username="$server"; fi @@ -143,7 +143,7 @@ else else set -x; exec >>$debugfile 2>&1 debugargs="$debugfile." - #[ "x$debugsmb" == "x" ] || debugargs="$debugargs -d $debugsmb" + #[ "x$debugsmb" = "x" ] || debugargs="$debugargs -d $debugsmb" fi fi diff --git a/lib/dnspython/examples/ddns.py b/lib/dnspython/examples/ddns.py index 84814b7..27a5b93 100755 --- a/lib/dnspython/examples/ddns.py +++ b/lib/dnspython/examples/ddns.py @@ -16,7 +16,7 @@ # # DEVICE=$1 # -# if [ "X${DEVICE}" == "Xeth0" ]; then +# if [ "X${DEVICE}" = "Xeth0" ]; then # IPADDR=`LANG= LC_ALL= ifconfig ${DEVICE} | grep 'inet addr' | # awk -F: '{ print $2 } ' | awk '{ print $1 }'` # /usr/local/sbin/ddns.py $IPADDR diff --git a/lib/subunit/shell/README b/lib/subunit/shell/README index af894a2..5f7cf37 100644 --- a/lib/subunit/shell/README +++ b/lib/subunit/shell/README @@ -38,7 +38,7 @@ a manually written test using the bindings might look like: subunit_start_test "test name" # determine if test passes or fails result=$(something) -if [ $result == 0 ]; then +if [ $result -eq 0 ]; then subunit_pass_test "test name" else subunit_fail_test "test name" <<END diff --git a/lib/subunit/shell/tests/test_function_output.sh b/lib/subunit/shell/tests/test_function_output.sh index b78eee6..6e500cf 100755 --- a/lib/subunit/shell/tests/test_function_output.sh +++ b/lib/subunit/shell/tests/test_function_output.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # subunit shell bindings. # Copyright (C) 2006 Robert Collins <robe...@robertcollins.net> # @@ -29,7 +29,7 @@ echo 'test: subunit_start_test output' func_output=$(subunit_start_test "foo bar") func_status=$? -if [ $func_status == 0 -a "x$func_output" = "xtest: foo bar" ]; then +if [ $func_status -eq 0 -a "x$func_output" = "xtest: foo bar" ]; then echo 'success: subunit_start_test output' else echo 'failure: subunit_start_test output [' @@ -42,7 +42,7 @@ fi subunit_start_test "subunit_pass_test output" func_output=$(subunit_pass_test "foo bar") func_status=$? -if [ $func_status == 0 -a "x$func_output" = "xsuccess: foo bar" ]; then +if [ $func_status -eq 0 -a "x$func_output" = "xsuccess: foo bar" ]; then subunit_pass_test "subunit_pass_test output" else echo 'failure: subunit_pass_test output [' @@ -60,7 +60,7 @@ here END ) func_status=$? -if [ $func_status == 0 -a "x$func_output" = "xfailure: foo bar [ +if [ $func_status -eq 0 -a "x$func_output" = "xfailure: foo bar [ something wrong here @@ -82,7 +82,7 @@ here END ) func_status=$? -if [ $func_status == 0 -a "x$func_output" = "xerror: foo bar [ +if [ $func_status -eq 0 -a "x$func_output" = "xerror: foo bar [ something died here diff --git a/lib/subunit/shell/tests/test_source_library.sh b/lib/subunit/shell/tests/test_source_library.sh index 699f128..3ef6ffe 100755 --- a/lib/subunit/shell/tests/test_source_library.sh +++ b/lib/subunit/shell/tests/test_source_library.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # subunit shell bindings. # Copyright (C) 2006 Robert Collins <robe...@robertcollins.net> # @@ -24,7 +24,7 @@ echo 'test: shell bindings can be sourced' # if any output occurs, this has failed to source cleanly source_output=$(. ${SHELL_SHARE}subunit.sh 2>&1) -if [ $? == 0 -a "x$source_output" = "x" ]; then +if [ $? -eq 0 -a "x$source_output" = "x" ]; then echo 'success: shell bindings can be sourced' else echo 'failure: shell bindings can be sourced [' @@ -40,7 +40,7 @@ fi echo 'test: subunit_start_test exists' found_type=$(type -t subunit_start_test) status=$? -if [ $status == 0 -a "x$found_type" = "xfunction" ]; then +if [ $status -eq 0 -a "x$found_type" = "xfunction" ]; then echo 'success: subunit_start_test exists' else echo 'failure: subunit_start_test exists [' @@ -54,7 +54,7 @@ fi echo 'test: subunit_pass_test exists' found_type=$(type -t subunit_pass_test) status=$? -if [ $status == 0 -a "x$found_type" = "xfunction" ]; then +if [ $status -eq 0 -a "x$found_type" = "xfunction" ]; then echo 'success: subunit_pass_test exists' else echo 'failure: subunit_pass_test exists [' @@ -68,7 +68,7 @@ fi echo 'test: subunit_fail_test exists' found_type=$(type -t subunit_fail_test) status=$? -if [ $status == 0 -a "x$found_type" = "xfunction" ]; then +if [ $status -eq 0 -a "x$found_type" = "xfunction" ]; then echo 'success: subunit_fail_test exists' else echo 'failure: subunit_fail_test exists [' @@ -82,7 +82,7 @@ fi echo 'test: subunit_error_test exists' found_type=$(type -t subunit_error_test) status=$? -if [ $status == 0 -a "x$found_type" = "xfunction" ]; then +if [ $status -eq 0 -a "x$found_type" = "xfunction" ]; then echo 'success: subunit_error_test exists' else echo 'failure: subunit_error_test exists [' @@ -96,7 +96,7 @@ fi echo 'test: subunit_skip_test exists' found_type=$(type -t subunit_skip_test) status=$? -if [ $status == 0 -a "x$found_type" = "xfunction" ]; then +if [ $status -eq 0 -a "x$found_type" = "xfunction" ]; then echo 'success: subunit_skip_test exists' else echo 'failure: subunit_skip_test exists [' diff --git a/source3/script/tests/test_smbclient_s3.sh b/source3/script/tests/test_smbclient_s3.sh index 2260903..a567274 100755 --- a/source3/script/tests/test_smbclient_s3.sh +++ b/source3/script/tests/test_smbclient_s3.sh @@ -380,7 +380,7 @@ test_ccache_access() -c quit 2>&1 ret=$? - if [ $ret == 0 ] ; then + if [ $ret -eq 0 ] ; then echo "smbclient succeeded with wrong cached credentials" false return diff --git a/source3/selftest/tests.sh b/source3/selftest/tests.sh index 4233cfb..e53981c 100755 --- a/source3/selftest/tests.sh +++ b/source3/selftest/tests.sh @@ -1,4 +1,5 @@ #!/bin/bash +### ^^^FIXME -> sh ... breaks testing on *BSD etc. ... see FIXME's below # This script generates a list of testsuites that should be run as part of # the Samba 3 test suite. @@ -96,6 +97,7 @@ export LOCAL_PATH shift $# testitprefix="smbtorture_s3.plain." testitenv="dc" +#FIXME: shell sourcing with ARGS is just supported by bash but bash isn't everywhere. . $SCRIPTDIR/test_smbtorture_s3.sh //\$SERVER_IP/tmp \$USERNAME \$PASSWORD "" "" "-l \$LOCAL_PATH" ) @@ -103,6 +105,7 @@ export LOCAL_PATH shift $# testitprefix="smbtorture_s3.crypt." testitenv="dc" +#FIXME: shell sourcing with ARGS is just supported by bash but bash isn't everywhere. . $SCRIPTDIR/test_smbtorture_s3.sh //\$SERVER_IP/tmp \$USERNAME \$PASSWORD "" "-e" "-l \$LOCAL_PATH" ) @@ -110,6 +113,7 @@ export LOCAL_PATH shift $# testitprefix="wbinfo_s3." testitenv="dc:local" +#FIXME: shell sourcing with ARGS is just supported by bash but bash isn't everywhere. . $SCRIPTDIR/test_wbinfo_s3.sh \$DOMAIN \$SERVER \$USERNAME \$PASSWORD ) @@ -117,6 +121,7 @@ export LOCAL_PATH shift $# testitprefix="wbinfo_s3." testitenv="dc:local" +#FIXME: shell sourcing with ARGS is just supported by bash but bash isn't everywhere. . $SCRIPTDIR/test_wbinfo_s3.sh \$DOMAIN \$SERVER \$DOMAIN\\\\\$USERNAME \$PASSWORD ) @@ -124,6 +129,7 @@ export LOCAL_PATH shift $# testitprefix="wbinfo_s3." testitenv="member:local" +#FIXME: shell sourcing with ARGS is just supported by bash but bash isn't everywhere. . $SCRIPTDIR/test_wbinfo_s3.sh \$DOMAIN \$SERVER \$DOMAIN\\\\\$USERNAME \$PASSWORD ) @@ -186,6 +192,7 @@ plantest "blackbox.testparm_s3" dc:local LOCAL_PATH="$LOCAL_PATH" BINDIR="$BINDI if [ -n "$SMBTORTURE4" -a -n "$SMBTORTURE4VERSION" ];then echo "Using SMBTORTURE4: $SMBTORTURE4BINARY" echo "Version: $SMBTORTURE4VERSION" +#FIXME: shell sourcing with ARGS is just supported by bash but bash isn't everywhere. . $SCRIPTDIR/test_posix_s3.sh //\$SERVER_IP/tmp \$USERNAME \$PASSWORD "" "" else echo "Skip Tests with Samba4's smbtorture" diff --git a/source4/lib/ldb/tests/test-schema.sh b/source4/lib/ldb/tests/test-schema.sh index 2f10fb4..9784184 100755 --- a/source4/lib/ldb/tests/test-schema.sh +++ b/source4/lib/ldb/tests/test-schema.sh @@ -19,12 +19,12 @@ $VALGRIND bin/ldbmodify $LDBDIR/tests/schema-tests/schema-mod-test-1.ldif || exi $VALGRIND bin/ldbmodify $LDBDIR/tests/schema-tests/schema-mod-test-2.ldif || exit 1 $VALGRIND bin/ldbmodify $LDBDIR/tests/schema-tests/schema-mod-test-3.ldif || exit 1 $VALGRIND bin/ldbmodify $LDBDIR/tests/schema-tests/schema-mod-test-4.ldif -if [ "$?" == "0" ]; then +if [ "$?" = "0" ]; then echo "test failed!" exit 1 fi $VALGRIND bin/ldbmodify $LDBDIR/tests/schema-tests/schema-mod-test-5.ldif -if [ "$?" == "0" ]; then +if [ "$?" = "0" ]; then echo "test failed!" exit 1 fi diff --git a/source4/scripting/bin/ktpass.sh b/source4/scripting/bin/ktpass.sh index 74f740a..e758eb3 100755 --- a/source4/scripting/bin/ktpass.sh +++ b/source4/scripting/bin/ktpass.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh # vim: expandtab # # Copyright (C) Matthieu Patou <m...@matws.net> 2010 @@ -23,7 +23,7 @@ TEMP=`getopt -o h --long princ:,pass:,out:,host:,ptype:,enc:,path-to-ldbsearch: -n "$name" -- "$@"` eval set -- "$TEMP" -function usage { +usage () { echo -ne "$name --out <keytabfile> --princ <principal> --pass <password>|*\n" echo -ne " [--host hostname] [--enc <encryption>]\n" echo -ne " [--ptype <type>] [--path-to-ldbsearch <path>]\n" @@ -68,7 +68,7 @@ if [ -z $host ]; then fi kvno=`${path}ldbsearch -H ldap://$host "(|(samaccountname=$princ)(serviceprincipalname=$princ)(userprincipalname=$princ))" msds-keyversionnumber -k 1 -N 2>/dev/null| grep -i msds-keyversionnumber` -if [ "$kvno" == "" ]; then +if [ x"$kvno" = x"" ]; then echo -ne "Unable to find kvno for principal $princ\n" echo -ne " check that you are authentified with kerberos\n" exit 1 @@ -76,7 +76,7 @@ else kvno=`echo $kvno | sed 's/^.*: //'` fi -if [ "$pass" == "*" ]; then +if [ "$pass" = "*" ]; then echo -n "Enter password for $princ: " stty -echo read pass -- Samba Shared Repository