-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
arch-mips32-bit MIPS32-bit MIPSarch-mips6464-bit MIPS64-bit MIPSbugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behavioros-linuxLinuxLinuxstandard libraryThis issue involves writing Zig code for the standard library.This issue involves writing Zig code for the standard library.
Milestone
Description
Zig Version
0.10.0-dev.4418+99c3578f6
Steps to Reproduce
#12079 apparently exposed an interesting C ABI issue for MIPS Linux that @topolarity found where when trying to run tests like this the output looks malformed like this:
$ cat test0.zig
test { }
test "test a" {
return error.SkipZigTest;
}
test "test b" {
return error.SkipZigTest;
}
$ ./build/stage3/bin/zig test test0.zig -target mips-linux --test-cmd qemu-mips --test-cmd-bin
Test [2/3] test.test a... SKIP
Test [3/3] test.test b... SKIP
1 passed; 2 skipped; 0 failed.
%
The issue boils down to this tcsetattr
Line 246 in 5127dae
| defer os.tcsetattr(file.handle, .NOW, original_termios) catch { |
getTerminalCursorColumn in std.Progress.
This however is purely a C ABI issue. It should actually work.
Here's reproducible code: it gets termios (the terminal's config) and then sets it. It shouldn't change the terminal at all:
Zig:
const std = @import("std");
pub fn main() !void {
const current_termios = try std.os.tcgetattr(std.os.STDERR_FILENO);
try std.os.tcsetattr(std.os.STDERR_FILENO, .NOW, current_termios);
}zig build-exe x.zig -target mips-linux; qemu-mips x
Outcome: broken terminal with echo etc. not working.
C:
#include <termios.h>
#include <unistd.h>
int main() {
struct termios current_termios;
tcgetattr(STDERR_FILENO, ¤t_termios);
tcsetattr(STDERR_FILENO, TCSANOW, ¤t_termios);
}mips-linux-gnu-gcc -static x.c; qemu-mips a.out
Outcome: terminal is the same as before.
You might need the packages gcc-mips-linux-gnu, qemu-user, and qemu-system-mips for your system in order to reproduce this issue.
Expected Behavior
The terminal doesn't break.
Metadata
Metadata
Assignees
Labels
arch-mips32-bit MIPS32-bit MIPSarch-mips6464-bit MIPS64-bit MIPSbugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behavioros-linuxLinuxLinuxstandard libraryThis issue involves writing Zig code for the standard library.This issue involves writing Zig code for the standard library.