summaryrefslogtreecommitdiff
path: root/source3/script
diff options
context:
space:
mode:
authorChristian Ambach <ambi@samba.org>2018-10-23 20:05:04 +0200
committerKarolin Seeger <kseeger@samba.org>2019-01-07 14:23:36 +0100
commit41889196769973e879657df2bf36cce6ea86eeb8 (patch)
tree6c58bac357ff284dec3d453f8b95ca5baa4a44fe /source3/script
parentb9a1a179e62b14e3831fbd12a50df0c52b8d372d (diff)
downloadsamba-41889196769973e879657df2bf36cce6ea86eeb8.tar.gz
s3:utils/smbget fix recursive download with empty source directories
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13199 Signed-off-by: Christian Ambach <ambi@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Fri Oct 26 09:58:07 CEST 2018 on sn-devel-144 (cherry picked from commit fce0d1b290c7a2205f2454b268b55909d1044f1b) Autobuild-User(v4-9-test): Karolin Seeger <kseeger@samba.org> Autobuild-Date(v4-9-test): Mon Jan 7 14:23:36 CET 2019 on sn-devel-144
Diffstat (limited to 'source3/script')
-rwxr-xr-xsource3/script/tests/test_smbget.sh38
1 files changed, 37 insertions, 1 deletions
diff --git a/source3/script/tests/test_smbget.sh b/source3/script/tests/test_smbget.sh
index 3f0aac53ad3..b0ff75f5eb5 100755
--- a/source3/script/tests/test_smbget.sh
+++ b/source3/script/tests/test_smbget.sh
@@ -43,7 +43,7 @@ remove_test_data()
}
clear_download_area() {
- rm -rf dir1 dir2 testfile
+ rm -rf dir1 dir2 testfile dir001 dir004
}
test_singlefile_guest()
@@ -155,6 +155,39 @@ test_recursive_existing_dir()
return 0
}
+
+test_recursive_with_empty() # see Bug 13199
+{
+ clear_download_area
+ # create some additional empty directories
+ mkdir -p $WORKDIR/dir001/dir002/dir003
+ mkdir -p $WORKDIR/dir004/dir005/dir006
+ $SMBGET -v -R -U$USERNAME%$PASSWORD smb://$SERVER_IP/smbget/
+ rc=$?
+ rm -rf $WORKDIR/dir001
+ rm -rf $WORKDIR/dir004
+ if [ $rc -ne 0 ]; then
+ echo 'ERROR: RC does not match, expected: 0'
+ return 1
+ fi
+
+ cmp --silent $WORKDIR/testfile ./testfile && \
+ cmp --silent $WORKDIR/dir1/testfile1 ./dir1/testfile1 && \
+ cmp --silent $WORKDIR/dir2/testfile2 ./dir2/testfile2
+ if [ $? -ne 0 ]; then
+ echo 'ERROR: file content does not match'
+ return 1
+ fi
+
+ if [ ! -d dir001/dir002/dir003 ] || [ ! -d dir004/dir005/dir006 ]; then
+ echo 'ERROR: empty directories are not present'
+ return 1
+ fi
+
+ return 0
+}
+
+
test_resume()
{
clear_download_area
@@ -246,6 +279,9 @@ testit "recursive download" test_recursive_U \
testit "recursive download (existing target dir)" test_recursive_existing_dir \
|| failed=`expr $failed + 1`
+testit "recursive download with empty directories" test_recursive_with_empty \
+ || failed=`expr $failed + 1`
+
testit "resume download" test_resume \
|| failed=`expr $failed + 1`