🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

4 total messages Started by Jean-Francois Lamy Thu, 29 Jun 1989 14:08
&& causing bash to dump core, varia
#175
Author: Jean-Francois Lamy
Date: Thu, 29 Jun 1989 14:08
26 lines
1458 bytes
a) a .bashrc that contains

   if [ "$PS1" != "" && $SHLVL -gt 1 ]
   then
	   echo bah
   fi

   will cause bash to dump core; said code appears to produce an error message
   (cryptic as it may be) as it should when the shell is run interactively

b) [ error messages for csh operators used by mistake should be fixed;
   with the large population of tcsh users you can expect to see migrating,
   this will count as a large class of errors while people rewire their
   brains.  I'd really like to see "==": illegal operator, "&&": dumping
   core, and other informative messages.

c) Can the &#^*%&! insertion of a * at the beginning of the prompt when
   a line is edited be turned off?  it appears as well that only the
   prompt is shifted as well, which is disconcerting if not wrong.

d) there should be a wholesale way to get emacs behaviour for cut and
   paste (NUL sets mark, ^W cuts, ^Y pastes).  Few users I know that use
   emacs regularly rely on the pre-tcsh behaviour.

Jean-Francois Lamy               lamy@ai.utoronto.ca, uunet!ai.utoronto.ca!lamy
AI Group, Department of Computer Science, University of Toronto, Canada M5S 1A4
Re: && causing bash to dump core, varia
#176
Author: Jean-Francois Lamy
Date: Thu, 29 Jun 1989 14:46
11 lines
780 bytes
lamy@ai.utoronto.ca (Jean-Francois Lamy) writes:
>a) a .bashrc that contains
>   if [ "$PS1" != "" && $SHLVL -gt 1 ]
>   then
>	   echo bah
>   fi
>   will cause bash to dump core; said code appears to produce an error message
>   (cryptic as it may be) as it should when the shell is run interactively

This is on Sun 3 and Sun 4, SunOS 4.0.1.  I can dig up the debugger should the
bug prove hard to reproduce elsewhere.
Re: && causing bash to dump core
#177
Author: Chet Ramey
Date: Thu, 29 Jun 1989 22:13
54 lines
2733 bytes
In article <89Jun29.104738edt.10370@neat.ai.toronto.edu> lamy@ai.utoronto.ca (Jean-Francois Lamy) writes:
>lamy@ai.utoronto.ca (Jean-Francois Lamy) writes:
>>a) a .bashrc that contains
>>   if [ "$PS1" != "" && $SHLVL -gt 1 ]
>>   then
>>	   echo bah
>>   fi
>>   will cause bash to dump core; said code appears to produce an error message
>>   (cryptic as it may be) as it should when the shell is run interactively
>
>This is on Sun 3 and Sun 4, SunOS 4.0.1.  I can dig up the debugger should the
>bug prove hard to reproduce elsewhere.

It is easy to reproduce (and fairly easy to fix).

First of all, bash is parsing this correctly, and passing an argv to the
test command that looks like {"[","","!=","",0} because && means "run the
command after && if the command before && succeeds". 

The test command, in test_command, checks for the existing of matching
brackets, and calls test_syntax_error if margv[margc] != "]" when 
margv[0] == "[".  Unfortunately, the first thing test_syntax_error does is
fprintf(stderr,"%s: ", argv[0]).  No-no, bang, crash.  `argv' is still
garbage; `margv' is what was passed to test_command.  One possible fix is to 
add the assignment "argv = margv" right before the call to 
test_syntax_error(), to wit (this diff is against vanilla bash 1.01 test.c):

*** test.c.1.01	Fri Jun 23 00:43:13 1989
--- test.c	Thu Jun 29 18:04:10 1989
***************
*** 687,690
        test_exit (SHELL_BOOLEAN (FALSE));
      if (']' != margv[margc][0] || '\000' != margv[margc][1]) {
        test_syntax_error ("missing `]'\n");
      }

--- 687,691 -----
        test_exit (SHELL_BOOLEAN (FALSE));
      if (']' != margv[margc][0] || '\000' != margv[margc][1]) {
+       argv = margv;			/* for test_syntax_error */
        test_syntax_error ("missing `]'\n");
      }


There are other problems with test, I am putting together some fixes that 
will probably go out tomorrow.

Chet


Chet Ramey			"We are preparing to think about contemplating 
Network Services Group, CWRU	 preliminary work on plans to develop a
chet@cwjcc.INS.CWRU.Edu		 schedule for producing the 10th Edition of 
				 the Unix Programmers Manual." -- Andrew Hume
Re: && causing bash to dump core, varia
#199
Author: Paul Placeway
Date: Mon, 03 Jul 1989 14:30
23 lines
1445 bytes
Jean-Francois Lamy writes:
   d) there should be a wholesale way to get emacs behaviour for cut and
      paste (NUL sets mark, ^W cuts, ^Y pastes).  Few users I know that use
      emacs regularly rely on the pre-tcsh behaviour.

What an interesting comment.  First off, I didn't change squat about
bindings when I added the line wraping stuff.  Second, tcsh _does_ do
NUL sets mark, ^W cuts, ^Y pastes; vis:

   morganucodon ~ 6 -> bind ^Y
    ^Y             yank
   morganucodon ~ 7 -> bind ^W
    ^W             kill-region
   morganucodon ~ 8 -> bind ^@
    ^@             set-mark-command
   morganucodon ~ 9 -> echo $version
   tcsh 5.12 (Ohio State) 2/11/89 Patch level 1


On the other hand, I agree that the *s everywhere in the prompt is a
mis-feature.  Perhaps a shell variable to turn it off?

		-- Paul Placeway
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads