Files
RedBear-OS/local/recovered-stashes/relibc--get_dns_server-daemon-path.patch
T
vasilito 6fc0366abb build system: remove working-tree stashing (data-loss risk); pre-cook CI=1; target-scoped diagnostics
Remove the stash-and-restore machinery entirely. It manipulated the operator's
working tree and had a fatal bug: modern git's 'stash push' does not print the
stash SHA on stdout, so the SHA was never recorded, the stash was never restored,
and with REDBEAR_ALLOW_DIRTY=1 the operator's dirty-fork WIP was silently
stranded in 'git stash list' on every build (base had accumulated 25 strands).
The build now cooks committed HEAD, or the working tree AS-IS under
REDBEAR_ALLOW_DIRTY=1 — it never touches the tree. A read-only startup advisory
surfaces any leftover redbear-build-* strands from the old code.

Recovered the valuable stranded work to local/recovered-stashes/ (netstack
proptest, relibc get_dns_server daemon-path + getnetbyaddr impl); originals
remain in each fork's git stash list. See local/recovered-stashes/README.md.

Also: pre-cook now runs 'repo cook' with CI=1 (matches make live), fixing the
'Entering raw terminal mode ... Inappropriate ioctl' noise; and the failure
diagnostics per-recipe dump is scoped to THIS build's artifacts (mtime >= build
start) so a bare/mini build no longer lists graphical packages left over from a
prior redbear-full build.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-27 12:59:08 +09:00

31 lines
1.1 KiB
Diff

diff --git a/src/header/netdb/redox.rs b/src/header/netdb/redox.rs
index 314dffcd..6e24ebed 100644
--- a/src/header/netdb/redox.rs
+++ b/src/header/netdb/redox.rs
@@ -7,6 +7,25 @@ use crate::{
use alloc::string::String;
pub fn get_dns_server() -> Result<String, Errno> {
+ // Try the cached daemon path first
+ if let Ok(first_ns) = (|| -> Result<String, Errno> {
+ let mut s = String::new();
+ let mut file = File::open(c"/scheme/dns/nameservers".into(), fcntl::O_RDONLY)?;
+ file.read_to_string(&mut s)
+ .map_err(|_| Errno(errno::EIO).sync())?;
+ // Take the first nameserver line
+ if let Some(first) = s.lines().next() {
+ let trimmed = first.trim();
+ if !trimmed.is_empty() {
+ return Ok(trimmed.to_string());
+ }
+ }
+ Err(Errno(errno::ENOENT).sync())
+ })() {
+ return Ok(first_ns);
+ }
+
+ // Fallback: read the static /etc/net/dns file (legacy path)
let mut string = String::new();
let mut file = File::open(c"/etc/net/dns".into(), fcntl::O_RDONLY)?;
file.read_to_string(&mut string)