Greetings,
I am currently having a problem using smbclient (Samba v2.05a)
running on Solaris 2.5.1 to restore a tar file from a tape drive
onto a Win NT share.
smbclient works successfully when using a tar file on disk,
but is skipping the tar file (created by a third party)
on the tape drive.
The command used is as follows:
smbclient //celeborn/test -U peter -T x /dev/rmt/0
The problem seems to be that the linkflag obtained from the
tape drive is not handled and the file is skipped. The
linkflag appears to be NULL - the code wonders whether it
could be a "gnu tar archive?".
>From reading the code in "clitar.c" the current linkflag
values that are currently handled are: '0', '5', and
'L'.
If the linkflag is any other value (eg NULL) the file is skipped.
I have exprimented with substituting the code for linkflag case '0'
for the default case and removing the "skip_file" - the restore then
works, but as I do not know the details of what the tar linkflag is,
I am unsure how safe this is to do.
Any hints or comments gratefully accepted.
Peter
The relevant debug messages, and code follow:
-----------------------------------------------
(1) DEBUG MESSAGES
...
Reading the next header ...
checksum totals chk=5786 fchk=5786 chksum= 13232
firstb=805D9, secondb=A3E80, len=40
Warning: NULL link flag (gnu tar archive ?) \a\508_c_rle.ps.gz
Skip = 0, cliplist=<NULL>, file=\a\508_c_rle.ps.gz
Skiping file. Size = 2231512
Advancing to next block: a3e80
...
(2) CODE SNIPPETS from "clitar.c"
In clitar.c the problem appears to be due to the linkflag:
/* can't handle some links at present */
if ((hb->dbuf.linkflag != '0') && (hb -> dbuf.linkflag
!= '5')) {
if (hb->dbuf.linkflag == 0) {
DEBUG(6, ("Warning: NULL link flag (gnu tar archive ?) %s\n",
finfo->name));
...
In the following code, since linkflag is NULL, it switches to the
"default" case,
which is to skip the file.
linkflag = ((union hblock *)buffer_p) -> dbuf.linkflag;
switch (linkflag) {
case '0': /* Should use symbolic names--FIXME */
/*
* Skip to the next block first, so we can get the file, FIXME, should
* be in get_file ...
* The 'finfo.size != 0' fix is from Bob Boehmer
<boehmer@worldnet.att.net>
* Fixes bug where file size in tarfile is zero.
*/
if ((finfo.size != 0) && next_block(tarbuf, &buffer_p,
tbufsiz) <=0) {
DEBUG(0, ("Short file, bailing out...\n"));
return;
}
if (!get_file(finfo)) {
DEBUG(0, ("Abandoning restore\n"));
return;
}
break;
case '5':
if (!get_dir(finfo)) {
DEBUG(0, ("Abandoning restore \n"));
return;
}
break;
case 'L':
longfilename = get_longfilename(finfo);
if (!longfilename) {
DEBUG(0, ("abandoning restore\n"));
return;
}
DEBUG(5, ("Long file name: %s\n", longfilename));
break;
default:
skip_file(finfo.size); /* Don't handle these yet */
break;
}
}