Kevin Dalley
2005-Feb-25 23:34 UTC
[Samba] smbclient's tar to /dev/null behaves unexpectedly
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@kelphead.org
Andrew Bartlett
2005-Feb-27 10:06 UTC
[Samba] smbclient's tar to /dev/null behaves unexpectedly
On Fri, 2005-02-25 at 15:34 -0800, Kevin Dalley wrote:> If I use smbclient to create a tar file at /dev/null, it skips most of > the steps. This behaviorCan you prepare this as a patch, mention it on samba-technical, and possibly file a bug? Your reasoning seems sane, but I don't know the history of that file... Andrew Bartlett -- Andrew Bartlett http://samba.org/~abartlet/ Authentication Developer, Samba Team http://samba.org Student Network Administrator, Hawker College http://hawkerc.net -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part Url : http://lists.samba.org/archive/samba/attachments/20050227/28bb5122/attachment.bin