Rustup: Donwload output no line breaks on FreeBSD

Created on 9 Jun 2019  路  20Comments  路  Source: rust-lang/rustup

Problem

vagrant@freebsd ~> rustup --version
rustup 1.18.3 (435397f48 2019-05-22)
vagrant@freebsd ~> rustup toolchain install stable
info: syncing channel updates for 'stable-x86_64-unknown-freebsd'
info: latest update on 2019-05-23, rust version 1.35.0 (3c235d560 2019-05-20)
info: downloading component 'rustc'
 11.0 MiB /  54.5 MiB ( 20 %)   0 B/s in  1s ETA: Unknown                                                          11.8 MiB /  54.5 MiB ( 22 %)  11.0 MiB/s in  5s ETA:  3s                                                          12.9 MiB /  54.5 MiB ( 24 %)   5.9 MiB/s in  6s ETA:  7s                                                          13.7 MiB /  54.5 MiB ( 25 %)   4.3 MiB/s in  7s ETA:  9s                                                          14.3 MiB /  54.5 MiB ( 26 %)   3.4 MiB/s in  8s ETA: 11s                                                          15.5 MiB /  54.5 MiB ( 28 %)   2.9 MiB/s in  9s ETA: 13s                                                          16.5 MiB /  54.5 MiB ( 30 %) 916.3 KiB/s in 10s ETA: 42s
O-bsd bug

Most helpful comment

I'm working on a solution now.

All 20 comments

This is likely a terminfo related problem. Can you please confirm what your TERM environment variable is set to?

TERM=xterm-256color

vagrant@freebsd ~> env
BLOCKSIZE=K
HOME=/home/vagrant
LC_CTYPE=en_US.UTF-8
LOGNAME=vagrant
MAIL=/var/mail/vagrant
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/home/vagrant/bin:/home/vagrant/bin:/home/vagrant/.cargo/bin
PWD=/home/vagrant
SHELL=/usr/local/bin/fish
SHLVL=1
SSH_CLIENT=10.0.2.2 52935 22
SSH_CONNECTION=10.0.2.2 52935 10.0.2.15 22
SSH_TTY=/dev/pts/0
TERM=xterm-256color
USER=vagrant

Fascinating. Does the VM have the terminfo data installed?

What is "the terminfo data"? Is that supposed to be the name of a debian package or something? There is no similarly named package on FreeBSD.

/usr/share/terminfo

$ infocmp -L -1

