#!/usr/ucb/rdist under SunOS 4.1 fails

Doke scott at udel.EDU
Thu Jul 19 11:17:29 AEST 1990


    I am working on a sun3/50 with SunOS 4.1.  My problem concerns the
interpreter file feature of execve(2).

    I have been in the habit of making interpreter files so everything
is in one executable file.  I ran into a problem which I don't
understand when I tried to do this with rdist(1).  I can work around
it, but would like to know why this doesn't work.  Please reply by
mail, I will summarize to the net.

					    Thanks in advance,
					    Doke Scott




This is my executable file "test".  malcom is another sun3/50 also running 
SunOS 4.1.

#!/usr/ucb/rdist -f
#
hosts = ( scott at malcom.ee.udel.edu )
files = ( ~/rdist/rdist_test )
${files} -> ${hosts}
	install;

If I say 

% rdist -f test

it works fine.  However, if I just say 

% test
updating host malcom.ee.udel.edu
rcmd: socket: Permission denied

The error message comes back immediately.

I found this very confusing, and wrote a little C program to call
rdist:

#include <stdio.h>
main ( argc, argv, envp ) 
int argc;
char **argv, **envp;   {
    int i;
    for ( i = 0; i < argc; i++ )   {
	fputs( argv[i], stdout );
	putchar( ' ' );
	}
    putchar( '\n' );
    fflush( stdout );  /* rdist was erasing the message */
    execve( "/usr/ucb/rdist", argv, envp );
    }

and used it as the interpreter for test.

#!/usa/scott/rdist/a.out -f
#
hosts = ( scott at malcom.ee.udel.edu )
files = ( ~/rdist/rdist_test )
${files} -> ${hosts}
	install;

Now test worked perfectly as a command.

% test
/usa/scott/rdist/a.out -f test 
updating host malcom.ee.udel.edu

I put ps -ugx in a loop in the background and ran the two forms.  Both
appear to produce an identical rdist process.  What's going on?  Please
reply by mail, I will summarize to the net.



More information about the Comp.unix.questions mailing list