On Thu, Oct 24, 2024 at 06:40:02PM +0800, Qian Yun wrote: > There was this problem when using fricas(sman) in a pipe, > the output may get truncated at beginning or end. > > I used a workaround before, but now I have find the root cause > and a proper fix. > > First, "expose-bug.patch" in the attachment reverts the workaround > and expose the bug during the book building. > > The root cause is that, the first prompt is send from "FRICASsys" > to "session", skipping "sman", causing a race. > > If "session" gets "(1) -> \0" from "FRICASsys", then gets > "a very long string" from "sman", then the socket may send them > together, so "spadclient" gets this: > > "(1) -> \0a very long string" > > When printed by "fputs", those after '\0' is truncated. > > Now, with my patch, the initial prompt is sent from "FRICASsys" > to terminal, then to "sman", then to "session", then to "spadclient".
That is good catch, we should apply it. However, it looks to me that you eliminated one (significant) problem, but there is still parallel signalling between processes, which may lead to races. That is we should change communication protocal between our processes to be essentially message based. -- Waldek Hebisch -- You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group. To unsubscribe from this group and stop receiving emails from it, send an email to fricas-devel+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/fricas-devel/Z2wRmTOe_iZL6Qzp%40fricas.org.