From: will.senn@gmail.com (Will Senn)
Subject: [TUHS] tar on v6 not creating directories on v6
Date: Sat, 12 Dec 2015 15:53:54 -0600 [thread overview]
Message-ID: <566C9772.9040508@gmail.com> (raw)
All,
I'm stuck trying to determine what is going on with v6tar on v6. It
seems to work ok for files, but gets confused with subdirectories. I set
up a test folder structure:
t/dmr/vs.c
t/dmr/vt.c
t/ken/prf.c
then I created a tarball
tar cvf t.tar t
then I tried to extract the tarball. It made a mess:
# tar xvf t.tar
Tar: blocksize = 17
y ?
tar: t/ken/prf.c - cannot create
y ?
y ?
tar: t/dmr/vs.c - cannot create
y ?
y ?
tar: t/dmr/vt.c - cannot create
That was ugly and all of it was output. What exactly did I wind up with?:
# ls -l
total 19
drwxrwxrwx 2 root 32 Oct 10 12:54 y
-rw-rw-rw- 1 root 8704 Oct 10 12:54 t.tar
Ugh. Probably don't need the y directory...
# rmdir y
y ?
# ls y
y not found
Wow! It appears that I am unable to delete the y directory or list it by
name. That can't be good. Any ideas of how to remove this directory are
welcome.
Not to be deterred by one small failure, I copied the same tarball over
to v7 on the off chance that maybe v6tar isn't really for v6, but more
for moving files(and directories) over to v7 as Haley and Ritchie
describe, and lo and behold tar on v7 is able to extract both files and
directories from the same tarball without any trouble:
# tar xvf t.tar
Tar: blocksize = 17
x t/ken/prf.c, 2301 bytes, 5 tape blocks
x t/dmr/vs.c, 1543 bytes, 4 tape blocks
x t/dmr/vt.c, 834 bytes, 2 tape blocks
# ls -l
total 18
drwxrwxr-x 4 root 64 Dec 31 19:27 t
-rw-rw-r-- 1 root 8704 Dec 31 19:27 t.tar
# ls t
dmr
ken
# ls t/dmr
vs.c
vt.c
# ls t/ken
prf.c
Interesting. After looking at the tar source, the question marks in the
output appear to be coming from somewhere outside of tar (perhaps mkdir
or chown?). Also, the "cannot create" message comes from the following
snippet of the tar source, which looks reasonable:
...
if ((ofile = creat(dblock.dbuf.name, stbuf.st_mode & 07777)) < 0) {
fprintf(stderr, "tar: %s - cannot create\n",
dblock.dbuf.name);
...
I think this error is simply an effect related to the failure to create
the necessary directories properly. The code to do that looks pretty
straightforward:
checkdir(name)
register char *name;
{
register char *cp;
int i;
for (cp = name; *cp; cp++) {
if (*cp == '/') {
*cp = '\0';
if (access(name, 01) < 0) {
if (fork() == 0) {
execl("/bin/mkdir", "mkdir",
name, 0);
execl("/usr/bin/mkdir",
"mkdir", name, 0);
fprintf(stderr, "tar: cannot
find mkdir!\n");
done(0);
}
while (wait(&i) >= 0);
chown(name, stbuf.st_uid, stbuf.st_gid);
}
*cp = '/';
}
}
}
I speculate that chown is causing the "?" to be displayed. Is it safe
enough for me to add printf statements around this code to see what's
going on, or is there a better approach?
Thanks,
Will
next reply other threads:[~2015-12-12 21:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-12 21:53 Will Senn [this message]
2015-12-12 22:23 ` Peter Jeremy
2015-12-12 23:10 ` Will Senn
2015-12-13 4:50 ` Will Senn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=566C9772.9040508@gmail.com \
--to=will.senn@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).