-
Notifications
You must be signed in to change notification settings - Fork 0
Wire /bin/sh into init and add shell build #894
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
46bf406
fb7e084
8d27405
3d9b51f
f6177cc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,5 +1,12 @@ | ||||||||||||||||||||||||||||
| #![feature(restricted_std)] | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| // Provide #[no_mangle] C-ABI shims for POSIX functions that the shell's | ||||||||||||||||||||||||||||
| // `extern "C"` declarations link against. On vibix, these delegate to | ||||||||||||||||||||||||||||
| // raw syscalls via `vibix_abi`. The module is excluded from host tests | ||||||||||||||||||||||||||||
| // which mock these symbols. | ||||||||||||||||||||||||||||
| #[cfg(not(test))] | ||||||||||||||||||||||||||||
| mod syscalls; | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| mod builtins; | ||||||||||||||||||||||||||||
| mod exec; | ||||||||||||||||||||||||||||
| mod expand; | ||||||||||||||||||||||||||||
|
|
@@ -26,6 +33,9 @@ fn main() { | |||||||||||||||||||||||||||
| env.arg0 = "sh".to_string(); | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| // Import environment variables from the process environment. | ||||||||||||||||||||||||||||
| // On vibix, std::env::vars() is not yet supported (panics), | ||||||||||||||||||||||||||||
| // so we skip import on that target. $PATH is set above. | ||||||||||||||||||||||||||||
| #[cfg(not(target_os = "vibix"))] | ||||||||||||||||||||||||||||
| for (key, value) in std::env::vars() { | ||||||||||||||||||||||||||||
| env.set(&key, &value, Some(true)); | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
|
|
@@ -50,10 +60,11 @@ fn main() { | |||||||||||||||||||||||||||
| use std::io::BufRead; | ||||||||||||||||||||||||||||
| let stdin = std::io::stdin(); | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| // Detect if stdin is a terminal. On vibix, isatty may not be | ||||||||||||||||||||||||||||
| // available via std, so we check the TERM variable or fall back | ||||||||||||||||||||||||||||
| // to assuming interactive when stdin is not redirected. | ||||||||||||||||||||||||||||
| let is_tty = std::env::var("TERM").is_ok(); | ||||||||||||||||||||||||||||
| // On vibix, the serial console is not a POSIX tty, so `isatty()` | ||||||||||||||||||||||||||||
| // would return false even for the primary interactive session. | ||||||||||||||||||||||||||||
| // Always treat stdin-mode as interactive to ensure the prompt | ||||||||||||||||||||||||||||
| // appears over the serial console. | ||||||||||||||||||||||||||||
| let is_tty = true; | ||||||||||||||||||||||||||||
|
Comment on lines
+63
to
+67
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don’t force interactive mode on all targets.
Suggested fix- let is_tty = true;
+ #[cfg(target_os = "vibix")]
+ let is_tty = true;
+ #[cfg(not(target_os = "vibix"))]
+ let is_tty = std::env::var_os("TERM").is_some();📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| // Create the job table for interactive mode. | ||||||||||||||||||||||||||||
| let mut jobs = JobTable::new(); | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Scope syscall shims to vibix-only builds.
#[cfg(not(test))]pulls raw syscall POSIX shims into all non-test binaries. That can unintentionally override host libc symbols and introduce host-specific breakage. Restrict this module to vibix target builds.Suggested fix
📝 Committable suggestion
🤖 Prompt for AI Agents