jbw@bucsb.UUCP (Joe Wells) (12/18/88)
I have a question for those of you who are experts on BSD UNIX and the csh. The following command causes severe problems: echo `(cd)` I get the following results on these computers and operating systems: Sun 4/280, SunOS 4.0: Abort ( core dumped ) Encore Multimax 320, UMAX 4.2: IOT trap ( core dumped ) assertion botched: !pargv VAX 11/750, BSD 4.3: Illegal instruction ( core dumped ) Anyone with source access want to look at this? -- Joe Wells INTERNET: jbw%bucsf.bu.edu@bu-it.bu.edu UUCP: ...!harvard!bu-cs!bucsf!jbw IP: [128.197.2.9]
reschly@BRL.MIL (Robert J. Reschly Jr.) (12/18/88)
Joe, On a Gould 6080 running UTX2.0u06 (mostly 4.3ish) with a number of local hacks, the csh did not dump, but the tcsh did. A quick look with adb showed that tcsh was calling strcmp with a NULL pointer. On a Gould with "protection hardware" de-referencing a NULL pointer results in a protection violation and a core dump. It looks like the builtin echo in the tcsh does not check it's arguments. Given that tcsh is derived from csh, I suspect that you are experiencing similar troubles. The csh we are running here is newer than the csh that our installed tcsh is based on. A new, as yet uninstalled, version of tcsh based on the newer csh also passes your test. Later, Bob -------- Phone: (301)278-6678 AV: 298-6678 FTS: 939-6678 Arpa: reschly@BRL.MIL (or BRL.ARPA) UUCP: ...!brl-smoke!reschly Postal: Robert J. Reschly Jr. U.S. Army Ballistic Research Laboratory Systems Engineering and Concepts Analysis Division Advanced Computer Systems Team ATTN: SLCBR-SE (Reschly) APG, MD 21005-5066 (Hey, *I* don't make 'em up!) **** For a good time, call: (303) 499-7111. Seriously! ****
jbw@bucsb.UUCP (Joe Wells) (12/19/88)
Thanks to everyone who sent me a message. I at least found what the real problems was. Here is how to trigger it: alias foo '`cat`' `foo` This causes a subshell (or something) to dump core. Originally, I thought the problem was with `(cd)`. I was under the illusion that aliases were not expanded when sourcing a file or running a script. That was not true. In any case, it causes an error on every version of the csh that I could try it on. Does anyone know why? Thanks. -- Joe Wells INTERNET: jbw%bucsf.bu.edu@bu-it.bu.edu UUCP: ...!harvard!bu-cs!bucsf!jbw IP: [128.197.2.9]
debra@alice.UUCP (Paul De Bra) (12/19/88)
In article <2292@bucsb.UUCP> jbw@bucsf.bu.edu (Joe Wells) writes: >I have a question for those of you who are experts on BSD UNIX and the >csh. The following command causes severe problems: > > echo `(cd)` > You may add: Microvax II, Unix 9Vr2: Illegal instruction - core dumped not very useful i assume :-) Paul. -- ------------------------------------------------------ |debra@research.att.com | uunet!research!debra | ------------------------------------------------------
sow@ulmo1.mt.luth.se (Sven-Ove Westberg) (12/20/88)
In article <17890@adm.BRL.MIL> reschly@BRL.MIL (Robert J. Reschly Jr.) writes: | | Joe, | | On a Gould 6080 running UTX2.0u06 (mostly 4.3ish) with a number of |local hacks, the csh did not dump, but the tcsh did. A quick look with |adb showed that tcsh was calling strcmp with a NULL pointer. ^^^^^^^^^^^^^^^^^^^^^^^^^^ | Given that tcsh is derived from csh, I suspect that you are |experiencing similar troubles. Please note that he got an error on a VAX runnig bsd4.3 also. I took a quick look with dbx and it is NOT a NULL pointer. Sven-Ove Westberg, CAD, University of Lulea, S-951 87 Lulea, Sweden. UUCP: {uunet,mcvax}!enea!cad.luth.se!sow ARPA: sow%cad.luth.se@ucbvax.berkeley.edu (only dumb ARPA mailers) Internet: sow@cad.luth.se Bitnet: sow%cad.luth.se@sekth
greim@sbsvax.UUCP (Michael Greim) (12/20/88)
In article <2294@bucsb.UUCP>, jbw@bucsb.UUCP (Joe Wells) writes: > Thanks to everyone who sent me a message. I at least found what the > real problems was. Here is how to trigger it: > > alias foo '`cat`' > `foo` > > This causes a subshell (or something) to dump core. Originally, I > thought the problem was with `(cd)`. I was under the illusion that > aliases were not expanded when sourcing a file or running a script. > That was not true. > > In any case, it causes an error on every version of the csh that I > could try it on. Does anyone know why? I just took a look at the source of csh. In the routine dobackp it tests for a pointer pargv. If this is set it aborts with a core dump. This pointer is set as long as command substitution is done. This mechanism effectively prevents recursive command substitution. But don't ask me what for :-) I consider this behaviour a bug. When I have time and nobody else has offered a (valid) fix, I will have a look into it. When you do alias abc '`echo ls`' `abc` on a VAX 11/780 with 4.3BSD you get: Illegal instruction (core dumped) : Permission denied. The reason for the first line is the bug in csh, which I have mentioned above: it tries to do a command substitution inside of a command substitution, so it dump core. The result of the command substitution is empty, but csh packs this 'empty' into a word and tries to call the file named 'empty'. When you issue an open or exec with an empty string, you succeed and get the first file in your current directory, which almost certainly is '.', the directory itself. Thus csh tries to execute '.', fails and reports the error using errno. (You can repeat this by just calling 'execl ("", "abc", 0); perror ("HEY");') -mg -- email : greim@sbsvax.informatik.uni-saarland.dbp.de (some mailers might not like this. Then use greim@sbsvax.uucp) or : ...!uunet!unido!sbsvax!greim # include <disclaimers/std.h>
reschly@BRL.MIL (Robert J. Reschly Jr.) (12/21/88)
Sven-Ove, Oh well, there is more than one bug then. Adb definitely showed a NULL pointer in call to strcmp in the case I looked at.... Later, Bob
jbu@sfsup.UUCP (+Urban J.) (05/05/89)
In article <2292@bucsb.UUCP> jbw@bucsf.bu.edu (Joe Wells) writes: >I have a question for those of you who are experts on BSD UNIX and the >csh. The following command causes severe problems: > > echo `(cd)` > The csh that comes with UNIX System V/386 Release 3.2 (The Merged UNIX System V Release 3.2 and XENIX System V Release 2.2.3) does not core dump. It just displays a blank line (as if you typed in echo "") Sincerely, John Ben Urban