[BusyBox] run-parts bug report

Nick Fedchik fnm at fusion.ukrsat.com
Thu Nov 21 07:12:03 UTC 2002


To solve my problem, I made a few debug changes to the
libbb/run_parts.c:

extern int run_parts(char **args, const unsigned char test_mode)
{
...
        for (i = 0; i < entries; i++) {
                printf("concat args[0]=%s and namelist[%d]->d_name=%s\n",
                        args[0], i, namelist[i]->d_name);
...
        if ((pid = vfork()) < 0) {
               perror_msg_and_die("failed to fork");
	} else {
        	if (!pid) {
                	args[0] = filename;
                        j=0;
                         while (args[j]!=NULL) {
                         	printf("vfork child: args[%d]=%s\n", j, args[j]);
                                j++;
                         };
                         execv(filename, args);
                         exec_errno = errno;
                         _exit(1);
                 }
        }
...

Then recompile busybox, and reinstall, etc...

Here is output:
~ # run-parts -a start /etc/rc.d
concat args[0]=/etc/rc.d and namelist[0]->d_name=00_ifconfig
vfork child: args[0]=/etc/rc.d/00_ifconfig
vfork child: args[1]=start
Starting network interfaces: inside dmz1 dmz2 dmz3 dmz4 outside done
concat args[0]=/etc/rc.d/00_ifconfig and namelist[1]->d_name=01_bridge
run-parts: failed to stat component ХE.@ХE. at d/00_ifconfig/01_bridge: No
such file or directory
~ #

As I seen, parent's args[0] was changed by child.
So at the second loop turn:
filename = concat_path_file("/etc/rc.d/00_ifconfig", "01_bridge");

How? and why?
Is it invalid vfork() here?

-- 
Nick Fedchik <fnm at ukrsat.com>
FNM3-RIPE (-UANIC)




More information about the busybox mailing list