Julia script stops in tmux but not outside of tmux

47 views
Skip to first unread message

Rickard Carlsson

unread,
Jul 31, 2021, 6:33:12 AM7/31/21
to tmux-users
Hey!

When I run the following julia script in tmux it just stops on the print statement on the  39th and 40th iteration. If I run it outside of tmux it works just fine. I wront on a julia forum but noone was able to answer me there so I figured it might be more of a tmux issue. I run all of it on archlinux in urxvt using julia version 1.6.1 . 

Thanks in advance.
Regards,
Rickard 

The julia script:
_______________________________________________________
using Base64

buffer3 = "1b37373331363f78151b7f2b783431333d78397828372d363c78373e783a393b3736"
bytesmessage = hex2bytes(buffer3)

function xordecrypt(message::Vector{UInt8}, key::UInt8)
    decryption = Vector{UInt8}()
    for i in message
    push!(decryption, xor(i , key)) # xor works as inverse of xor
    end
    return decryption
end
 
for i in 0x00:0xff
    res = xordecrypt(bytesmessage, i)
    stringus = String(res)
    print(i, " Message: " * stringus * "\n")
end
______________________________________________________________________________________

Nicholas Marriott

unread,
Jul 31, 2021, 6:47:01 AM7/31/21
to Rickard Carlsson, tmux-users
tmux can't stop a program sending output, seems most likely to be a bug in the language runtime.

If you write its output to a file and then cat the file inside tmux, is it complete?


--
You received this message because you are subscribed to the Google Groups "tmux-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tmux-users+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/tmux-users/806b5caf-785d-4552-b54a-1feab7095e28n%40googlegroups.com.

Trey Blancher

unread,
Jul 31, 2021, 7:03:14 AM7/31/21
to Nicholas Marriott, Rickard Carlsson, tmux-users
Rickard,

Your script could be outputting control codes which are meaningful for tmux, and
that may be why it's stopping on those iterations. This is just a guess, I
don't know Julia but that looks like what it may be doing.

Trey Blancher
> an email to [2]tmux-users+...@googlegroups.com.
> To view this discussion on the web, visit
> [3]https://groups.google.com/d/msgid/tmux-users/806b5caf-785d-4552-b54a-1feab7095e28n%40googlegroups.com.
>
> --
> You received this message because you are subscribed to the Google Groups
> "tmux-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [4]tmux-users+...@googlegroups.com.
> To view this discussion on the web, visit
> [5]https://groups.google.com/d/msgid/tmux-users/CAEdLfcGDm87SN8JnGPYj05cJOLipLR6qeanh45w9h14jAaTqCw%40mail.gmail.com.
>
>References
>
> Visible links
> 1. mailto:rickard....@gmail.com
> 2. mailto:tmux-users+...@googlegroups.com
> 3. https://groups.google.com/d/msgid/tmux-users/806b5caf-785d-4552-b54a-1feab7095e28n%40googlegroups.com?utm_medium=email&utm_source=footer
> 4. mailto:tmux-users+...@googlegroups.com
> 5. https://groups.google.com/d/msgid/tmux-users/CAEdLfcGDm87SN8JnGPYj05cJOLipLR6qeanh45w9h14jAaTqCw%40mail.gmail.com?utm_medium=email&utm_source=footer

Rickard Carlsson

unread,
Jul 31, 2021, 7:06:58 AM7/31/21
to tmux-users

Hey!

The script runs succesfully but I get the same issue when I try to cat the output file. I pasted the first 50 iterations from the output file if you want to try it yourself.

thanks

content of output file:

