The branch, master has been updated
       via  4d638f2101f s3:tests: Use awk for parsing hexkeys
       via  af89770492e s3:tests: Add debug output to test_net_tdb.sh
       via  e2b9b80acad source3:tests: Fix all shellcheck errors found in 
test_net_tdb.sh
      from  bf09de7922d Update WHATSNEW with kerberos changes

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 4d638f2101f523e42becf7a3cf2547fcf6752b02
Author: Andreas Schneider <[email protected]>
Date:   Fri Nov 14 09:50:47 2025 +0100

    s3:tests: Use awk for parsing hexkeys
    
    This just uses valid hex values and doesn't rely on special positions.
    
    Signed-off-by: Andreas Schneider <[email protected]>
    Reviewed-by: Martin Schwenke <[email protected]>
    Reviewed-by: Anoop C S <[email protected]>
    
    Autobuild-User(master): Martin Schwenke <[email protected]>
    Autobuild-Date(master): Thu Jan 15 08:01:36 UTC 2026 on atb-devel-224

commit af89770492e6c56a6add7c05d755def4593ba598
Author: Andreas Schneider <[email protected]>
Date:   Thu Nov 13 14:33:00 2025 +0100

    s3:tests: Add debug output to test_net_tdb.sh
    
    Signed-off-by: Andreas Schneider <[email protected]>
    Reviewed-by: Martin Schwenke <[email protected]>
    Reviewed-by: Anoop C S <[email protected]>

commit e2b9b80acadad1d1d78d4e988e246a83662b98c3
Author: Andreas Schneider <[email protected]>
Date:   Fri Nov 14 09:20:21 2025 +0100

    source3:tests: Fix all shellcheck errors found in test_net_tdb.sh
    
    Signed-off-by: Andreas Schneider <[email protected]>
    Reviewed-by: Martin Schwenke <[email protected]>
    Reviewed-by: Anoop C S <[email protected]>

-----------------------------------------------------------------------

Summary of changes:
 source3/script/tests/test_net_tdb.sh | 77 ++++++++++++++++++++++--------------
 1 file changed, 47 insertions(+), 30 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/script/tests/test_net_tdb.sh 
b/source3/script/tests/test_net_tdb.sh
index abc87861503..46fc4a6943a 100755
--- a/source3/script/tests/test_net_tdb.sh
+++ b/source3/script/tests/test_net_tdb.sh
@@ -28,77 +28,94 @@ LOCKDIR=$8
 FILENAME=net_tdb_testfile
 
 samba_tdbtool=tdbtool
-if test -x $BINDIR/tdbtool; then
-       samba_tdbtool=$BINDIR/tdbtool
+if test -x "$BINDIR/tdbtool"; then
+       samba_tdbtool="$BINDIR/tdbtool"
 fi
 
 failed=0
 
-incdir=$(dirname $0)/../../../testprogs/blackbox
-. $incdir/subunit.sh
+incdir=$(dirname "$0")/../../../testprogs/blackbox
+# shellcheck source=testprogs/blackbox/subunit.sh
+. "$incdir/subunit.sh"
 
-touch $LOCALPATH/$FILENAME
+touch "$LOCALPATH/$FILENAME"
 
 printf "open %s\n"'!sleep 10'"\n" ${FILENAME} |
-       $SMBCLIENT //$SERVER/$SHARE -U$USER%$PASS &
+       "$SMBCLIENT" "//$SERVER/$SHARE" -U"$USER%$PASS" &
 SMBCLIENTPID=$!
 
 # Give smbclient a chance to open the file
 sleep 1
 
 testit "Looking for record key of open file" \
-       $samba_tdbtool $LOCKDIR/locking.tdb hexkeys ||
-       failed=$(expr $failed + 1)
+       "$samba_tdbtool" "$LOCKDIR/locking.tdb" hexkeys ||
+       failed=$((failed + 1))
 
 # The assumption here is that only one file is open, so only one
 # record can exist in the database.
 
