[SCM] Samba Shared Repository - branch v4-13-test updated

Karolin Seeger kseeger at samba.org
Wed Dec 2 14:50:03 UTC 2020


The branch, v4-13-test has been updated
       via  585c49f21f7 vfs_glusterfs: print exact cmdline for disabling write-behind translator
       via  587fa331f62 manpages/vfs_glusterfs: Mention silent skipping of write-behind translator
       via  2ea7b5c43e8 selftest: Remove samba3.blackbox.smbclient_tar from flapping tests
       via  8cec2732890 clitar: Use do_list()'s recursion in clitar.c
       via  2954051aa6d s3/script/tests: Ensure all remote test files are removed
       via  5f1772d94a3 s3/script/tests: call smbclient deltree to remove remote files
       via  257ce5ed541 s3/script/tests: Make smb_client 'die' behaviour configurable
       via  a0ab7adfd78 s3/script/tests: Remove make_path (for remote dir)
       via  c19198e8732 selftest: make samba3.blackbox.smbclient_tar runnable (even manually)
       via  53a91d6cdc0 s3/script/tests: Fix samba3.blackbox.smbclient_tarmode cleanup
       via  896d93091ab s3/script: Use smbclient deltree to clean up smbclient_tarmode subdir
       via  5908aebf364 s3/script/tests: Use tarmode share for samba3.blackbox.smbclient_tar*
       via  5143b487532 s3/script/test: Use different testdir for samba3.blackbox.smbclient_tarmode
       via  7fb13330380 selftest: Add a new tarmode shares
       via  d67c3ea864b s3/script/tests: Fix 'Unrecognized option(s) passed to mkpath()' error
       via  e9b2be96ebc Revert "vfs_ceph: drop fdopendir handler"
      from  441bf80265f smbclient: Fix recursive mget

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-13-test


- Log -----------------------------------------------------------------
commit 585c49f21f7db686f479ce02b2ae647a313f1184
Author: Günther Deschner <gd at samba.org>
Date:   Tue Nov 24 15:38:41 2020 +0100

    vfs_glusterfs: print exact cmdline for disabling write-behind translator
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14486
    
    Guenther
    
    Signed-off-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Anoop C S <anoopcs at samba.org>
    
    Autobuild-User(master): Günther Deschner <gd at samba.org>
    Autobuild-Date(master): Fri Nov 27 17:15:07 UTC 2020 on sn-devel-184
    
    (cherry picked from commit 369c1d539837b70e94fe9d533d44860c8a9380a1)
    
    Autobuild-User(v4-13-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-13-test): Wed Dec  2 14:49:18 UTC 2020 on sn-devel-184

commit 587fa331f62f6bd36fdb8688c8d0734d02f07ee8
Author: Anoop C S <anoopcs at samba.org>
Date:   Thu Nov 5 16:12:09 2020 +0530

    manpages/vfs_glusterfs: Mention silent skipping of write-behind translator
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14486
    
    Signed-off-by: Anoop C S <anoopcs at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>
    
    Autobuild-User(master): Günther Deschner <gd at samba.org>
    Autobuild-Date(master): Mon Nov  9 13:30:06 UTC 2020 on sn-devel-184
    
    (cherry picked from commit be03ce7d8bb213633eedcfc3299b8d9865a3c67f)

commit 2ea7b5c43e814faef44cf76b5ffad93e4a2f4840
Author: Noel Power <noel.power at suse.com>
Date:   Mon Nov 30 09:21:50 2020 +0000

    selftest: Remove samba3.blackbox.smbclient_tar from flapping tests
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14581
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 89e2d68bb4d93dc391af97f35ff1148aec7930b0)

commit 8cec27328904e47462051878db2de97033ecbd9b
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Dec 1 08:58:14 2020 +0100

    clitar: Use do_list()'s recursion in clitar.c
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14581
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Aurelien Aptel <aaptel at samba.org>
    Reviewed-by: Noel Power <noel.power at suse.com>
    (cherry picked from commit 20e0ce508844fec2dd0011423b10484dc7ccfdb7)