0 Message: 77316?x +x413=x9x(7-6<x7>x:9;76
1 Message: 66207>y ~*y502<y8y)6,7=y6?y;8:67
2 Message: 55134=z })z631?z;z*5/4>z5<z8;954
3 Message: 44025<{ |({720>{:{+4.5?{4={9:845
4 Message: 33752;| {/|0579|=|,3)28|3:|>=?32
5 Message: 22643:} z.}1468}<}-2(39}2;}?<>23
6 Message: 115709~ y-~275;~?~.1+0:~18~<?=10
7 Message: 004618 x, 364: > /0*1; 09 =><01
8 Message: ??;9>7p w#p<9;5p1p ?%>4p?6p213?>
9 Message: >>:8?6q v"q=8:4q0q!>$?5q>7q302>?
10 Message: ==9;<5r u!r>;97r3r"='<6r=4r031=<
11 Message: <<8:=4s t s?:86s2s#<&=7s<5s120<=
12 Message: ;;?=:3t s't8=?1t5t$;!:0t;2t657;:
13 Message: ::><;2u r&u9<>0u4u%: ;1u:3u746:;
14 Message: 99=?81v q%v:?=3v7v&9#82v90v47598
15 Message: 88<>90w p$w;><2w6w'8"93w81w56489
16 Message: ''#!&/h o;h$!#-h)h8'=&,h'.h*)+'&
17 Message: 
&&" '.i
n:i% ",i(i9&<'-i&/i+(*&'
18 Message: %%!#$-j m9j&#!/j+j:%?$.j%,j(+)%$
19 Message: $$ "%,k l8k'" .k*k;$>%/k$-k)*($%
20 Message: ##'%"+l k?l %')l-l<#9"(l#*l.-/#"
21 Message: ""&$#*m j>m!$&(m,m="8#)m"+m/,."#
22 Message: 
!!%' )n
i=n"'%+n/n>!; *n!(n,/-! 
23 Message:   $&!(o h<o#&$*o.o? :!+o )o-., !
24 Message: //+).'`
g3`,)+%`!`0/5.$`/&`"!#/.
25 Message: ..*(/&a f2a-(*$a a1.4/%a.'a# "./
26 Message: --)+,%b e1b.+)'b#b2-7,&b-$b #!-,
27 Message: ,,(*-$c d0c/*(&c"c3,6-'c,%c!" ,-
28 Message: ++/-*#d c7d(-/!d%d4+1* d+"d&%'+*
29 Message: **.,+"e b6e),. e$e5*0+!e*#e'$&*+
30 Message: ))-/(!f a5f*/-#f'f6)3("f) f$'%)(
31 Message: ((,.) g
`4g+.,"g&g7(2)#g(!g%&$()
32 Message: ; X5;_ X X X
X X
33 Message: : Y4:^
Y Y Y Y Y
34 Message: 9 Z79] Z Z Z
Z Z
35 Message: 8 [68\ [ [ [ [ [
36 Message: ? \1?[ \ \ \ \ \
37 Message: > ]0>Z ] ] ]
] ]
38 Message: = ^3=Y
^ ^ ^ ^ ^
39 Message: < _2<X _ _ _
_ _
40 Message: 3 P=3W P P P P P
41 Message: 2 Q<2V Q Q Q Q Q
42 Message: 1 R?1U R R R R R
43 Message: 0 S>0TS S S S S
44 Message: 7 T97S T T T T T
45 Message: 6 U86R U U U U U
46 Message: 5 V;5Q V V V V V
47 Message: 4 W:4P W W W W W
48 Message: + H%+O H
H H H H
49 Message: * I$*N I I I
I I
50 Message: )
J')M J J J J J

Rickard Carlsson

unread,
Jul 31, 2021, 7:16:57 AM7/31/21
to tmux-users
I my initial guess was something similar to you Trey. However I am unsure if that is by design of not. Isn't the output stream and input stream seperate? Also I have my ctrl b mapped to ctrl o but got the same result on an unconfigured tmux.

Trey Blancher

unread,
Jul 31, 2021, 7:23:51 AM7/31/21
to Rickard Carlsson, tmux-users
Rickard,

If you can get the full output to a file outside of tmux, you can check for
non-printing characters in vim. Once the file is loaded in vim, you can hit
Escape to make sure you're in control mode, then type the following:

:set list

That will show control characters, and you'll probably see some things that
could be throwing tmux off.

Trey Blancher
> --
> You received this message because you are subscribed to the Google Groups
> "tmux-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [1]tmux-users+...@googlegroups.com.
> To view this discussion on the web, visit
> [2]https://groups.google.com/d/msgid/tmux-users/74986c79-81a5-46dc-b092-7f3430956dabn%40googlegroups.com.
>
>References
>
> Visible links
> 1. mailto:tmux-users+...@googlegroups.com
> 2. https://groups.google.com/d/msgid/tmux-users/74986c79-81a5-46dc-b092-7f3430956dabn%40googlegroups.com?utm_medium=email&utm_source=footer

Nicholas Marriott

unread,
Jul 31, 2021, 7:33:07 AM7/31/21
to Rickard Carlsson, tmux-users
Can you attach the file instead of pasting it into an email? Or run it through cat -v and paste that.

--
You received this message because you are subscribed to the Google Groups "tmux-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tmux-users+...@googlegroups.com.

Rickard Carlsson

unread,
Jul 31, 2021, 7:48:58 AM7/31/21
to tmux-users
Ok so I am unable to attach files for some reason so I upploaded it to a google drive. here is the link: https://drive.google.com/file/d/1J5BKOrIdFjePgXNm5SljydpONkwSRXHg/view?usp=sharing

thanks

Andreas Perstinger

unread,
Aug 1, 2021, 4:12:34 AM8/1/21
to tmux-...@googlegroups.com
On 31.07.21 12:33, Rickard Carlsson wrote:
> When I run the following julia script in tmux it just stops on the print
> statement on the 39th and 40th iteration.

The line starting with "40 Message" contains an undefined/never-ending
ANSI escape sequence:

$ grep -a '^40 Message' output | hexdump -C
00000000 34 30 20 4d 65 73 73 61 67 65 3a 20 33 1f 1f 1b |40 Message: 3...|
00000010 19 1e 17 50 3d 33 57 03 50 1c 19 1b 15 50 11 50 |...P=3W.P....P.P|
00000020 00 1f 05 1e 14 50 1f 16 50 12 11 13 1f 1e 0a |.....P..P......|
0000002f

The byte 0x1b (last one in the first line) starts the escape sequence
("ESC["). But the following bytes (0x19, 0x1e, 0x17) are outside the
allowed values and tmux seems to ignore them.
It then comes across 0x50 which is the control code for starting a device
control string (DCS). Now it collects all the rest of the bytes until it
finds the string terminator (ST, "ESC[\" or 0x1b 0x5c). But there is no
such sequence in the rest of your output so there's nothing else to output.

Here are some demo strings which should explain tmux's behavior:

$ echo -e '\x1b\x12\x13foobar'
oobar

(0x12 and 0x13 are ignored, ESC[f does nothing, rest is output)

$ echo -e '\x1b\x12\x50foobar'

(no output because 0x50 starts a never ending DCS)

$ echo -e '\x1b\x12\x50foobar\x1b\x5cHello'
Hello

(everything between 0x50 and 0x1b 0x5c is interpreted as DCS (which
probably does nothing) and the rest is output)

In general I don't think you can expect any reasonable behavior if you
interpret random binary data as text.

Bye, Andreas

Rickard Carlsson

unread,
Aug 1, 2021, 5:29:59 AM8/1/21
to tmux-users
Hey Andreas

Thanks for the thorough answer. I guess I wouldn't expect tmux to interpret any of the output as input.
Sounds like I am wrinting a small filter or continuing this project outside of tmux for now then. 

Thanaks for the help!
Regards,
Rickard

Tobias Damisch

unread,
Aug 1, 2021, 7:11:22 AM8/1/21
to tmux-users
Have you ever tried to cat a large binary file under a very standard bash even without tmux?
Sooner or later it gets borked and you have to restart bash or at least issue the "reset" command.
So maybe in your specific case the bash eats it and tmux doesnt, but that's not the root of the problem.
The problem is that trying to display unescaped binary data in a shell is a bad idea.
 
Good luck with your project though!
 
Cheers,
              Tobias
 
Gesendet: Sonntag, 01. August 2021 um 11:29 Uhr
Von: "Rickard Carlsson" <rickard....@gmail.com>
An: "tmux-users" <tmux-...@googlegroups.com>
Betreff: Re: Julia script stops in tmux but not outside of tmux
--

You received this message because you are subscribed to the Google Groups "tmux-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tmux-users+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages