erskine@force10.UUCP (12/03/87)
][b ---------- Files required to reproduce the problem: $ cat init.dom echo hello . ./init.std echo goodbye exit 0 $ cat init.std std_perms() { cat << --EOF-- --EOF-- } $ cat newdom . ./init.std ./init.dom ---------- To reproduce the problem: Create the previous files in one directory, make them executable, and from the Bourne Shell (/bin/sh) type $ ./newdom ---------- I think the output should be: $ ./newdom hello goodbye $ ---------- but on my system I get: $ hello ./init.dom: shell memory fault$ ---------- Commentary: I'm running SCO Xenix System V version 2.2.1, and have found the bug demonstrated by the accompanying files. By moving these files to subdirectories, and making corresponding changes in the scripts, /bin/sh goes into a tight CPU loop, disregarding signals. The problem is that shell functions, unlike variables, get passed on to child shell scripts. The redefinition of the shell function seems to cause a big problem for sh if the function makes use of the << operator. (But only if the function was inherited). Should the function definition actually be inherited by child scripts? If yes, should shell variables also? To check to see, add the command 'set' as the first line in init.dom. If the functions are inherited, the definition of std_perms will be printed along with the environment. I phoned SCO who agreed that it is a bug, but who suggested that it might be appropriate to forbid this usage (redefinition of a shell function). I certainly haven't used many interpreters that didn't allow redefinition of functions. Most importantly, WHAT DOES YOUR /bin/sh DO? Please post to the net, especially if yours doesn't inherit shell functions. If you don't HAVE shell functions at all, LUCKY YOU, you don't have the bug! :-) Neil ||!][b --------- Neil S. Erskine MT&T - (902) 453-4915 x340 AP Computers USENET { garfield, watmath, ihnp4!utzoo!utai, 3845 Dutch Village Rd. uunet } !dalcs!force10!erskine Halifax, N.S. B3L-4H9
davis@hplabsb.UUCP (Jim Davis) (12/15/87)
Neil Erskine <erskine@force10.UUCP> writes: ne> ---------- I think the output should be: ne> $ ./newdom ne> hello ne> goodbye ne> $ ne> ---------- but on my system I get: ne> $ ne> hello ne> ./init.dom: shell memory fault$ This is also a problem on HP-UX (a.k.a. HPUX) 5.5. The symptom is only slightly different. I get the following output: ------------------------------------------------------------- $ ./newdom hello ./init.std: Memory fault in shell: cleaning up. $ ============================================================= My files look like this shar describes. # This is a shell archive. Remove anything before this line, # then unpack it by saving it in a file and typing "sh file". # # Wrapped by davis at hpljwd3 on Mon Dec 14 19:53:28 1987 # # This archive contains: # init.dom init.std newdom echo x - init.dom cat >init.dom <<'@EOF' echo hello . ./init.std echo goodbye exit 0 @EOF chmod 755 init.dom echo x - init.std cat >init.std <<'@EOF' std_perms() { cat << --EOF-- --EOF-- } @EOF chmod 755 init.std echo x - newdom cat >newdom <<'@EOF' . ./init.std ./init.dom @EOF chmod 755 newdom exit 0 ============================================================= (I speak here in *no official capacity*, only as someone who tried it.) Jim Davis davis@hplabs.hp.com