#       Reconstructed via infocmp from file: /usr/local/share/misc/terminfo.db
xterm-256color|xterm with 256 colors,
        auto_right_margin,
        back_color_erase,
        backspaces_with_bs,
        can_change,
        eat_newline_glitch,
        has_meta_key,
        move_insert_mode,
        move_standout_mode,
        no_pad_char,
        prtr_silent,
        columns#80,
        init_tabs#8,
        lines#24,
        max_colors#0x100,
        max_pairs#0x10000,
        acs_chars=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
        back_tab=\E[Z,
        bell=^G,
        carriage_return=\r,
        change_scroll_region=\E[%i%p1%d;%p2%dr,
        clear_all_tabs=\E[3g,
        clear_margins=\E[?69l,
        clear_screen=\E[H\E[2J,
        clr_bol=\E[1K,
        clr_eol=\E[K,
        clr_eos=\E[J,
        column_address=\E[%i%p1%dG,
        cursor_address=\E[%i%p1%d;%p2%dH,
        cursor_down=\n,
        cursor_home=\E[H,
        cursor_invisible=\E[?25l,
        cursor_left=^H,
        cursor_normal=\E[?12l\E[?25h,
        cursor_right=\E[C,
        cursor_up=\E[A,
        cursor_visible=\E[?12;25h,
        delete_character=\E[P,
        delete_line=\E[M,
        enter_alt_charset_mode=\E(0,
        enter_am_mode=\E[?7h,
        enter_blink_mode=\E[5m,
        enter_bold_mode=\E[1m,
        enter_ca_mode=\E[?1049h\E[22;0;0t,
        enter_dim_mode=\E[2m,
        enter_insert_mode=\E[4h,
        enter_italics_mode=\E[3m,
        enter_reverse_mode=\E[7m,
        enter_secure_mode=\E[8m,
        enter_standout_mode=\E[7m,
        enter_underline_mode=\E[4m,
        erase_chars=\E[%p1%dX,
        exit_alt_charset_mode=\E(B,
        exit_am_mode=\E[?7l,
        exit_attribute_mode=\E(B\E[m,
        exit_ca_mode=\E[?1049l\E[23;0;0t,
        exit_insert_mode=\E[4l,
        exit_italics_mode=\E[23m,
        exit_standout_mode=\E[27m,
        exit_underline_mode=\E[24m,
        flash_screen=\E[?5h$<100/>\E[?5l,
        init_2string=\E[\041p\E[?3;4l\E[4l\E>,
        initialize_color=\E]4;%p1%d;rgb\072%p2%{255}%*%{1000}%/%2.2X/%p3%{255}%*%{1000}%/%2.2X/%p4%{255}%*%{1000}%/%2.2X\E\,
        insert_line=\E[L,
        key_a1=\EOw,
        key_a3=\EOy,
        key_b2=\EOu,
        key_backspace=^H,
        key_btab=\E[Z,
        key_c1=\EOq,
        key_c3=\EOs,
        key_dc=\E[3~,
        key_down=\EOB,
        key_end=\EOF,
        key_enter=\EOM,
        key_f1=\EOP,
        key_f10=\E[21~,
        key_f11=\E[23~,
        key_f12=\E[24~,
        key_f13=\E[1;2P,
        key_f14=\E[1;2Q,
        key_f15=\E[1;2R,
        key_f16=\E[1;2S,
        key_f17=\E[15;2~,
        key_f18=\E[17;2~,
        key_f19=\E[18;2~,
        key_f2=\EOQ,
        key_f20=\E[19;2~,
        key_f21=\E[20;2~,
        key_f22=\E[21;2~,
        key_f23=\E[23;2~,
        key_f24=\E[24;2~,
        key_f25=\E[1;5P,
        key_f26=\E[1;5Q,
        key_f27=\E[1;5R,
        key_f28=\E[1;5S,
        key_f29=\E[15;5~,
        key_f3=\EOR,
        key_f30=\E[17;5~,
        key_f31=\E[18;5~,
        key_f32=\E[19;5~,
        key_f33=\E[20;5~,
        key_f34=\E[21;5~,
        key_f35=\E[23;5~,
        key_f36=\E[24;5~,
        key_f37=\E[1;6P,
        key_f38=\E[1;6Q,
        key_f39=\E[1;6R,
        key_f4=\EOS,
        key_f40=\E[1;6S,
        key_f41=\E[15;6~,
        key_f42=\E[17;6~,
        key_f43=\E[18;6~,
        key_f44=\E[19;6~,
        key_f45=\E[20;6~,
        key_f46=\E[21;6~,
        key_f47=\E[23;6~,
        key_f48=\E[24;6~,
        key_f49=\E[1;3P,
        key_f5=\E[15~,
        key_f50=\E[1;3Q,
        key_f51=\E[1;3R,
        key_f52=\E[1;3S,
        key_f53=\E[15;3~,
        key_f54=\E[17;3~,
        key_f55=\E[18;3~,
        key_f56=\E[19;3~,
        key_f57=\E[20;3~,
        key_f58=\E[21;3~,
        key_f59=\E[23;3~,
        key_f6=\E[17~,
        key_f60=\E[24;3~,
        key_f61=\E[1;4P,
        key_f62=\E[1;4Q,
        key_f63=\E[1;4R,
        key_f7=\E[18~,
        key_f8=\E[19~,
        key_f9=\E[20~,
        key_home=\EOH,
        key_ic=\E[2~,
        key_left=\EOD,
        key_mouse=\E[<,
        key_npage=\E[6~,
        key_ppage=\E[5~,
        key_right=\EOC,
        key_sdc=\E[3;2~,
        key_send=\E[1;2F,
        key_sf=\E[1;2B,
        key_shome=\E[1;2H,
        key_sic=\E[2;2~,
        key_sleft=\E[1;2D,
        key_snext=\E[6;2~,
        key_sprevious=\E[5;2~,
        key_sr=\E[1;2A,
        key_sright=\E[1;2C,
        key_up=\EOA,
        keypad_local=\E[?1l\E>,
        keypad_xmit=\E[?1h\E=,
        memory_lock=\El,
        memory_unlock=\Em,
        meta_off=\E[?1034l,
        meta_on=\E[?1034h,
        orig_colors=\E]104^G,
        orig_pair=\E[39;49m,
        parm_dch=\E[%p1%dP,
        parm_delete_line=\E[%p1%dM,
        parm_down_cursor=\E[%p1%dB,
        parm_ich=\E[%p1%d@,
        parm_index=\E[%p1%dS,
        parm_insert_line=\E[%p1%dL,
        parm_left_cursor=\E[%p1%dD,
        parm_right_cursor=\E[%p1%dC,
        parm_rindex=\E[%p1%dT,
        parm_up_cursor=\E[%p1%dA,
        print_screen=\E[i,
        prtr_off=\E[4i,
        prtr_on=\E[5i,
        repeat_char=%p1%c\E[%p2%{1}%-%db,
        reset_1string=\Ec\E]104^G,
        reset_2string=\E[\041p\E[?3;4l\E[4l\E>,
        restore_cursor=\E8,
        row_address=\E[%i%p1%dd,
        save_cursor=\E7,
        scroll_forward=\n,
        scroll_reverse=\EM,
        set_a_background=\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m,
        set_a_foreground=\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m,
        set_attributes=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p5%t;2%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m,
        set_lr_margin=\E[?69h\E[%i%p1%d;%p2%ds,
        set_tab=\EH,
        tab=^I,
        user6=\E[%i%d;%dR,
        user7=\E[6n,
        user8=\E[?%[;0123456789]c,
        user9=\E[c,

FreeBSD uses termcap instead. You need to look in /usr/share/misc/termcap.

From /usr/share/misc/termcap


xterm-256color|xterm alias 3:\
        :Co#256:pa#32767:\
        :AB=\E[48;5;%dm:AF=\E[38;5;%dm:tc=xterm-new:

Please truss rustup - verify what termcap / terminfo file rustup is /actually/ using. Thank you!

stat("/usr/home/somers/.terminfo",0x7fffffffb600) ERR#2 'No such file or directo
ry'
stat("/etc/terminfo",0x7fffffffb600)             ERR#2 'No such file or director
y'
stat("/lib/terminfo",0x7fffffffb600)             ERR#2 'No such file or director
y'
stat("/usr/share/terminfo",0x7fffffffb600)       ERR#2 'No such file or director
y'
stat("/boot/system/data/terminfo",0x7fffffffb600) ERR#2 'No such file or directory'

Thought so - the thing to remember is that we're not using libterminfo etc, we've got this other rust lib we're using which is a native reimplementation of the terminfo spec, and so the features it has are the features we have. To use termcap (is that the same format) would require patches to it, or to rustup; An experiment you could do would be to try putting a terminfo file that should be right for freedbsd in ~/.terminfo - does that fix the output?

Hm, how would I find or generate such a terminfo file? I know nothing about terminals.

I'm having the same problem...

I'm working on a solution now.

I've copied contents of /lib/terminfo of my Kubuntu 20.04 into FreeBSD's ~/.terminfo and that seems to fix the problem.

By default, ncurses ("owner" of terminfo) on FreeBSD installs with _binary_ terminfo database at /usr/local/share/misc/terminfo.db. There is no port knob to switch back to individual files, you need to tweak port's makefile manually.

If it's not obvious, I ran out of time to work on this. The root cause of the problem is that rustup tries to take to termcap itself, which is too low level. It should be using ncurses instead. ncurses is more portable. My attempt at a solution was to teach the term crate about termcap. This is as far as I got:
https://github.com/Stebalien/term/compare/master...asomers:termcap

That's why I'm not _ranting_ about it but posted the root cause (requiring patching of a ports tree to fix) and working workaround that requires no changes to binaries.

@asomers Do you create PR?

No @fundon because as I said I didn't finish. But you're welcome to pick up where I left off.

@rustbot label: +O-bsd

Was this page helpful?
0 / 5 - 0 ratings