[Samba] smbclient's tar to /dev/null behaves unexpectedly

Kevin Dalley kevin at kelphead.org
Fri Feb 25 23:34:14 GMT 2005


If I use smbclient to create a tar file at /dev/null, it skips most of
the steps.  This behavior 

If I type something like this:

smbclient '\\puffin\c$' -U 'amanda%password' -E -d1 -Tca /dev/null  '/Kathy/DATA/2120 WNmod/*'

I receive the following message:

Output is /dev/null, assuming dry_run

source/client/clitar.c:

		if (tar_type=='c' && (dry_run || strcmp(argv[Optind], "/dev/null")==0)) {
			if (!dry_run) {
				DEBUG(0,("Output is /dev/null, assuming dry_run\n"));
				dry_run = True;
			}


This is unexpected behavior.  If a person wants to use a dry run, the
"-n" option is available.  The OS will decide what to do when /dev/null is
encountered; smbclient shouldn't know or care whether its bits are
thrown away or kept.

By performing a dry_run, smbclient is skipping the list of the files
in the tar file and the actual transfer of data, something which
setting the output device to /dev/null should not do.  If the user
wants to throw away the data, that is the user's business.


To quote from the GNU standards document, which is generally a worthy
document even if the project is not GNU:

   Likewise, please don't make the behavior of the program depend on
   the type of output device it is used with.  Device independence is
   an important principle of the system's design


Please change these lines:

		if (tar_type=='c' && (dry_run || strcmp(argv[Optind], "/dev/null")==0)) {
			if (!dry_run) {
				DEBUG(0,("Output is /dev/null, assuming dry_run\n"));
				dry_run = True;
			}

to:


		if (tar_type=='c' && dry_run) {


-- 
Kevin Dalley
kevin at kelphead.org


More information about the samba mailing list