[uClibc]busybox chown/chgrp breaks with uclibc on MIPS

Joseph Chiu josephc at idealab.com
Fri May 24 04:45:17 UTC 2002


Hi,

This is on the MIPS platform.  I built a shared-uclibc busybox 0.60.3 with
uclibc top-of-CVS.

busybox chown dies with a segfault.

A small test program that calls chown, linked against the uclibc works.
Busybox chown compiled against glibc works.

It looks like the static initialization of chown_func in chown.c is not
getting done correctly:

in (unmodified) chown.c there is:

static int (*chown_func)(const char *, __uid_t, __gid_t) = chown;

I added this printf to fileAction() to see what’s going on:

+  printf (“calling chown %p %p %p l with %s %d %d”, chown_func, chown,
lchown, fileName, uid, gid);

When I run it:

# ./busybox chown 0 /tmp/x
calling chown 0x40410 0x2ab379c0 0x2ab337c0 l with /tmp/x 0 -1

Segmentation fault

If I modify chown_main, it works:

int chown_main(int argc, char **argv)
{
[.....]
				show_usage();
		}
	}

+	chown_func = chown;

	if (noderefFlag) chown_func = lchown;

# ./busybox chown 0 /tmp/x
calling chown 0x2ab379c0 0x2ab379c0 0x2ab337c0 l with /tmp/x 0 -1





More information about the uClibc mailing list