Closed frostmd closed 9 months ago
@jmt-lab Looks like read_to_string is expecting UTF-8 when we are in fact giving it an arbitrary byte sequence. Is there a different Rust function which is like read_to_string but accepts arbitrary bytes?
Ah yeah there is a good alternative to this, let me see if i can get a PR up today or tomorrow
I have gone ahead and pushed a fix for the last commented bit. @cperciva i tagged it version 1.0.5 to make things easy for you
@jmt-lab Thanks! Does it matter that Cargo.lock
still says 1.0.4 instead of 1.0.5?
This should be fixed with latest
My user-data contains a .tar.xz archive and aws-ec2-imdsv2-get is now used by default on FreeBSD/EC2 AMIs to fetch user-data at first boot.
[root@freebsd ~]# RUST_BACKTRACE=full aws-ec2-imdsv2-get latest/user-data thread 'main' panicked at 'failed to read response: Error { kind: InvalidData, message: "stream did not contain valid UTF-8" }', src/main.rs:31:10 stack backtrace: 0: 0xd85b4e71074 -::fmt::h128e70683e5723b7
1: 0xd85b4e4875f - core::fmt::write::h2f14e02752d076b7
2: 0xd85b4e70d1f - std::sys_common::backtrace::print::h9fa8f27445ca260a
3: 0xd85b4e5de8d - std::panicking::default_hook::{{closure}}::hbe250059f67749e6
4: 0xd85b4e5e48b - std::panicking::rust_panic_with_hook::h7315e6bab25fcc65
5: 0xd85b4e71492 - std::panicking::begin_panic_handler::{{closure}}::h386aa998b2757e4c
6: 0xd85b4e713f6 - std::sys_common::backtrace::__rust_end_short_backtrace::hfb96c18bfc3a70cd
7: 0xd85b4e5df21 - rust_begin_unwind
8: 0xd85b4e47a02 - core::panicking::panic_fmt::h9d11a335d4c9300c
9: 0xd85b4e45692 - core::result::unwrap_failed::ha2ee61cef2630e9f
10: 0xd85b4e40852 - aws_ec2_imdsv2_get::request::hea53f4707486608d
11: 0xd85b4e41d39 - aws_ec2_imdsv2_get::main::hb863c76417e49cb9
Abort trap (core dumped)
[root@freebsd ~]# uname -a FreeBSD freebsd 14.0-ALPHA1 FreeBSD 14.0-ALPHA1 amd64 1400094 #0 main-n264678-136fc495615f: Fri Aug 11 08:18:04 UTC 2023 root@releng1.nyi.freebsd.org:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64
aws-ec2-imdsv2-get-1.0.3_5 Name : aws-ec2-imdsv2-get Version : 1.0.3_5 Installed on : Sat Aug 12 12:48:13 2023 UTC Origin : net/aws-ec2-imdsv2-get Architecture : FreeBSD:14:amd64 Prefix : /usr/local Categories : net Licenses : APACHE20 Maintainer : cperciva@FreeBSD.org WWW : https://github.com/aws/aws-ec2-imdsv2-get Comment : Reads data from EC2 IMDS with v2 protocol Options : DOCS : on Annotations : FreeBSD_version: 1400093 repo_type : binary repository : FreeBSD Flat size : 440KiB Description : Tool for reading data from the EC2 Instance Metadata Service (IMDS), supporting both the original (v1) protocol and the newer (v2) protocol.
WWW: https://github.com/aws/aws-ec2-imdsv2-get