commit 2954051aa6db3b38d24801fe451019ccec0b5c77
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Nov 30 17:19:29 2020 +0000

    s3/script/tests: Ensure all remote test files are removed
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14581
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Noel Power <noel.power at suse.com>
    (cherry picked from commit 16ffa17ee28edfc3bc70c66abf41b5518aeab8fe)

commit 5f1772d94a34922a4fc83ff8a036cbb3ce2dcdd5
Author: Noel Power <noel.power at suse.com>
Date:   Mon Nov 30 10:41:57 2020 +0000

    s3/script/tests: call smbclient deltree to remove remote files
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14581
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 6c7dc4959fd5de4382aee413b4cc711cc6f281f4)

commit 257ce5ed541c0e46bbd565bd8a89d5905287897c
Author: Noel Power <noel.power at suse.com>
Date:   Mon Nov 30 10:18:32 2020 +0000

    s3/script/tests: Make smb_client 'die' behaviour configurable
    
    smb_client behaviour is to die if there is an error. This is
    a little heavy handed and make it impossible for example to
    use smb_client to run a command that might fail (where such
    a failure isn't really an error) E.G. Calling deltree and
    the directory doesn't exist
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14581
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 363bfa4e1ca10e64057a6d04d6faff7c788db89d)

commit a0ab7adfd788bc8cc58579b94c75386d492c2e02
Author: Noel Power <noel.power at suse.com>
Date:   Mon Nov 30 09:59:58 2020 +0000

    s3/script/tests: Remove make_path (for remote dir)
    
    LOCALPATH is actually the local path to the share, we should
    not need to create the share path (it should already exist)
    
    Note: When we remove the tree located at LOCALPATH we keep the root
          so the share path should always be there
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14581
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 99ffa4a98287f125e45690e87b32616f4d4254e4)

commit c19198e873224c07a19dfae14d3871c577768344
Author: Noel Power <noel.power at suse.com>
Date:   Mon Nov 30 11:15:06 2020 +0000

    selftest: make samba3.blackbox.smbclient_tar runnable (even manually)
    
    samba3.blackbox.smbclient_tar is marked as flapping so it
    seems we have missed that it has stopped working. The local path
    passed to script/tests/test_smbclient_tarmode.pl must point to a
    valid share
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14581
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 6f246658cf003f7e2f393f7b7490d9e8ae84e21c)

commit 53a91d6cdc0e726d741ab217522da3f205392090
Author: Noel Power <noel.power at suse.com>
Date:   Mon Nov 30 17:39:25 2020 +0000

    s3/script/tests: Fix samba3.blackbox.smbclient_tarmode cleanup
    
    Make sure samba3.blackbox.smbclient_tarmode removes data files
    not just before running the test but also after
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14581
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 4bb3bffa4b7a770d36138c45f717a9048ef82cff)

commit 896d93091abe6b667c52e87273f22a91d9175eb0
Author: Noel Power <noel.power at suse.com>
Date:   Fri Nov 27 15:52:27 2020 +0000

    s3/script: Use smbclient deltree to clean up smbclient_tarmode subdir
    
    Replace rm -rf of local dir (that is hosted remotely)
    with smbclient deltree
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14581
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit fec1f8faffd9eb1aae77e7c515e57897be34a255)

commit 5908aebf364802e7315aad8f116ad431544ac29d
Author: Noel Power <noel.power at suse.com>
Date:   Fri Nov 27 15:33:26 2020 +0000

    s3/script/tests: Use tarmode share for samba3.blackbox.smbclient_tar*
    
    After this change both samba3.blackbox.smbclient_tar &
    samba3.blackbox.smbclient_tarmode now use the same dedicated share
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14581
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit be8dca68f89f110ef5947e0c2a7258554772cf9a)

