[ADDITIONAL PATCH][BUG 12721] Cleanup directories correctly in the smbclient test

Jeremy Allison jra at samba.org
Sat Apr 8 02:52:34 UTC 2017


On Tue, Apr 04, 2017 at 11:19:34AM +0200, Andreas Schneider wrote:
> Hi,
> 
> as I'm the only one who runs 'make test' on other distributions than on Ubuntu 
> I'm always the one finding the ugly stuff ;-)
> 
> UNEXPECTED(failure): samba3.blackbox.smbclient_s3.sign (nt4_dc).follow 
> symlinks = no(nt4_dc)
> REASON: Exception: Exception: CLI_FORCE_INTERACTIVE=yes /home/asn/workspace/
> projects/samba/bin/smbclient -Uasn%localntdc2pass //LOCALNT4DC2/nosymlinks -I 
> 127.0.0.3 --configfile=/home/asn/workspace/p
> rojects/samba/st/client/client.conf --signing=required
> NT_STATUS_ACCESS_DENIED opening remote file \source
> CLI_FORCE_INTERACTIVE=yes /home/asn/workspace/projects/samba/bin/smbclient -
> Uasn%localntdc2pass //LOCALNT4DC2/nosymlinks -I 127.0.0.3 --configfile=/home/
> asn/workspace/projects/samba/st/client/client
> .conf --signing=required
> CLI_FORCE_INTERACTIVE=yes /home/asn/workspace/projects/samba/bin/smbclient -
> Uasn%localntdc2pass //LOCALNT4DC2/nosymlinks -I 127.0.0.3 --configfile=/home/
> asn/workspace/projects/samba/st/client/client
> .conf --signing=required
> NT_STATUS_FILE_IS_A_DIRECTORY opening remote file \foo\bar\testfile
> 
> 
> The attached patch creates a test directory in the share and removes that 
> directory completely so nothing is left behind and can interfere in another 
> test.
> 
> It makes sure sub-directories are created and the files get some content. 
> 'touch' is not the best solution to create files.
> 
> 
> I found this on openSUSE Tumbleweed and the attached patch allows the test to 
> pass on that distribution now.
> 
> It only happend when I run all the tests using:
> make -j test TESTS="samba3.blackbox.smbclient_s3"
> 
> 
> Review much appreciated.

Looks good to me. RB+. Sorry for the original error.

Jeremy.

> 
> 
> 	Andreas
> 
> 
> -- 
> Andreas Schneider                   GPG-ID: CC014E3D
> Samba Team                             asn at samba.org
> www.samba.org

> From a6f562a4ae623b708ec35928c6f5099d6b5ae1b0 Mon Sep 17 00:00:00 2001
> From: Andreas Schneider <asn at samba.org>
> Date: Tue, 4 Apr 2017 11:07:36 +0200
> Subject: [PATCH] s3:tests: Create a test directory for a clean test
> 
> The test fails on openSUSE Tumbleweed with:
> 
> NT_STATUS_FILE_IS_A_DIRECTORY opening remote file \foo\bar\testfile
> 
> This cleans up the code to create a directory 'test' which can be
> completely removed so nothing will stay behind. It also makes sure that
> all parent directories are created and the files have some content.
> 
> https://bugzilla.samba.org/show_bug.cgi?id=12721
> 
> Signed-off-by: Andreas Schneider <asn at samba.org>
> ---
>  source3/script/tests/test_smbclient_s3.sh | 35 ++++++++++++++-----------------
>  1 file changed, 16 insertions(+), 19 deletions(-)
> 
> diff --git a/source3/script/tests/test_smbclient_s3.sh b/source3/script/tests/test_smbclient_s3.sh
> index 9bff883f63f..a7bffcbd632 100755
> --- a/source3/script/tests/test_smbclient_s3.sh
> +++ b/source3/script/tests/test_smbclient_s3.sh
> @@ -1100,29 +1100,26 @@ EOF
>  test_nosymlinks()
>  {
>  # Setup test dirs.
> -    slink_name="$LOCAL_PATH/nosymlinks/source"
> -    slink_target="$LOCAL_PATH/nosymlinks/target"
> -    mkdir_target="$LOCAL_PATH/nosymlinks/a"
> -    dir1="$LOCAL_PATH/nosymlinks/foo"
> -    dir2="$LOCAL_PATH/nosymlinks/foo/bar"
> -    get_target="$LOCAL_PATH/nosymlinks/foo/bar/testfile"
> -
> -    rm -f $slink_target
> -    rm -f $slink_name
> -    rm -rf $mkdir_target
> -    rm -rf $dir1
> +    test_dir="$LOCAL_PATH/nosymlinks/test"
>  
> -    touch $slink_target
> +    slink_name="$test_dir/source"
> +    slink_target="$test_dir/target"
> +    foobar_dir="$test_dir/foo/bar"
> +    get_target="$test_dir/foo/bar/testfile"
> +
> +    rm -rf $test_dir
> +
> +    mkdir -p $test_dir
> +    echo "$slink_target" > $slink_target
>      ln -s $slink_target $slink_name
>  
> -    mkdir $dir1
> -    mkdir $dir2
> -    touch $get_target
> +    mkdir -p $foobar_dir
> +    echo "$get_target" > $get_target
>  
>  # Getting a file through a symlink name should fail.
>      tmpfile=$PREFIX/smbclient_interactive_prompt_commands
>      cat > $tmpfile <<EOF
> -get source
> +get test\\source
>  quit
>  EOF
>      cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/nosymlinks -I $SERVER_IP $ADDARGS < $tmpfile 2>&1'
> @@ -1149,8 +1146,8 @@ EOF
>  
>  # But we should be able to create and delete directories.
>      cat > $tmpfile <<EOF
> -mkdir a
> -mkdir a\\b
> +mkdir test\\a
> +mkdir test\\a\\b
>  quit
>  EOF
>      cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/nosymlinks -I $SERVER_IP $ADDARGS < $tmpfile 2>&1'
> @@ -1176,7 +1173,7 @@ EOF
>  
>  # Ensure regular file/directory access also works.
>      cat > $tmpfile <<EOF
> -cd foo\\bar
> +cd test\\foo\\bar
>  ls
>  get testfile -
>  quit
> -- 
> 2.12.2
> 




More information about the samba-technical mailing list