[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [PROBLEM] in 2.2.15 busybox tar

On Fri, Jun 09, 2000 at 01:52:43PM -0400, Ben Collins wrote:
> I've discovered a problem in the tar in busybox with boot-floppies 2.2.15.
> I tested with busybox-tar and GNU tar, and it is defenitely in busybox.
> For some reason it is making ./ mode 644 (even though in the base2_2.tgz
> tarball it is 755). This basically means that users are getting a / with
> 644 (-x) perms. I've only seen this on sparc, but the fact that is in
> busybox leads me to believe it is not sparc specific. Concerns me that it
> is not being seen elsewhere.
> I'll look and see where this is coming from though, unless some others can
> check into it.

Ok, I put some printf() statements in tar.c to see what was going on. It
looks like there is a more serious issue involved, and sparc is just
triggering it in a way that shows. The printf's I added were right before
all the calls to chmod(). I had it do this:

	printf("1 changing mode for %s to %o\n", outName, mode);

(the starting number varied so I could trace which call was printing). I
got some odd output from one of the calls, that look like this:

	4 changing mode for order hosts,bind
	multi on
	 to 100644
	error in chmod()

Some others were there with lots more garbage data (the chmod() error check
was added later to confirm). This looks like something is not pointing to
the right part of the header. There looks like there was even some
legitimate chmod()'s that resulted in errors:

	4 changing mode for ./etc/chatscripts/ to 100755
	error in chmod()

Now, this "#4" call was in this code, starting at around line 710 of the
tar.c file:

     * Check if we are done writing to the file now.
    if (dataCc <= 0 && tostdoutFlag == FALSE) {
        struct utimbuf utb;

        if (close(outFd))

        /* Set the file time */
        utb.actime = mtime;
        utb.modtime = mtime;
        utime(outName, &utb);
        /* Set the file permissions */
        chown(outName, uid, gid);
        printf("4 changing mode for %s to %o\n", outName, mode);
        if (chmod(outName, mode))
            printf("error in chmod()\n");

        outFd = -1;

I'm not sure where outName is getting mangled, but it is, and it is
causing problems. On sparc, the current base2_2.tgz is showing it is /
ending up being mode 644, on other archs it could means that things are
not getting the right perms. I'm still tracking the problem though.

/  Ben Collins  --  ...on that fantastic voyage...  --  Debian GNU/Linux   \
`  bcollins@debian.org  --  bcollins@openldap.org  --  bcollins@linux.com  '

Reply to: