rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
* rc, signals, readline, and Linux
@ 1997-03-05  5:55 Tom Culliton
  1997-03-09  4:24 ` Stephen Tell
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Culliton @ 1997-03-05  5:55 UTC (permalink / raw)
  To: rc

8-) 8-) 8-) Anybody who has been paying attention will know that I've
been fighting a battle with the combination mentioned above.  Both rc
and readline like to play with signals, readline always acts like a
slow system call when the signal hanlder returns, and leaves things
FUBAR'ed if it doesn't. 8-) 8-) 8-)

So my big **** eating grin might tell you something. 8-)  Thats right,
unless I've overlooked something really dumb, it's fixed!!!  This fix
probably applies to anyone using readline, especially on Posix type
systems.  Basically it entails ALWAYS treating readline as a slow
system call, retrying the read on EINTR, and doing some deep secret
readline magic in the rc signal catcher.  I'll try to post a context
diff against virgin rc-1.5betadev-1 as soon as I make a few posix-isms
conditional.

Tom (one very tired and happy hacker)


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: rc, signals, readline, and Linux
  1997-03-05  5:55 rc, signals, readline, and Linux Tom Culliton
@ 1997-03-09  4:24 ` Stephen Tell
  0 siblings, 0 replies; 3+ messages in thread
From: Stephen Tell @ 1997-03-09  4:24 UTC (permalink / raw)
  To: Tom Culliton; +Cc: rc

On Wed, 5 Mar 1997, Tom Culliton wrote:

> So my big **** eating grin might tell you something. 8-)  Thats right,
> unless I've overlooked something really dumb, it's fixed!!!  This fix

I've been trying to get rc going on my new linux box recently; 
Tom's patches definitely help a lot.  SIGINT definitely works properly with
readline now.  This is enough improvement that I've installed it as my
default. 

All is not quite perfect, however.

"make trip" hang on the first line in the history section:

history=/tmp/hist.$pid prompt='' echo 'history=()' | $rc -i

No history file is created in /tmp, and "./rc -i" is looping burning
cpu cycles.   

Doing a similar history operation interactively (without -i) seems to work.
I tried compiling rc 1.4 in the same environment with the same readline,
and it does the same thing.

Killing the looping rc -i and doing a postmortem gdb traceback
suggests that the problem is probably readline-related:

liriel;rc-1.5tjc; gdb ./rc core
GDB is free software and you are welcome to distribute copies of it
 under certain conditions; type "show copying" to see the conditions.
There is absolutely no warranty for GDB; type "show warranty" for details.
GDB 4.16 (i586-unknown-linux), Copyright 1996 Free Software Foundation, Inc...
Core was generated by `./rc -i'.
Program terminated with signal 6, IOT trap/Abort.
Reading symbols from /usr/lib/libreadline.so.2.0...done.
Reading symbols from /lib/libc.so.5.3.12...done.
Reading symbols from /lib/ld-linux.so.1...done.
#0  0x4003c77c in ioctl ()
(gdb) bt
#0  0x4003c77c in ioctl ()
#1  0x40016643 in get_tty_settings ()
#2  0x400169a1 in rltty_set_default_bindings ()
#3  0x400106fe in readline_default_bindings ()
#4  0x4001067b in readline_initialize_everything ()
#5  0x40010500 in rl_initialize ()
#6  0x4000f8bc in readline ()
#7  0x8050ff9 in rc_readline (prompt=0x0) at input.c:101
#8  0x8051834 in doit (execit=-1073743311) at input.c:300


Also, gcc makes these complaints while compiling.  I haven't tried
to figure out if they're worth worrying about or not.

input.c: In function `doit':
input.c:260: warning: argument `execit' might be clobbered by `longjmp' or `vfork'
utils.c: In function `writeall':
utils.c:69: warning: argument `buf' might be clobbered by `longjmp' or `vfork'
utils.c:69: warning: argument `remain' might be clobbered by `longjmp' or `vfork'
walk.c: In function `walk':
walk.c:24: warning: argument `n' might be clobbered by `longjmp' or `vfork'

System Info:
Pentium 166
Red Hat Linux 4.0 (kernel 2.0.18)
gcc version 2.7.2
libc 5.3.12
readline is readline-2.0-10.i386.rpm from the Red Hat distribution. 


Thanks for everyone's efforts.  I'll soon try building at work, first on
HP-UX 10.20 and 9.05, then SunOS, Solaris, Mips-Ultrix, and SGI. 

Steve

Steve Tell       tell@cs.unc.edu	W: +1 919 962 1845
Research Associate, Computer Science Department, UNC@Chapel Hill.   
If you're determined to reinvent the wheel, at least try to invent a better one.




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: rc, signals, readline, and Linux
@ 1997-03-09  5:31 Tom Culliton
  0 siblings, 0 replies; 3+ messages in thread
From: Tom Culliton @ 1997-03-09  5:31 UTC (permalink / raw)
  To: culliton, tell; +Cc: rc

> On Wed, 5 Mar 1997, Tom Culliton wrote:

> > So my big **** eating grin might tell you something. 8-)  Thats right,
> > unless I've overlooked something really dumb, it's fixed!!!  This fix
>
> I've been trying to get rc going on my new linux box recently; 
> Tom's patches definitely help a lot.  SIGINT definitely works properly with
> readline now.  This is enough improvement that I've installed it as my
> default. 
>
> All is not quite perfect, however.
>
> "make trip" hang on the first line in the history section:
>
> history=/tmp/hist.$pid prompt='' echo 'history=()' | $rc -i
>
> No history file is created in /tmp, and "./rc -i" is looping burning
> cpu cycles.   

Yeah, I reported this earlier.  You must ahve either missed the
message or it was one of the ones that bounced from the list.  For
some reason this problem occurs with readline under Linux if you don't
link statically.  Go back and look at my configuration patches which
include the proper link switches to make this happen.  What is needed
is somthing like:

	LDFLAGS= -static -lreadline -ltermcap

	:
	:

	rc: $(OBJS)
		$(CC) -o $@ $(OBJS) $(LDFLAGS)

With this rc should trip flawlessly.  I spent a bunch of time fiddling
with it, saw the same stack traces, but decided in the end that it had
already cost enough brain cells, and I really didn't give a hoot if
the binary was statically linked or not.  I'll leave that one for
someone else, who has more experience with dynamic linking under Linux
to solve. ;-) ;-) ;-)

Tom


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1997-03-09  5:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-03-05  5:55 rc, signals, readline, and Linux Tom Culliton
1997-03-09  4:24 ` Stephen Tell
1997-03-09  5:31 Tom Culliton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).