commit 5143b4875328196ed2766ba077055ce50704b5e2
Author: Noel Power <noel.power at suse.com>
Date:   Fri Nov 27 15:25:21 2020 +0000

    s3/script/test: Use different testdir for samba3.blackbox.smbclient_tarmode
    
    The other tarmode torture test samba3.blackbox.smbclient_tar now uses a share
    'tarmode' which uses the same source path as samba3.blackbox.smbclient_tarmode
    
    Avoid conflicting paths and use a new subdir (of the test share) called
    'smbclient_tarmode'
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14581
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 6cb0a00f4ab4bc1a8193d50cc076ec7174a5ece9)

commit 7fb1333038085529334e8e3109e5eda6b5df14ae
Author: Noel Power <noel.power at suse.com>
Date:   Thu Nov 26 17:31:50 2020 +0000

    selftest: Add a new tarmode shares
    
    samba3.blackbox.smbclient_tar & samba3.blackbox.smbclient_tar
    need separate shares with own xattr tdb(s)
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14581
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit a250f73366983d2a7397608a611f295f10dbb548)

commit d67c3ea864b26e440f15162e429dec199e7304e8
Author: Noel Power <noel.power at suse.com>
Date:   Fri Nov 27 12:01:49 2020 +0000

    s3/script/tests: Fix 'Unrecognized option(s) passed to mkpath()' error
    
    'keep_root' is an unrecognised option for make_path/mkpath
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14581
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 4f5a7f11b7732c3efb511e68f6b9d434d59bb3e8)

commit e9b2be96ebcc2dc8da8174f3333a744eff06f716
Author: David Disseldorp <ddiss at samba.org>
Date:   Mon Oct 5 12:28:27 2020 +0200

    Revert "vfs_ceph: drop fdopendir handler"
    
    This reverts commit 76d7d05b1da6c0703b1c2bade0c4467c7cc1adec.
    OpenDir_fsp() no longer falls back to regular open, so this hook is
    required.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=14519
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Samuel Cabrero <scabrero at samba.org>
    
    Autobuild-User(master): David Disseldorp <ddiss at samba.org>
    Autobuild-Date(master): Mon Oct  5 12:38:34 UTC 2020 on sn-devel-184
    
    (cherry picked from commit 83ab59d929a6319c18341cb69d5084b563fb59bb)

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

Summary of changes:
 docs-xml/manpages/vfs_glusterfs.8.xml          |  9 ++++
 selftest/flapping                              |  1 -
 selftest/target/Samba3.pm                      | 11 +++++
 source3/client/clitar.c                        | 41 ++++-------------
 source3/modules/vfs_ceph.c                     | 15 +++++--
 source3/modules/vfs_glusterfs.c                |  7 ++-
 source3/script/tests/test_smbclient_tarmode.pl | 62 ++++++++++++++++++++++----
 source3/script/tests/test_smbclient_tarmode.sh | 29 ++++++++----
 source3/selftest/tests.py                      | 12 ++---
 9 files changed, 124 insertions(+), 63 deletions(-)


Changeset truncated at 500 lines:

diff --git a/docs-xml/manpages/vfs_glusterfs.8.xml b/docs-xml/manpages/vfs_glusterfs.8.xml
index 7a4da1af919..d25135e14ac 100644
--- a/docs-xml/manpages/vfs_glusterfs.8.xml
+++ b/docs-xml/manpages/vfs_glusterfs.8.xml
@@ -179,7 +179,16 @@
                 translator and refuse to connect if detected.
                 Please disable the write-behind translator for the GlusterFS
                 volume to allow the plugin to connect to the volume.
+                The write-behind translator can easily be disabled via calling
+                <programlisting>
+                        gluster volume set <volumename> performance.write-behind off
+                </programlisting> on the commandline.
 	</para>
+        <para>
+                With GlusterFS versions >= 9, we silently bypass write-behind
+                translator during initial connect and failure is avoided.
+        </para>
+
 </refsect1>
 
 