-# Output of 'tdbtool hexkeys' is in this format:
-#[000] 01 FD 00 00 00 00 00 00  56 02 5C 00 00 00 00 00  ....... V.\....
-#[010] 00 00 00 00 00 00 00 00                           .......
-# Select only the hex data, remove space and join every thing together
-key=0x$($samba_tdbtool $LOCKDIR/locking.tdb hexkeys |
-       grep '\[' | cut -c 7-56 | sed -e 's/ //g' | tr -d '\n')
+echo "=== Debug Output for 'tdbtool locking.tdb hexkeys' =="
+$samba_tdbtool "$LOCKDIR/locking.tdb" hexkeys
+echo "=== End Debug Output ==="
+
+# The above code produces the following output:
+#
+# === Debug Output for 'tdbtool locking.tdb hexkeys' ==
+# key 24 bytes
+# [000] 2B 00 00 00 00 00 00 00  24 40 17 03 00 00 00 00  +...... $@.....
+# [010] 00 00 00 00 00 00 00 00                           .......
+#
+# === End Debug Output ===
+#
+# Select only valid hex byte values and join them together
+key="0x$("$samba_tdbtool" "$LOCKDIR/locking.tdb" hexkeys |
+      awk '/^key/ && seen { exit }
+           /^key/ { seen=1; next }
+           /^\[/ { for(i=2; i<=NF; i++) if($i ~ /^[0-9A-Fa-f][0-9A-Fa-f]$/) 
printf "%s", $i }')"
+
+echo "=== Debug Output for key =="
+echo "${key}"
+echo "=== End Debug Output ==="
 
 testit "Looking for open file in locking.tdb" \
-       $BINDIR/net $CONFIGURATION tdb locking $key ||
-       failed=$(expr $failed + 1)
-out=$($BINDIR/net $CONFIGURATION tdb locking $key)
+       "$BINDIR/net" "$CONFIGURATION" tdb locking "$key" ||
+       failed=$((failed + 1))
+out=$("$BINDIR/net" "$CONFIGURATION" tdb locking "$key")
 
-out=$($BINDIR/net $CONFIGURATION tdb locking $key |
+out=$("$BINDIR/net" "$CONFIGURATION" tdb locking "$key" |
        grep 'Share path: ' | sed -e 's/Share path: \+//')
 testit "Verify pathname in output" \
        test "$out" = "$LOCALPATH" ||
-       failed=$(expr $failed + 1)
+       failed=$((failed + 1))
 
-out=$($BINDIR/net $CONFIGURATION tdb locking $key |
+out=$("$BINDIR/net" "$CONFIGURATION" tdb locking "$key" |
        grep 'Name:' | sed -e 's/Name: \+//')
 testit "Verify filename in output" \
        test "$out" = "$FILENAME" ||
-       failed=$(expr $failed + 1)
+       failed=$((failed + 1))
 
-out=$($BINDIR/net $CONFIGURATION tdb locking $key |
+out=$("$BINDIR/net" "$CONFIGURATION" tdb locking "$key" |
        grep 'Number of share modes:' |
        sed -e 's/Number of share modes: \+//')
 testit "Verify number of share modes in output" \
        test "$out" = "1" ||
-       failed=$(expr $failed + 1)
+       failed=$((failed + 1))
 
 testit "Complete record dump" \
-       $BINDIR/net $CONFIGURATION tdb locking $key dump ||
-       failed=$(expr $failed + 1)
+       "$BINDIR/net" "$CONFIGURATION" tdb locking "$key" dump ||
+       failed=$((failed + 1))
 
-$BINDIR/net $CONFIGURATION tdb locking $key dump | grep -q $FILENAME
+"$BINDIR/net" "$CONFIGURATION" tdb locking "$key" dump | grep -q "$FILENAME"
 RC=$?
 testit "Verify filename in dump output" \
        test $RC = 0 ||
-       failed=$(expr $failed + 1)
-$BINDIR/net $CONFIGURATION tdb locking $key dump | grep -q $LOCALPATH
+       failed=$((failed + 1))
+"$BINDIR/net" "$CONFIGURATION" tdb locking "$key" dump | grep -q "$LOCALPATH"
 RC=$?
 testit "Verify share path in dump output" \
        test $RC = 0 ||
-       failed=$(expr $failed + 1)
+       failed=$((failed + 1))
 
 kill $SMBCLIENTPID
 
-testok $0 $failed
+testok "$0" "$failed"


-- 
Samba Shared Repository

Reply via email to