tytso@athena.mit.edu.UUCP (11/25/87)
Bug:
When shell builtins bomb out in .logout, the logout is aborted.
Repeat by:
(don't do this as root :-)
Script started on Tue Nov 24 17:15:42 1987
<tytso@paris> {/mit/t/y/tytso}, Level 2
1% mv .logout .logout.real
<tytso@paris> {/mit/t/y/tytso}, Level 2
2% cat >.logout
kill 1
^D
<tytso@paris> {/mit/t/y/tytso}, Level 2
3% ln -s /bin/csh -
<tytso@paris> {/mit/t/y/tytso}, Level 2
4% - <===== Fake a login shell
IBM RT<n>? ^C <===== Abort login sequenece
<tytso@paris> {/mit/t/y/tytso}, Level 3
1% logout
1: Not owner
<tytso@paris> {/mit/t/y/tytso}, Level 3
2% logout
1: Not owner
<tytso@paris> {/mit/t/y/tytso}, Level 3
3% logout
1: Not owner
<tytso@paris> {/mit/t/y/tytso}, Level 3
4% logout
1: Not owner
<tytso@paris> {/mit/t/y/tytso}, Level 3
5% ^D
logout
1: Not owner
<tytso@paris> {/mit/t/y/tytso}, Level 2
5% ^D
script done on Tue Nov 24 17:16:57 1987
Fix:
*** /source/4.3/bin/tcsh/sh.c Sat Nov 21 23:02:31 1987
--- sh.c Tue Nov 24 17:35:21 1987
***************
*** 697,702 ****
--- 697,703 ----
goodbye()
{
rechist();
+ child++; /* On errors, DIE! */
if (loginsh) {
(void) signal(SIGQUIT, SIG_IGN);
#ifdef COMPAT42
jonathan@cs.keele.ac.uk (Jonathan Knight) (11/23/88)
Os: Ultrix 1.2A
Bug: The csh dirs command is documented as producing an
abbreviated output form using ~ unless the -l option
is used. However if `dirs` is used the full path name
is returned without the -l option.
Example:
% dirs
~
% dirs -l
/fs/cs/jonathan
% echo `dirs`
/fs/cs/jonathan
% echo `dirs -l`
/fs/cs/jonathan
echo `dirs` should have produced ~.
--
_____ Jonathan Knight, || JANET: jonathan@uk.ac.keele.cs
/ Department of Computer Science || UUCP: ...!ukc!kl-cs!jonathan
/ _ __ University of Keele, Keele, || BITNET: jonathan%cs.kl.ac.uk@
(_/ (_) / / Staffordshire. ST5 5BG. U.K. || ---------------- ukacrl.bitnetjonathan@cs.keele.ac.uk (Jonathan Knight) (11/23/88)
In article <428@kl-cs.UUCP>, jonathan@cs.keele.ac.uk (Jonathan Knight) writes: > Bug: The csh dirs command is documented as producing an > abbreviated output form using ~ unless the -l option > is used. However if `dirs` is used the full path name > is returned without the -l option. > % echo `dirs` > /fs/cs/jonathan > echo `dirs` should have produced ~. Ooops. The dirs command does produce the ~ output, but it is expanded into /fs/cs/jonathan by the shell. % echo "`dirs`" ~ The expansion is suppressed by putting "'s around the `dirs`. -- _____ Jonathan Knight, || JANET: jonathan@uk.ac.keele.cs / Department of Computer Science || UUCP: ...!ukc!kl-cs!jonathan / _ __ University of Keele, Keele, || BITNET: jonathan%cs.kl.ac.uk@ (_/ (_) / / Staffordshire. ST5 5BG. U.K. || ---------------- ukacrl.bitnet
chris@mimsy.UUCP (Chris Torek) (11/24/88)
In article <428@kl-cs.UUCP> jonathan@cs.keele.ac.uk (Jonathan Knight) writes: >Bug: The csh dirs command is documented as producing an > abbreviated output form using ~ unless the -l option > is used. However if `dirs` is used the full path name > is returned without the -l option. This is not the case. >Example: > % dirs > ~ > % echo `dirs` > /fs/cs/jonathan > > echo `dirs` should have produced ~. But % echo ~ would produce /fs/cs/jonathan and not ~ The text returned from backquote expansion is re-globbed unless quoted (or `noglob' is set). After % set noglob the commands % echo ~ % echo `dirs` % unset noglob % echo "`dirs`" all produce ~ -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris
dvk@sei.cmu.edu (Daniel Klein) (04/26/91)
Well, here's an interesting one! Try typing: % echo hello & while (1) ? end The "echo hello" gets executed at each loop of the while. A similar bug does not exist with foreach, though. -- ============ -- =========== -- =========== -- =========== -- =========== -- "The only thing that separates us from the animals is superstition and mindless rituals" (Latke) Daniel Klein CMU-SEI +1 412/268-7791 dvk@sei.cmu.edu
rbj@uunet.UU.NET (Root Boy Jim) (04/26/91)
In article <24610@as0c.sei.cmu.edu> dvk@sei.cmu.edu (Daniel Klein) writes: > >Well, here's an interesting one! Try typing: > >% echo hello & while (1) >? end > >The "echo hello" gets executed at each loop of the while. A similar bug >does not exist with foreach, though. You should know better than to try this. Csh is intrinsicly broken. Anyway, it's not a bug, it's a feature. It's documented: The foreach, switch, and while statements, as well as the if-then-else form of the if statement require that the major keywords appear in a single simple command on an input line as shown below. Sun says it better: Each occurrence of a foreach, switch, while, if...then and else built-in must appear as the first word on its own input line. BTW, don't try piping to them or I/O redirection either. Another broken feature: for integer values of X & Y try: (repeat X repeat Y echo foo) | wc -l What is printed is not X*Y, but rather X+Y-1. No one cares enuf to fix csh. -- [rbj@uunet 1] stty sane unknown mode: sane