The branch, master has been updated via 56e17981712 s3/client: Restore '-E' handling via 5b6493043fc s3/script/tests: Test smbclient -E redirects output to stderr from a26f535dedc s3:libads: Clear previous CLDAP ping flags when reusing the ADS_STRUCT
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 56e179817123b40c3646476563d345d8f97efff9 Author: Noel Power <noel.po...@suse.com> Date: Mon May 23 17:23:41 2022 +0100 s3/client: Restore '-E' handling Sometimes we really do need to redirect output to stderr e.g. when using the tar command to output the archive to stdout we don't want debug or cmdline status messages straying into stdout. was removed with commit: e4474ac0a540c56548b4d15e38f2e234455e19b6 remove known fail for the test BUG: https://bugzilla.samba.org/show_bug.cgi?id=15075 Signed-off-by: Noel Power <noel.po...@suse.com> Autobuild-User(master): Noel Power <npo...@samba.org> Autobuild-Date(master): Tue May 24 10:29:27 UTC 2022 on sn-devel-184 commit 5b6493043fc90a2bed5aaedad3b4511621d0b9fd Author: Noel Power <noel.po...@suse.com> Date: Mon May 23 20:11:13 2022 +0100 s3/script/tests: Test smbclient -E redirects output to stderr Add new test to ensure smbclient is writing to stderr (with '-E') Add knownfail for this test (will be removed when issue is fixed in later commit) BUG: https://bugzilla.samba.org/show_bug.cgi?id=15075 Signed-off-by: Noel Power <noel.po...@suse.com> ----------------------------------------------------------------------- Summary of changes: source3/client/client.c | 5 ++++ source3/script/tests/test_smbclient_s3.sh | 45 +++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) Changeset truncated at 500 lines: diff --git a/source3/client/client.c b/source3/client/client.c index 15e32d379f0..9f9954b7e96 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -6552,6 +6552,11 @@ int main(int argc,char *argv[]) print_sockaddr(dest_ss_str, sizeof(dest_ss_str), &dest_ss); } break; + case 'E': + setup_logging("smbclient", DEBUG_STDERR ); + display_set_stderr(); + break; + case 'L': query_host = talloc_strdup(frame, poptGetOptArg(pc)); if (!query_host) { diff --git a/source3/script/tests/test_smbclient_s3.sh b/source3/script/tests/test_smbclient_s3.sh index 3da37e699e6..fc608bdfc9b 100755 --- a/source3/script/tests/test_smbclient_s3.sh +++ b/source3/script/tests/test_smbclient_s3.sh @@ -2043,6 +2043,47 @@ EOF return 0 } +test_smbclient_minus_e_stderr() +{ + cmd='$SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp -c ls' + eval echo "$cmd" + out=`eval $cmd` + if [ $? != 0 ] ; then + echo "$out" + echo "command failed" + return 1 + fi + + # test smbclient 'ls' command output went to stdout + echo "$out" | grep "blocks available" >/dev/null 2>&1 + if [ $? != 0 ] ; then + # didn't get output to stdout + echo "expected output was NOT output to stdout" + return 1 + fi + + # this time execute ls but redirect stdout alone to /dev/null + cmd='$SMBCLIENT -E "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp -c "ls" 2>&1 > /dev/null' + eval echo "$cmd" + out=`eval $cmd` + if [ $? != 0 ] ; then + echo "$out" + echo "command failed" + return 1 + fi + + # test smbclient 'ls' command output went to stderr + echo "$out" | grep "blocks available" >/dev/null 2>&1 + if [ $? != 0 ] ; then + # didn't get output to stderr + echo "expected output was NOT output to stderr" + return 1 + fi + + return 0 + +} + # # LOGDIR_PREFIX=test_smbclient_s3 @@ -2068,6 +2109,10 @@ testit "noninteractive smbclient -l does not prompt" \ test_noninteractive_no_prompt -l $LOGDIR || \ failed=`expr $failed + 1` +testit "smbclient output goes to stderr when -E is passed" \ + test_smbclient_minus_e_stderr || \ + failed=`expr $failed + 1` + testit "interactive smbclient prompts on stdout" \ test_interactive_prompt_stdout || \ failed=`expr $failed + 1` -- Samba Shared Repository