diff --git a/selftest/flapping b/selftest/flapping
index c9f0adbf1bd..8c3f9e8969a 100644
--- a/selftest/flapping
+++ b/selftest/flapping
@@ -31,6 +31,5 @@
 # This test just is not reliable in finding the max search limit
 #
 ^samba4.ldap.notification.python\(.*\).__main__.LDAPNotificationTest.test_max_search
-^samba3.blackbox.smbclient_tar.* # fails very, very often on sn-devel
 ^samba3.blackbox.smbclient_s3.*.sending a message to the remote server # flakey on sn-devel-104 and sn-devel-144
 ^samba3.blackbox.smbclient_s3.*.creating a good symlink and deleting it by path # flakey on sn-devel-104 and sn-devel-144
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index 0a8cefa811d..e141f102ef1 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -1334,6 +1334,9 @@ sub setup_fileserver
 	my $tarmode_sharedir="$share_dir/tarmode";
 	push(@dirs,$tarmode_sharedir);
 
+	my $tarmode2_sharedir="$share_dir/tarmode2";
+	push(@dirs,$tarmode2_sharedir);
+
 	my $smbcacls_sharedir="$share_dir/smbcacls";
 	push(@dirs,$smbcacls_sharedir);
 
@@ -1362,6 +1365,14 @@ sub setup_fileserver
 
 	get quota command = $prefix_abs/getset_quota.py
 	set quota command = $prefix_abs/getset_quota.py
+[tarmode]
+	path = $tarmode_sharedir
+	comment = tar test share
+	xattr_tdb:file = $prefix_abs/tarmode-xattr.tdb
+[tarmode2]
+	path = $tarmode2_sharedir
+	comment = tar test share
+	xattr_tdb:file = $prefix_abs/tarmode2-xattr.tdb
 [spotlight]
 	path = $share_dir
 	spotlight = yes
diff --git a/source3/client/clitar.c b/source3/client/clitar.c
index 3fe3622aba6..4fd1f3c47d9 100644
--- a/source3/client/clitar.c
+++ b/source3/client/clitar.c
@@ -711,7 +711,7 @@ static int tar_create(struct tar* t)
 			goto out_close;
 		}
 		DBG(5, ("tar_process do_list with mask: %s\n", mask));
-		status = do_list(mask, TAR_DO_LIST_ATTR, get_file_callback, false, true);
+		status = do_list(mask, TAR_DO_LIST_ATTR, get_file_callback, true, true);
 		if (!NT_STATUS_IS_OK(status)) {
 			DBG(0, ("do_list fail %s\n", nt_errstr(status)));
 			err = 1;
@@ -806,7 +806,7 @@ static int tar_create_from_list(struct tar *t)
 			DBG(5, ("cd '%s' before do_list\n", base));
 			client_set_cur_dir(base);
 		}
-		status = do_list(mask, TAR_DO_LIST_ATTR, get_file_callback, false, true);
+		status = do_list(mask, TAR_DO_LIST_ATTR, get_file_callback, true, true);
 		if (base != NULL) {
 			client_set_cur_dir(start_dir);
 		}
