Looks like the output format of the DEBUG macro change somewhere from 2.2 to 3.0 so that the final tar status output from smbclient now looks like: [2003/09/12 02:30:36, 0] client/clitar.c:process_tar(1431) tar: dumped 832 files and directories [2003/09/12 02:30:36, 0] client/clitar.c:process_tar(1432) Total bytes written: 199168 The extra "process_tar" debug output foils amanda's processing of smbclient's output. While not a big deal, and amanda can be changed to handle it, it seems like the "debug" part of the output is unnecessary since this is "normal" program output. Not sure what samba uses for normal output, but basically I would think this should be done: --- samba-3.0.0rc3/source/client/clitar.c.orig 2003-09-12 09:44:16.000000000 -0600 +++ samba-3.0.0rc3/source/client/clitar.c 2003-09-12 09:44:36.000000000 -0600 @@ -1428,8 +1428,8 @@ close(tarhandle); SAFE_FREE(tarbuf); - DEBUG(0, ("tar: dumped %d files and directories\n", ntarf)); - DEBUG(0, ("Total bytes written: %.0f\n", (double)ttarf)); + printf("tar: dumped %d files and directories\n", ntarf); + printf("Total bytes written: %.0f\n", (double)ttarf); break; }
This code doesn't seem to have changed from 2.2 -> 3.0. It's still a DEBUG(0, ...) in both cases. Are you running smbclient with a different configuration file? If you set the 'debug timestamp' option to true you will not get the extra date and time message for each line in the log file.
It's not the clitar.c code that's changed, it's the way that client.c initializes logging. In 2.2: setup_logging(pname,True); which set interactive to true, which set stdout_logging to True, which disabled the printing of the timestamp header by dbghdr. In 3.0: DEBUGLEVEL_CLASS[DBGC_ALL] = 0; dbf = x_stderr; x_setbuf( x_stderr, NULL ); (perhaps there is other configuration somewhere else?) I don't want to turn off debug timestamp because I still want them in the smb.log files, but I don't want them in the output of smbclient, and which were not present in 2.2.
Note that this is still a problem.. we hit it as well when upgrading our samba as it is also used by amanda for backups here. The patch in the comments is a broken hack from what I can tell though. I have made the following change in our local copy as I think it will be more functional (to be tested tonight.) This is a hack too mind you, not what I would suggest for the proper fix. Not familiar with Samba's debugging facilities enough to propose a proper fix there. --- clitar.c.orig Wed Oct 8 12:10:26 2003 +++ clitar.c Wed Oct 8 12:11:03 2003 @@ -1430,8 +1430,8 @@ close(tarhandle); SAFE_FREE(tarbuf); - DEBUG(0, ("tar: dumped %d files and directories\n", ntarf)); - DEBUG(0, ("Total bytes written: %.0f\n", (double)ttarf)); + x_fprintf(dbf, "tar: dumped %d files and directories\n", ntarf); + x_fprintf(dbf, "Total bytes written: %.0f\n", (double)ttarf); break; } This way it prints to the debug file handle instead of to stdout.. stdout causes problems if you use tar piped to stdout (like smbclient -Tc -). Any Samba members care to fix this the proper way? It is a rather annoying buglet in my opinion.
Created attachment 190 [details] 2nd rev. of hack Just making an attachment because pasting it in as a comment gave some ugly results. Changes two DEBUGs -> x_fprintf's so that Amanda can grok the response properly (otherwise a timestamp is attached, breaing parsing & compatibility.) Solely a hack to make it work until it is fixed in the tree, not intended as a proper fix.
I have similar problems with plain smbclient output. 1. smbclient man page says: - default log level is 0 - Note that specifying this parameter here will override the log level parameter in the smb.conf file. I have "log level = 1" in smb.conf, but smbclient still logs at log level 0. So the man page is confusing, because "..override.." implies that smb.conf is taken as default debuglevel. 2. Due to #1 the line with Domain=[domain] is not printed by smbclient unless I use -d1 on the command line. This break scripts. 3. If I do -d1, I get the Domain=[domain] message twice, with the ugly timestamp: ... [2003/10/25 11:59:56, 1] client/client.c:do_connect(2597) Domain=[WORKGROUP] OS=[Unix] Server=[Unix] [2003/10/25 11:59:56, 1] client/client.c:do_connect(2597) Domain=[WORKGROUP] OS=[Unix] Server=[Unix] .. also note that samba version is not printed (it should be Server=[samba.something]) 4. message Domain=[domain] is to stderr instead of stdout like previous versions; I think this is understandable, but still break scripts :(
I looked at client/client.c, some observations: 1. samba-3.0.0 lacks setup_logging("smbclient",True); which is present in 2.2.x. Adding this will: a) send all messages to stdout (like it happened in 2.x) instead of stderr b) eliminate the [ timestamp file function ] stuff 2. smbclient manpages of 2.2.x and 3.0.0 say that default log level is 0. This is not true for 2.2.x where in the code the debug level is forced at 2. This (samba-3.0.0 doing what is in the docs) may cause problem to scripts. Maybe it would be better to correct docs to say debug is 2 and keep debug to 2? 3. smbclient man page is confusing. ".. Note that specifying this parameter here will over- ride the log level parameter in the smb.conf file..." should be changed into ".. log level setting in smb.conf is completely ignored, always" 4. After editig client.c as in #1 and setting debug to 2, "smbclient -L server" output is more similar to previous versions, but for the fact that previous would say: Domain=[WORKGROUP] OS=[Unix] Server=[Samba.something] 3.0.0: Doing spnego session setup (blob length=58) Domain=[WORKGROUP] OS=[Unix] Server=[Unix] Doing spnego session setup (blob length=58) Domain=[WORKGROUP] OS=[Unix] Server=[Unix] Could you, samba team, put the spnego debug to higher level than 2 and eliminate duplicate? Thanks
I'm wondering if the is just a docs bug. My output looks like the following: $ ./smbtar -s test98 -p read -x public -v -l 0 server is test98 share is public\\ tar args is tape is tar.out blocksize is tarmode is now full, system, hidden, noreset, verbose 19968 ( 1300.0 kb/s) \PrintTest1.doc 0 ( 0.0 kb/s) \testing.txt 0 ( 0.0 kb/s) \picture.bmp 9510 ( 1326.7 kb/s) \NETLOG.TXT tar: dumped 4 files and directories Total bytes written: 31232 The key is the 'debug timestamp' option in smb.conf.
ok. I've fixed the the debug timestamp issue in smbclient output. This should take care of Amanda. I've also fixed the Server=[] bug ( bad length return from pull_usc2() ). I also set the debug level to 1 inclient.c so you get the session setup lines line in 2.2. And I moved the spnego debug to level 3 as requested. This will all be in 3.0.2rc1 However the multiple "Domain=[]...." lines will have to stay for now. The issue is that we are doing 2 session setups (one for share listings and one for workgroup listings). This is intentional. You can work around this by restricting smbclient to port 139. E.g. $ bin/smbclient -L windc -U Administrator -p 139 Domain=[BOOKS] OS=[Windows 5.0] Server=[Windows 2000 LAN Manager] Sharename Type Comment --------- ---- ------- public Disk IPC$ IPC Remote IPC NETLOGON Disk Logon server share ADMIN$ Disk Remote Admin SYSVOL Disk Logon server share C$ Disk Default share files Disk Server Comment --------- ------- WINDC Workgroup Master --------- ------- BOOKS WINDC NARNIA ONTEROSE SHELF MAPLE
> I also set the debug level >to 1 inclient.c so you get the session setup lines line in 2.2. 2.2 had debug by default to 2, not to 1. client.c: - DEBUGLEVEL_CLASS[DBGC_ALL] = 1; + DEBUGLEVEL_CLASS[DBGC_ALL] = 2;
is the session setup line necessary for amanda?
amanda is only looking for the "Total number of bytes" line.
sorry for the same, cleaning up the database to prevent unecessary reopens of bugs.