Bug 2605 - -Tx continues to restore tarfile even if -D failed
-Tx continues to restore tarfile even if -D failed
Status: CLOSED FIXED
Product: Samba 3.0
Classification: Unclassified
Component: smbclient
3.0.10
All Solaris
: P3 normal
: none
Assigned To: Samba Bugzilla Account
Samba QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2005-04-13 20:34 UTC by Daniel Patterson
Modified: 2005-08-24 10:25 UTC (History)
0 users

See Also:


Attachments
Minimal, untested patch to abort do_tar_op if do_cd fails (487 bytes, patch)
2005-04-13 20:49 UTC, Daniel Patterson
no flags Details
Proposed patch. (1.27 KB, patch)
2005-04-14 17:37 UTC, Jeremy Allison
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Patterson 2005-04-13 20:34:27 UTC
I'm trying to restore a tar file to a directory in a share.  I'm using the
following command line:

  smbclient -g //hostname/c$ -D restore/path -Uuser pass -Wdomain -Tx backup.tar

If restore/path is valid, everything works as expected.
If restore/path is invalid, smbclient unpacks the tar file anyway, but puts it
in the root of the share (not what I wanted or expected)!

Client is Samba 3.0.10 for Solaris 5.8 from Sunfreeware.  Server is Windows 2003
Server standard.

Here's the output of smbclient when it works (using "-D temp")

Domain=[NAB] OS=[Windows Server 2003 3790] Server=[Windows Server 2003 5.2]
restore directory \temp\
restore directory \temp\metasuite\
restore directory \temp\metasuite\local\
restore directory \temp\metasuite\local\bin\
restore tar file \temp\metasuite\local\bin\BH671BA0 of size 662520 bytes
restore directory \temp\metasuite\local\source\
restore tar file \temp\metasuite\local\source\BH671M00.MGL of size 1711961 bytes
tar: restored 7 files and directories

And here's what it looks like when it fails (using "-D temp/foo/bar")

Domain=[NAB] OS=[Windows Server 2003 3790] Server=[Windows Server 2003 5.2]
cd \temp\foo\bar\: NT_STATUS_OBJECT_NAME_NOT_FOUND
restore directory \
restore directory \metasuite\
restore directory \metasuite\local\
restore directory \metasuite\local\bin\
restore tar file \metasuite\local\bin\BH671BA0 of size 662520 bytes
restore directory \metasuite\local\source\
restore tar file \metasuite\local\source\BH671M00.MGL of size 1711961 bytes
tar: restored 7 files and directories

Should smbclient not exit with a nonzero return code if the original CD fails?
Comment 1 Daniel Patterson 2005-04-13 20:49:40 UTC
Created attachment 1152 [details]
Minimal, untested patch to abort do_tar_op if do_cd fails

I believe this is the behaviour I want to see.	However, I haven't tried
compiling this (I have no compiler on Solaris), but it looks about right.

There are a bunch of other client commands that should probably behave this way
too, so this patch should just be seen as an example of the desired behaviour.
Comment 2 Jeremy Allison 2005-04-14 17:37:40 UTC
Created attachment 1160 [details]
Proposed patch.
Comment 3 Jeremy Allison 2005-04-14 17:39:52 UTC
Please test this patch (applied into SVN).
Cheers,
Jeremy.
Comment 4 Daniel Patterson 2005-04-14 17:54:09 UTC
Yup, that does the trick, thankyou!

Should a more generic "smbclient continues even if -D fails" issue be opened? 
It looks like there are a few cases of do_cd being called and it's return value
ignored.  I can't think of a case where I *wouldn't* want smbclient to die.
Comment 5 Jeremy Allison 2005-04-14 18:02:54 UTC
Actually I fixed all the other uses of do_cd() while I was at it, so I've
already done this. Ok, I'll close it out now.
Jeremy.
Comment 6 Gerald (Jerry) Carter 2005-08-24 10:25:08 UTC
sorry for the same, cleaning up the database to prevent unecessary reopens of bugs.