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?
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.
Created attachment 1160 [details] Proposed patch.
Please test this patch (applied into SVN). Cheers, Jeremy.
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.
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.
sorry for the same, cleaning up the database to prevent unecessary reopens of bugs.