I see.  Indeed, there are other escape sequences that could sneak if if GAP
tries to color its output.

The -E option looks like the key.  I tested like this on my docker image:

[root@f52defcaf0a7 sage-10.9]#  local/bin/gap -r -q --bare --nointeract -c
'Display(JoinStringsWithSeparator(GAPInfo.RootPaths,";"));' > output
[root@f52defcaf0a7 sage-10.9]# od -a output
0000000 esc   [   ?   1   0   3   4   h   /   v   a   r   /   t   m   p
0000020   /   s   a   g   e   -   1   0   .   9   /   l   o   c   a   l
0000040   /   l   i   b   /   g   a   p   /   ;   /   v   a   r   /   t
0000060   m   p   /   s   a   g   e   -   1   0   .   9   /   l   o   c
0000100   a   l   /   s   h   a   r   e   /   g   a   p   /  nl
0000116
[root@f52defcaf0a7 sage-10.9]#  local/bin/gap -E -r -q --bare --nointeract
-c 'Display(JoinStringsWithSeparator(GAPInfo.RootPaths,";"));' > output
[root@f52defcaf0a7 sage-10.9]# od -a output
0000000   /   v   a   r   /   t   m   p   /   s   a   g   e   -   1   0
0000020   .   9   /   l   o   c   a   l   /   l   i   b   /   g   a   p
0000040   /   ;   /   v   a   r   /   t   m   p   /   s   a   g   e   -
0000060   1   0   .   9   /   l   o   c   a   l   /   s   h   a   r   e
0000100   /   g   a   p   /  nl
0000106

Note that using Print does not help with this issue, but is still probably
a good idea to avoid other escape sequences:

[root@f52defcaf0a7 sage-10.9]#  local/bin/gap -r -q --bare --nointeract -c
'Print(JoinStringsWithSeparator(GAPInfo.RootPaths,";"), "\n");' > output
[root@f52defcaf0a7 sage-10.9]# od -a output
0000000 esc   [   ?   1   0   3   4   h   /   v   a   r   /   t   m   p
0000020   /   s   a   g   e   -   1   0   .   9   /   l   o   c   a   l
0000040   /   l   i   b   /   g   a   p   /   ;   /   v   a   r   /   t
0000060   m   p   /   s   a   g   e   -   1   0   .   9   /   l   o   c
0000100   a   l   /   s   h   a   r   e   /   g   a   p   /  nl
0000116
[root@f52defcaf0a7 sage-10.9]#  local/bin/gap -E -r -q --bare --nointeract
-c 'Print(JoinStringsWithSeparator(GAPInfo.RootPaths,";"), "\n");' > output
[root@f52defcaf0a7 sage-10.9]# od -a output
0000000   /   v   a   r   /   t   m   p   /   s   a   g   e   -   1   0
0000020   .   9   /   l   o   c   a   l   /   l   i   b   /   g   a   p
0000040   /   ;   /   v   a   r   /   t   m   p   /   s   a   g   e   -
0000060   1   0   .   9   /   l   o   c   a   l   /   s   h   a   r   e
0000100   /   g   a   p   /  nl
0000106

So the "belt and suspenders" solution to this problem is to use both -E and
Print in both meson.build and gap/spkg-configure.m4.

- Marc

On Tue, Mar 3, 2026 at 11:42 AM Dima Pasechnik <[email protected]> wrote:

>
>
> On Tue, Mar 3, 2026 at 11:06 AM Marc Culler <[email protected]> wrote:
>
>> Why do you think that disabling ColorPrompt would make a difference, if
>> the escape sequence is being emitted by rl_initialize()?
>>
>
> Well, just trying to be less "fancy-terminals"-bound.
> As well, instead of Display(...) one should run Print(...,"\n"), as
> Display might colour, format, etc. things, if allowed.
> Or, even safer, use 'PrintTo("/tmp/foobar42.txt",..., "\n") and get the
> needed values from "/tmp/foobar42".
> (by  right, these should be in a temp dir etc etc)
>
> But, perhaps much easier might be to add '-E' switch to these GAP calls.
> '-E' means "disable readline (if possible)",
> according to the output of "gap -h". (no idea what "if possible" means)
>
> Dima
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "sage-devel" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/sage-devel/dVVleHx0xP0/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To view this discussion visit
> https://groups.google.com/d/msgid/sage-devel/CAAWYfq0u5iCbyEZX15Tqos%3D40SehuS5%2BwV%3DM6DzSB-Gq4q_u6w%40mail.gmail.com
> <https://groups.google.com/d/msgid/sage-devel/CAAWYfq0u5iCbyEZX15Tqos%3D40SehuS5%2BwV%3DM6DzSB-Gq4q_u6w%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/sage-devel/CALcZXRFF_eW99KkFLCAYwb_obDAmegwB%2BsaFaY7H%3DRVFeqp69w%40mail.gmail.com.

Reply via email to