exceve problems

Nick Burrett nick at dsvr.net
Tue Jul 31 04:38:39 PDT 2001


Peter Naulls <peter at erble.freeserve.co.uk> writes:

> In message <m3eluazskr.fsf at nick.ws.noc.dsvr.net>
>           Nick Burrett <nick at dsvr.net> wrote:
> 
> [execve]
> 
> > The size of the `proc' structure changed between pre3 and the gccsdk.
> > In fact, __unixinit and `vfork' were largely re-written.  Code compiled
> > against UnixLib built with the gccsdk will not be compatible with
> > code built against pre3 or earlier.
> > 
> > This only affects the exec* and fork functions.
> 
> The reason I ask is because things like this crash:
> 
> #include <unistd.h>
> #include <stdlib.h>
> #include <stdio.h>
> #include <errno.h>
> 
> char *const args[2] = {"cat, ", ""};
> char *const env[1] = {NULL};
> 
> int main()
> {
> 
>   if (vfork() != 0)
>     {
>       printf("Parent\n");
>     }
>   else
>     {
>       printf("Child\n");
>       execve("cat", args, env);
>       printf("Failed: %s\n", strerror(errno));
>       exit(EXIT_SUCCESS);
>     }
> 
>   exit(EXIT_SUCCESS);
> }
> 
> -- execve: environment handlers restored
> ushift((process->envp[i])e59ff400) -> e59ff400
> Internal error: abort on data transfer at &0000A938


Right. After a full two months, I've finally had the time to look
at this.  I've just committed a fix to the 2.95 branch of gccsdk.
It was happening because the child environment was empty.

Nick.



More information about the gcc mailing list