Closed
Description
I found this bug which was not mentioned in the wiki.
justfile
:
set shell := ['powershell.exe', '-c']
r9x_toolchain := 'rust9x'
r9x_target := 'i586-rust9x-windows-msvc'
r9x_editbin := 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\bin\Hostx64\x64\editbin.exe'
subsystem := 'CONSOLE,4.0'
os_version := '3.1'
build *FLAGS: (do-build 'release' FLAGS)
release *FLAGS: (do-build 'release' '--release' FLAGS)
do-build PROFILE *FLAGS='': (r9x 'build' '--target' r9x_target FLAGS) (editbin 'target\'+r9x_target+'\'+PROFILE+'\r9x-stdin.exe')
run *FLAGS: (r9x 'run' '--target' r9x_target FLAGS)
r9x $COMMAND *FLAGS:
$env:RUSTFLAGS='-C target-feature=+crt-static' ; cargo +{{ r9x_toolchain }} {{ COMMAND }} {{ FLAGS }}
editbin EXECUTABLE:
& "{{ r9x_editbin }}" {{ EXECUTABLE }} /SUBSYSTEM:{{ subsystem }} /OSVERSION:{{ os_version }} /RELEASE
src/main.rs
fn main() {
let mut buffer = String::new();
std::io::stdin().read_line(&mut buffer).unwrap();
println!("{}",buffer);
}
Cargo.toml is untouched.
Compilation is successful but running the executable on Windows XP ends with an error:
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\Documents and Settings\VMUser>E:\r9x-stdin.exe
hello
thread 'main' panicked at src\main.rs:3:45:
called `Result::unwrap()` on an `Err` value: Error { kind: InvalidData, message:
"Windows stdin in console mode does not support non-UTF-16 input; encountered unpaired surrogate" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
C:\Documents and Settings\VMUser>
Also unicows.dll
is included alongside but not linked against the executable
total 1984
-rwxr-xr-x 1 spy spy 274944 Jan 28 17:24 convert_numbers.exe
-rw-r--r-- 1 spy spy 487 Jan 28 2024 error.txt
-rwxr-xr-x 1 spy spy 256512 Jan 28 20:00 hello_world.exe
-rw-r--r-- 1 spy spy 28027 Oct 4 2004 license.txt
-rwxr-xr-x 1 spy spy 594432 Jan 28 16:33 linkread.exe
-rwxr-xr-x 1 spy spy 248320 Jan 28 20:28 r9x-stdin.exe
-rw-r--r-- 1 spy spy 608 Oct 4 2004 redist.txt
-rw-r--r-- 1 spy spy 258352 Dec 7 2004 unicows.dll
-rw-r--r-- 1 spy spy 347136 Dec 7 2004 unicows.pdb