@@ -837,7 +837,7 @@ static NTSTATUS get_file_callback(struct cli_state *cli,
 	char *remote_name;
 	char *old_dir = NULL;
 	char *new_dir = NULL;
-	const char *initial_dir = client_get_cur_dir();
+	const char *initial_dir = dir;
 	bool skip = false;
 	bool isdir;
 	int rc;
@@ -846,7 +846,7 @@ static NTSTATUS get_file_callback(struct cli_state *cli,
 		return NT_STATUS_NO_MEMORY;
 	}
 
-	remote_name = talloc_asprintf(ctx, "%s%s", initial_dir, finfo->name);
+	remote_name = talloc_asprintf(ctx, "%s\\%s", initial_dir, finfo->name);
 	if (remote_name == NULL) {
 		status = NT_STATUS_NO_MEMORY;
 		goto out;
@@ -884,35 +884,10 @@ static NTSTATUS get_file_callback(struct cli_state *cli,
 		goto out;
 	}
 
-	if (isdir) {
-		char *mask;
-		mask = talloc_asprintf(ctx, "%s*", new_dir);
-		if (mask == NULL) {
-			status = NT_STATUS_NO_MEMORY;
-			goto out;
-		}
-		mask = client_clean_name(ctx, mask);
-		if (mask == NULL) {
-			status = NT_STATUS_NO_MEMORY;
-			goto out;
-		}
-
-		rc = tar_get_file(&tar_ctx, remote_name, finfo);
-		if (rc != 0) {
-			status = NT_STATUS_UNSUCCESSFUL;
-			goto out;
-		}
-
-		client_set_cur_dir(new_dir);
-		do_list(mask, TAR_DO_LIST_ATTR, get_file_callback, false, true);
-		client_set_cur_dir(old_dir);
-		tar_ctx.numdir++;
-	} else {
-		rc = tar_get_file(&tar_ctx, remote_name, finfo);
-		if (rc != 0) {
-			status = NT_STATUS_UNSUCCESSFUL;
-			goto out;
-		}
+	rc = tar_get_file(&tar_ctx, remote_name, finfo);
+	if (rc != 0) {
+		status = NT_STATUS_UNSUCCESSFUL;
+		goto out;
 	}
 
 out:
diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c
index 0378d633782..a87d162e573 100644
--- a/source3/modules/vfs_ceph.c
+++ b/source3/modules/vfs_ceph.c
@@ -306,9 +306,18 @@ static DIR *cephwrap_fdopendir(struct vfs_handle_struct *handle,
 			       const char *mask,
 			       uint32_t attributes)
 {
-	/* OpenDir_fsp() falls back to regular open */
-	errno = ENOSYS;
-	return NULL;
+	int ret = 0;
+	struct ceph_dir_result *result;
+	DBG_DEBUG("[CEPH] fdopendir(%p, %p)\n", handle, fsp);
+
+	ret = ceph_opendir(handle->data, fsp->fsp_name->base_name, &result);
+	if (ret < 0) {
+		result = NULL;
+		errno = -ret; /* We return result which is NULL in this case */
+	}
+
+	DBG_DEBUG("[CEPH] fdopendir(...) = %d\n", ret);
+	return (DIR *) result;
 }
 
 static struct dirent *cephwrap_readdir(struct vfs_handle_struct *handle,
diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c
index 17e945f7e78..10af7e131b2 100644
--- a/source3/modules/vfs_glusterfs.c
+++ b/source3/modules/vfs_glusterfs.c
@@ -345,9 +345,12 @@ static int check_for_write_behind_translator(TALLOC_CTX *mem_ctx,
 	if (write_behind_present) {
 		DBG_ERR("Write behind translator is enabled for "
 			"volume (%s), refusing to connect! "
-			"Please check the vfs_glusterfs(8) manpage for "
+			"Please turn off the write behind translator by calling "
+			"'gluster volume set %s performance.write-behind off' "
+			"on the commandline. "
+			"Check the vfs_glusterfs(8) manpage for "
 			"further details.\n",
-			volume);
+			volume, volume);
 		return -1;
 	}
 
diff --git a/source3/script/tests/test_smbclient_tarmode.pl b/source3/script/tests/test_smbclient_tarmode.pl
index 877eec45cc8..bdbbd1a44a8 100755
--- a/source3/script/tests/test_smbclient_tarmode.pl
+++ b/source3/script/tests/test_smbclient_tarmode.pl
@@ -1,5 +1,4 @@
 #!/usr/bin/perl
-
 # Unix SMB/CIFS implementation.
 # Test suite for the tar backup mode of smbclient.
 # Copyright (C) Aurélien Aptel 2013
@@ -304,6 +303,8 @@ sub test_creation_attr {
     @inc = grep { $_->attr('a') && !$_->attr_any('h', 's') } @all;
     smb_tar('tarmode inc nohidden nosystem', '-Tc', $TAR, $DIR);
     $err += check_tar($TAR, \@inc);
+    # adjust attr so remote files can be deleted with deltree
+    File::walk(sub { $_->set_attr(qw/n r s h/) }, File::tree($DIR));
 
     $err;
 }
@@ -399,7 +400,10 @@ sub test_creation_incremental {
     } else {
         smb_tar('', '-Tcg', $TAR, $DIR);
     }
-    return check_tar($TAR, \@files);
+    my $res = check_tar($TAR, \@files);
+    # adjust attr so remote files can be deleted with deltree
+    File::walk(sub { $_->set_attr(qw/n r s h/) }, File::tree($DIR));
+    return $res
 }
 
 
@@ -917,8 +921,22 @@ Remove all files in the server C<$DIR> (not root)
 sub reset_remote {
     # remove_tree($LOCALPATH . '/'. $DIR);
     # make_path($LOCALPATH . '/'. $DIR);
-    remove_tree($LOCALPATH, {keep_root => 1});
-    make_path($LOCALPATH, {keep_root => 1});
+    my $DIR;
+    my @names;
+    my $name;
+
+    smb_client_cmd(0, '-c', "deltree ./*");
+
+    # Ensure all files are gone.
+
+    opendir(DIR,$LOCALPATH) or die "Can't open $LOCALPATH\n";
+    @names = readdir(DIR) or die "Unable to read $LOCALPATH\n";
+    closedir(DIR);
+    foreach $name (@names) {
+	next if ($name eq ".");   # skip the current directory entry
+	next if ($name eq "..");  # skip the parent  directory entry
+	die "$LOCALPATH not empty\n";
+    }
 }
 
 =head3 C<reset_tmp( )>
@@ -1120,7 +1138,9 @@ sub check_tar {
     return (@more + @less + @diff); # nb of errors
 }
 
-=head3 C<smb_client ( @args )>
+=head3 C<smb_client_cmd( $will_die, @args)>
+
+=head3 C<smb_client_cmd( 0, '-c', 'deltree', $somedir )>
 
 Run smbclient with C<@args> passed as argument and return output.
 
@@ -1131,11 +1151,12 @@ the command-line are already inserted.
 
 The output contains both the C<STDOUT> and C<STDERR>.
 
-Die if smbclient crashes or exits with an error code.
+if C<$will_die> then Die if smbclient crashes or exits with an error code.
+otherwise return output
 
 =cut
-sub smb_client {
-    my (@args) = @_;
+sub smb_client_cmd {
+    my ($will_die, @args) = @_;
 
     my $fullpath = "//$HOST/$SHARE";
     my $cmd = sprintf("%s %s %s",
@@ -1168,11 +1189,34 @@ sub smb_client {
     }
 
     if ($err) {
-        die "ERROR: $errstr";
+	if ($will_die) {
+		die "ERROR: $errstr";
+	} else {
+		say "ERROR: $errstr";
+	}
     }
     return $out;
 }
 
+=head3 C<smb_client ( @args )>
+
+Run smbclient with C<@args> passed as argument and return output.
+
+Each element of C<@args> becomes one escaped argument of smbclient.
+
+Host, share, user, password and the additionnal arguments provided on
+the command-line are already inserted.
+
+The output contains both the C<STDOUT> and C<STDERR>.
+
+Die if smbclient crashes or exits with an error code.
+
+=cut
+sub smb_client {
+    my (@args) = @_;
+    return smb_client_cmd(1, @args)
+}
+
 sub smb_cmd {
     return smb_client('-c', join(' ', @_));
 }
diff --git a/source3/script/tests/test_smbclient_tarmode.sh b/source3/script/tests/test_smbclient_tarmode.sh
index 3779c38a5ca..8bc5b9947cf 100755
--- a/source3/script/tests/test_smbclient_tarmode.sh
+++ b/source3/script/tests/test_smbclient_tarmode.sh
@@ -94,7 +94,7 @@ test_tarmode_creation() {
 	# Clear temp data
 	rm -rf -- "$PREFIX"/tarmode > /dev/null 2>&1
 	rm -f "$PREFIX"/tarmode.tar > /dev/null 2>&1
-	rm -rf "$LOCAL_PATH" > /dev/null 2>&1
+	$SMBCLIENT //$SERVER/tarmode $CONFIGURATION -U$USERNAME%$PASSWORD -c "deltree smbclient_tar"
 
 	# Build the test data
 	if ! create_test_data "$LOCAL_PATH"; then
@@ -104,14 +104,15 @@ test_tarmode_creation() {
 	fi
 
 	# Create tarfile with smbclient
-	if ! $SMBCLIENT //$SERVER/tmp $CONFIGURATION -U$USERNAME%$PASSWORD -I $SERVER_IP -p 139 \
-			$ADDARGS -c "tarmode full" -Tc "$PREFIX/tarmode.tar" "/tarmode"; then
+	if ! $SMBCLIENT //$SERVER/tarmode $CONFIGURATION -U$USERNAME%$PASSWORD -I $SERVER_IP -p 139 \
+			$ADDARGS -c "tarmode full" -Tc "$PREFIX/tarmode.tar" "/smbclient_tar"; then
 		echo "Couldn't create tar file with tarmode -Tc"
 		false
 		return
 	fi
 
-	# Extract data to verify
+	# Extract data to verify - this puts it into $PREFIX/smbclient_tar/
+	# but we must leave it there as it's used to verify in test_tarmode_extraction()
 	if ! tar -xf "$PREFIX/tarmode.tar" -C "$PREFIX"; then
 		echo "Couldn't extract data from created tarfile"
 		false
@@ -119,12 +120,16 @@ test_tarmode_creation() {
 	fi
 
 	# Verify data
-	if ! validate_data "$PREFIX/tarmode" "$LOCAL_PATH"; then
+	if ! validate_data "$PREFIX/smbclient_tar" "$LOCAL_PATH"; then
 		echo "Data not equivalent"
 		false
 		return
 	fi
 
+	# Clear temp data
+	rm -rf -- "$PREFIX"/tarmode > /dev/null 2>&1
+	rm -f "$PREFIX"/tarmode.tar > /dev/null 2>&1
+	$SMBCLIENT //$SERVER/tarmode $CONFIGURATION -U$USERNAME%$PASSWORD -c "deltree smbclient_tar"
 	true
 	return
 
@@ -136,7 +141,7 @@ test_tarmode_extraction() {
 	# Clear temp data
 	rm -rf -- "$PREFIX"/tarmode > /dev/null 2>&1
 	rm -f "$PREFIX"/tarmode.tar > /dev/null 2>&1
-	rm -rf "$LOCAL_PATH" > /dev/null 2>&1
+	$SMBCLIENT //$SERVER/tarmode $CONFIGURATION -U$USERNAME%$PASSWORD -c "deltree smbclient_tar"
 
 	# Build the test data
 	if ! create_test_data "$PREFIX/tarmode"; then
@@ -146,14 +151,14 @@ test_tarmode_extraction() {
 	fi
 
 	# Create tarfile to extract on client
-	if ! tar -cf "$PREFIX/tarmode.tar" -C "$PREFIX" tarmode; then
+	if ! tar -cf "$PREFIX/tarmode.tar" -C "$PREFIX" smbclient_tar; then
 		echo "Couldn't create tar archive"
 		false
 		return
 	fi
 
 	# Extract tarfile with smbclient
-	if ! $SMBCLIENT //$SERVER/tmp $CONFIGURATION -U$USERNAME%$PASSWORD -I $SERVER_IP -p 139 \
+	if ! $SMBCLIENT //$SERVER/tarmode $CONFIGURATION -U$USERNAME%$PASSWORD -I $SERVER_IP -p 139 \
 			$ADDARGS -c "tarmode full" -Tx "$PREFIX/tarmode.tar"; then
 		echo "Couldn't extact tar file with tarmode -Tx"
 		false
@@ -161,12 +166,18 @@ test_tarmode_extraction() {
 	fi
 
 	# Verify data
-	if ! validate_data "$PREFIX/tarmode" "$LOCAL_PATH"; then
+	if ! validate_data "$PREFIX/smbclient_tar" "$LOCAL_PATH"; then
 		echo "Data not equivalent"
 		false
 		return
 	fi
 
+	# Clear temp data
+	rm -rf -- "$PREFIX"/tarmode > /dev/null 2>&1
+	rm -f "$PREFIX"/tarmode.tar > /dev/null 2>&1
+	$SMBCLIENT //$SERVER/tarmode $CONFIGURATION -U$USERNAME%$PASSWORD -c "deltree smbclient_tar"
+	# Cleanup the verification data created by test_tarmode_creation().
+	rm -rf "$PREFIX"/smbclient_tar > /dev/null 2>&1
 	true
 	return
 
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index f9202f3f93a..27dc7587b17 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -476,23 +476,23 @@ for env in ["fileserver"]:
     plantestsuite("samba3.blackbox.smbclient_tarmode.NT1", env + "_smb1_done",
                   [os.path.join(samba3srcdir, "script/tests/test_smbclient_tarmode.sh"),
                    '$SERVER', '$SERVER_IP', '$USERNAME', '$PASSWORD',
-                   '$LOCAL_PATH/tarmode', '$PREFIX', smbclient3, configuration, "-mNT1"])
+                   '$LOCAL_PATH/tarmode/smbclient_tar', '$PREFIX', smbclient3, configuration, "-mNT1"])
     plantestsuite("samba3.blackbox.smbclient_tarmode.SMB3", env,
                   [os.path.join(samba3srcdir, "script/tests/test_smbclient_tarmode.sh"),
                    '$SERVER', '$SERVER_IP', '$USERNAME', '$PASSWORD',
-                   '$LOCAL_PATH/tarmode', '$PREFIX', smbclient3, configuration, "-mSMB3"])
+                   '$LOCAL_PATH/tarmode/smbclient_tar', '$PREFIX', smbclient3, configuration, "-mSMB3"])
 
     # Test suite for new smbclient/tar with libarchive (GSoC 13)
     plantestsuite("samba3.blackbox.smbclient_tar.NT1", env + "_smb1_done",
                   [os.path.join(samba3srcdir, "script/tests/test_smbclient_tarmode.pl"),
-                   '-n', '$SERVER', '-i', '$SERVER_IP', '-s', 'tmp',
-                   '-u', '$USERNAME', '-p', '$PASSWORD', '-l', '$LOCAL_PATH/tarmode',
+                   '-n', '$SERVER', '-i', '$SERVER_IP', '-s', 'tarmode2',
+                   '-u', '$USERNAME', '-p', '$PASSWORD', '-l', '$LOCAL_PATH/tarmode2',
                    '-d', '$PREFIX', '-b', smbclient3,
                    '--subunit', '--', configuration, '-mNT1'])
     plantestsuite("samba3.blackbox.smbclient_tar.SMB3", env,
                   [os.path.join(samba3srcdir, "script/tests/test_smbclient_tarmode.pl"),
-                   '-n', '$SERVER', '-i', '$SERVER_IP', '-s', 'tmp',
-                   '-u', '$USERNAME', '-p', '$PASSWORD', '-l', '$LOCAL_PATH/tarmode',
+                   '-n', '$SERVER', '-i', '$SERVER_IP', '-s', 'tarmode2',
+                   '-u', '$USERNAME', '-p', '$PASSWORD', '-l', '$LOCAL_PATH/tarmode2',
                    '-d', '$PREFIX', '-b', smbclient3,
                    '--subunit', '--', configuration, '-mSMB3'])
 


-- 
Samba Shared Repository



More information about the samba-cvs mailing list