[comp.sys.amiga.tech] SKsh Version 1.4 Stack Problems with Lattice "C" Programs..

rickf@theweav.cts.com (Rick Flower) (06/06/90)

I've been using SKsh version 1.4 for quite some time now and have gotten
quite used to the way it works and I'm very happy with it.. However, I do
get quite frustrated when I try to run virtually ANY "stock" program that
was compiled under Lattice "C" and the program puts up a requester saying
something about "Stack Overflow.." and telling me to abort the program..
The ONLY way that I've been able to run these programs is to type "newcli"
and run the application from that window instead of through SKsh.. The
problem does seem to be something that is caught by Lattice's startup.o
routine before the "C" code's 'main' is even called..  I don't believe that
I am doing anything incorrect (please flame me if I've setup something
incorrectly and don't know it!).. I'm just curious if anyone else is
running into this problem.. (and yes, I'm running AmigaDos 1.3)




--


+-----------------------------------------------------------------------------+
| Anonymous Quote : "You should be happy you don't live in Los Angeles.." ukn |
+------------------------------------------------------+----------------------+
| UUCP : {hplabs!hp-sdd ucsd nosc}!crash!theweav!rickf | !!!!!!!!!!!!!!!!!!!! |
| ARPA : crash!theweav!rickf@nosc.mil                  | This Space for Sale, |
| INET : rickf@theweav.cts.com                         | Lease, Trade, Borrow,|
| SNAIL: P.O. Box 3907, Torrance, Ca 90717             | Rental, & Consumation|
+------------------------------------------------------+----------------------+

jesup@cbmvax.commodore.com (Randell Jesup) (06/08/90)

In article <00237.AA00237@theweav.cts.com> rickf@theweav.cts.com (Rick Flower) writes:
>I've been using SKsh version 1.4 for quite some time now and have gotten
>quite used to the way it works and I'm very happy with it.. However, I do
>get quite frustrated when I try to run virtually ANY "stock" program that
>was compiled under Lattice "C" and the program puts up a requester saying
>something about "Stack Overflow.." and telling me to abort the program..

	Modify the SKsh program-startup code to leave the stack size in
bytes in register D2.

-- 
Randell Jesup, Keeper of AmigaDos, Commodore Engineering.
{uunet|rutgers}!cbmvax!jesup, jesup@cbmvax.cbm.commodore.com  BIX: rjesup  
Common phrase heard at Amiga Devcon '89: "It's in there!"

koren@hpfelg.HP.COM (Steve Koren) (06/08/90)

> quite used to the way it works and I'm very happy with it.. However, I do
> get quite frustrated when I try to run virtually ANY "stock" program that
> was compiled under Lattice "C" and the program puts up a requester saying

Are you sure?  All of SKsh (including the external binaries) was compiled
with Lattice C.

> routine before the "C" code's 'main' is even called..  I don't believe that
> I am doing anything incorrect (please flame me if I've setup something
> incorrectly and don't know it!).. I'm just curious if anyone else is
> running into this problem.. (and yes, I'm running AmigaDos 1.3)

Sigh.  Assuming that you have your stack size set to something reasonable
(try 10000 bytes) then I don't think you're doing anything wrong.  But
this is enough of a problem that I am considering documenting it in the
SKsh manuals.  In short, SKsh does *not* do low level command invocation.
It uses arp's SyncRun() command.  Now, it turns out that without Arp,
invoking programs is a non-trivial thing to do on the Amiga; there are
bazillions of special cases to consider; Execute() is useless, Lattice's
System() crashes on BCPL programs, some methods work with programs
compiled under Lattice but not Manx or vice verca, etc.  Its really a
horrible situation; I was quite frustrated when I ran into it.  The
best solution I found that works in *most* cases is the arp ASyncRun()
command.  However, there are still a few that have problems; I don't
know if these problems are caused by ASyncRun() itself or something
that the Lattice startup code is producing, but in either case, I can't
do anything about it.  All SKsh does is call ASyncRun() after building
up a command line, and I'm pretty much 100% sure that this command
line is being built correctly.

Just out of curiousity, what are the programs you are having problems
with?  I haven't seen this problem with more than maybe 1% of all
programs.

Perhaps this situation will get better in AmigaDos 2.0 if there is a
*real* way to invoke *all* programs that is supported by Commodore.
Until then, I'm more or less stuck, unless I do alot of really
low level mucking around that I really don't want to do.


        - steve

PS - Just a brief note to all those who were asking for ARexx
     support in SKsh - its implemented and will appear in 1.5.
     Its asynchronous, too - you don't have to type a command to
     SKsh to get it to listen to Arp - it will do that anytime that
     is not doing something else.

koren@hpfelg.HP.COM (Steve Koren) (06/09/90)

Ooops - I wrote that SKsh uses ASyncRun() - it actually uses SyncRun()
most of the time.

jesup@cbmvax.commodore.com (Randell Jesup) (06/10/90)

In article <13920066@hpfelg.HP.COM> koren@hpfelg.HP.COM (Steve Koren) writes:
>do anything about it.  All SKsh does is call SyncRun() after building
>up a command line, and I'm pretty much 100% sure that this command
>line is being built correctly.

	The problem is with a bug in the lattice 5.0x startup code that I
found a while back.  It so happened they were looking for the stack size
on the stack (normally a safe thing to do).  Unfortunately, during some
edit of the c.a source, someone pushed regs on the stack first.  It so
happened that the reg that now appeared in the spot being checked for the
stack size was the contents of D2, which just happened to be the stack size
in RunCommand() (which launches CLI programs), so it worked.  It has since
been fixed (in 5.05 or maybe it will be in 5.06, lattice knows about it).
It was a little error, that normally would have been noticed immediately,
but they happened to get so lucky it didn't show until you use an alternate
program invokation.

>Perhaps this situation will get better in AmigaDos 2.0 if there is a
>*real* way to invoke *all* programs that is supported by Commodore.
>Until then, I'm more or less stuck, unless I do alot of really
>low level mucking around that I really don't want to do.

	RunCommand() and System() (plus the flexible CreateNewProc).  It's
in there. ;-)

-- 
Randell Jesup, Keeper of AmigaDos, Commodore Engineering.
{uunet|rutgers}!cbmvax!jesup, jesup@cbmvax.cbm.commodore.com  BIX: rjesup  
Common phrase heard at Amiga Devcon '89: "It's in there!"

dick@woodwrk.UUCP (Richard H. Wood, Garland, TX, USA) (06/12/90)

>In article <13920066@hpfelg.HP.COM> koren@hpfelg.HP.COM (Steve Koren) writes:
>
>        - steve
>
>PS - Just a brief note to all those who were asking for ARexx
>     support in SKsh - its implemented and will appear in 1.5.
>     Its asynchronous, too - you don't have to type a command to
>     SKsh to get it to listen to Arp - it will do that anytime that
>     is not doing something else.


      Hip, hip, hooray!!!

--
d.
___________   _______   
Dick Wood//  / \   / \ |Become an  |  {texbell|texsun}!digi!woodwrk!dick|
     \\ //  /   \ /   \|  Organ    |{egsner|texbell}!lerami!woodwrk!dick|
 Amiga\X/oodwork Bench |      Donor|             dwood@digi.lonestar.org|