Hello,
There is a guard in hlist_out that check if an enddir is actually matching anything,
his is done with checking dir_done. But dir_done is only set to 1 when a begindir is encountered, and never reset back.
This can lead to a problem with the following:
....\begindir TRT
....\enddir TRT
....\glue(\spaceskip) 3.33 plus 1.665 minus 1.11....\enddir TLT
the first couple save a state, then the spurious enddir restore the coordinates to a bogus value.
This nodes structure can be achieved with e.g.
\textdirection=0
\indent{\textdirection=1} \textdirection=0 abc\bye
Note how the text is at the bottom left of the page.
I attached a patch where dir_done is incremented in the begindir branch, and decreased
if a matched enddir is found.
Thanks,
Udi