feat: complete Bare OS POSIX mega-plan (20-track)
Migrate booter and seeder host file/path access to bare-fs/bare-path via package imports while keeping Node defaults for dev/CI; extend CI to reject bare fs/path imports on Pear surfaces. Wire bareOsPearUpdaterDelegate through pear-runtime-updater-style dynamic import, expand process table and signal routing, add system RO alias mount and optional Hyperbee bin hint, protomux proc metrics, cron dom/dow OR rule, boot-perf detail with optional bare-hrtime, /lib/bare warm cache with metrics_live warmReadCache, vault threat-model and users-manual crypto pointers, Pear inspect emit, gated shell break/continue, kernel-ext-graph output and example schema, POSIX compliance matrix + verifier in pretest. Harden ACL sidecar evaluation toward POSIX-like mask semantics; tighten test/expr/ printf edge cases and man JSON; add blind-bootstrap/DHT registry protocol test and troubleshooting notes; refresh handbook, KERNEL_CONTRACT, environment appendix, and reference hub links.
This commit is contained in:
+58
-13
@@ -135,6 +135,14 @@ function barePrintfBackslashArg(s) {
|
||||
return o
|
||||
}
|
||||
|
||||
/** Left-pad to width (capped); spaces or ASCII zero. */
|
||||
function barePrintfPadLeft(s, width, zero) {
|
||||
const n = Math.min(Math.max(0, width | 0), 256)
|
||||
if (!n || s.length >= n) return s
|
||||
const pad = zero ? '0' : ' '
|
||||
return pad.repeat(n - s.length) + s
|
||||
}
|
||||
|
||||
function barePrintfFormat(fmt, args) {
|
||||
let ai = 0
|
||||
let o = ''
|
||||
@@ -149,23 +157,60 @@ function barePrintfFormat(fmt, args) {
|
||||
continue
|
||||
}
|
||||
let j = i + 1
|
||||
while (j < fmt.length && /[0-9.#\-+ ]/.test(fmt[j])) j++
|
||||
let zeroPad = false
|
||||
if (fmt[j] === '0') {
|
||||
zeroPad = true
|
||||
j++
|
||||
}
|
||||
let width = 0
|
||||
while (j < fmt.length && fmt[j] >= '0' && fmt[j] <= '9') {
|
||||
width = Math.min(width * 10 + (fmt[j].charCodeAt(0) - 48), 256)
|
||||
j++
|
||||
}
|
||||
while (j < fmt.length && /[.#\-+ ]/.test(fmt[j])) j++
|
||||
const spec = fmt[j] || 's'
|
||||
const arg = args[ai++]
|
||||
if (spec === 's') o += String(arg)
|
||||
else if (spec === 'd' || spec === 'i') o += String(Math.trunc(Number(arg)))
|
||||
else if (spec === 'u') o += String(Math.trunc(Number(arg)) >>> 0)
|
||||
else if (spec === 'x') o += (Math.trunc(Number(arg)) >>> 0).toString(16)
|
||||
let piece = ''
|
||||
if (spec === 's') piece = String(arg)
|
||||
else if (spec === 'd' || spec === 'i')
|
||||
piece = String(Math.trunc(Number(arg)))
|
||||
else if (spec === 'u') piece = String(Math.trunc(Number(arg)) >>> 0)
|
||||
else if (spec === 'x') piece = (Math.trunc(Number(arg)) >>> 0).toString(16)
|
||||
else if (spec === 'X')
|
||||
o += (Math.trunc(Number(arg)) >>> 0).toString(16).toUpperCase()
|
||||
else if (spec === 'o') o += (Math.trunc(Number(arg)) >>> 0).toString(8)
|
||||
else if (spec === 'c') o += String.fromCharCode(Number(arg) || 0)
|
||||
else if (spec === 'f') o += String(Number(arg))
|
||||
else if (spec === 'e') o += Number(arg).toExponential(6)
|
||||
piece = (Math.trunc(Number(arg)) >>> 0).toString(16).toUpperCase()
|
||||
else if (spec === 'o') piece = (Math.trunc(Number(arg)) >>> 0).toString(8)
|
||||
else if (spec === 'c') {
|
||||
const a0 = arg
|
||||
piece =
|
||||
typeof a0 === 'string' && a0.length > 0
|
||||
? a0[0]
|
||||
: String.fromCharCode(Number(a0) || 0)
|
||||
} else if (spec === 'f') piece = String(Number(arg))
|
||||
else if (spec === 'e') piece = Number(arg).toExponential(6)
|
||||
else if (spec === 'E')
|
||||
o += Number(arg).toExponential(6).replace(/e/g, 'E')
|
||||
else if (spec === 'b') o += barePrintfBackslashArg(String(arg))
|
||||
else o += String(arg)
|
||||
piece = Number(arg).toExponential(6).replace(/e/g, 'E')
|
||||
else if (spec === 'b') piece = barePrintfBackslashArg(String(arg))
|
||||
else piece = String(arg)
|
||||
|
||||
if (
|
||||
width > 0 &&
|
||||
(spec === 'd' ||
|
||||
spec === 'i' ||
|
||||
spec === 'u' ||
|
||||
spec === 'x' ||
|
||||
spec === 'X' ||
|
||||
spec === 'o')
|
||||
) {
|
||||
if (zeroPad && piece.startsWith('-')) {
|
||||
o += '-' + barePrintfPadLeft(piece.slice(1), width - 1, true)
|
||||
} else {
|
||||
o += barePrintfPadLeft(piece, width, zeroPad)
|
||||
}
|
||||
} else if (width > 0 && spec === 's') {
|
||||
o += barePrintfPadLeft(piece, width, false)
|
||||
} else {
|
||||
o += piece
|
||||
}
|
||||
i = j
|
||||
}
|
||||
return o
|
||||
|
||||
Reference in New Issue
Block a user