Maybe a cure is to replace (meval (list '($ev) result '$nouns))) with (retry-integrate result), where
(defun retry-integrate (e)
(let (($opsubst t))
($substitute #'(lambda (&rest l) (apply #'$integrate l)) '%integrate e)))
I've tested this and it seems OK (but my source + rtests have a few differences). For nested integrals,
should this work bottom up? I don't think substitute allows for that control?
(%i4) (a:b,b:c,c:d,d:e,e:f,f:g,g:h,h:i)$
(%i5) integrate(sin(2 *asin(a*x)), x);
(%o5) ((1-b^2*x^2)^(3/2)+sqrt(1-b*x)*sqrt(b*x+1)*(5*b^2*x^2-5))/(6*b)
--Barton
________________________________________
> (let ((*in-risch-p* t)) (meval (list '($ev) result '$nouns)))
>
> I'm not sure that appending '$noeval fixes the (putative) bug.
No, it doesn't fix the bug, although it does show that those calls
to MEVAL are only part of the trouble ...