Path: utzoo!utgpu!jarvis.csri.toronto.edu!white.toronto.edu!cks Newsgroups: comp.unix.ultrix From: cks@white.toronto.edu (Chris Siebenmann) Subject: Ultrix /bin/sh -- fun for the whole family Message-ID: <1990Feb20.182841.4161@jarvis.csri.toronto.edu> Summary: /bin/sh silently fails if file descriptors 0-9 are in use Date: 20 Feb 90 23:28:41 GMT Lines: 36 The summary says it all. As evidence, make a shell script that produces some output, compile the program below, and execute it, handing it the name of the shell script. On Ultrix 2.2 and 3.1, on both RISC machines and Vaxen, the script will produce no output whatsoever. Better yet, the shell's exit status claims success! We don't run YP locally; I'd be interested in knowing if this happens under YP. /* Illustrate a problem with Ultrix 2.2/3.1 and /bin/sh. */ main(argc, argv) int argc; char **argv; { int i, fd; fd = open("/dev/null", 0); for (i = 3; i < 10; i++) (void) dup2(fd, i); execvp(argv[1], argv+1); perror(argv[1]); exit(1); /*NOTREACHED*/ } This can bite in all sorts of ways, like rn not saving things, and multiply-nested shell scripts not working, and all sorts of other fun things. Does someone with more patience for using typewriters and large multi-carbon forms want to submit an official SPR? -- "I shall clasp my hands together and bow to the corners of the world." Number Ten Ox, "Bridge of Birds" cks@white.toronto.edu ...!{utgpu,utzoo,watmath}!utcsri!white!cks