[comp.mail.mush] bind-macro loops

crehta@tasu77.UUCP (Ran Ever-Hadani) (09/26/89)

If you have a loop in a bind-macro (such as bind-macro r 'replysender -b ...')
mush crashes and dumps core when you try to activate.  Though loops
are wrong, this behavior is not very nice.

Wouldn't it be nice to have some control over the maximum depth of
nesting in bind-macro activation, so that in such cases an inteligent
warning will result, rather than an ugly crash?

-- Ran
-----------------------------------------------
Reply-To: crehta@taux01.nsc.com (Ran Ever-Hadani)
Disclaimer: The above is to be attributed to me only, not to any organization.
Apology: Bad English.  E-mailed spelling and style corrections are welcome.

schaefer@ogccse.ogc.edu (Barton E. Schaefer) (09/27/89)

In article <2646@taux01.UUCP> crehta@taux01.nsc.com (Ran Ever-Hadani) writes:
} If you have a loop in a bind-macro (such as bind-macro r 'replysender -b ...')
} mush crashes and dumps core when you try to activate.  Though loops
} are wrong, this behavior is not very nice.

No kidding.  That is not what should be happening; the macro should abort
when (if) mush runs out of memory, but it shouldn't crash.  Unfortunately,
the problem in this case is stack overflow, which is very hard to detect
in time to avoid a nasty core dump.

BTW, folks, when you report this stuff, please don't just say "crashes
and dumps core" -- at least tell us whether the error is a segmentation
fault or a bus error or (as it is in this case) an illegal instruction.
The different errors occur in different circumstances, so it does help
us if we know, especially if the problem isn't as easy to reproduce as
this one was.

} Wouldn't it be nice to have some control over the maximum depth of
} nesting in bind-macro activation, so that in such cases an inteligent
} warning will result, rather than an ugly crash?

The macro facility is used by all sorts of things in mush -- whenever
typed input needs to be simulated, mush makes an internal call to the
macro code.  It is therefore very difficult to tell whether nesting
results from a recursive macro or from another normal operation of
mush, and limiting the depth of all forms of nesting is impractical.
Head-recursive macros like "bind-macro r reply" should probably be
prohibited or at least warned against, though, because they can never
expand to any sensible result.
-- 
Bart Schaefer           "And if you believe that, you'll believe anything."
                                                            -- DangerMouse
CSNET / Internet                schaefer@cse.ogc.edu
UUCP                            ...{sequent,tektronix,verdix}!ogccse!schaefer