From d3f60c930db06b540bb196b6323a88045e746bbf Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 1 Oct 2026 10:29:16 -0300 Subject: The init file reads past a UTF-8 BOM, and every line it fails is said and logged with its line number, never silent A BOM made the first word unknown, a word no builtin has was skipped without a word, and a setting that refused its value said nothing (the init file ran with announcing off). Each failing line now leaves a notice and an `err - init file line N: ` record; `#` still starts a comment only at a line's start, so `#ff0000` stays a value. Co-Authored-By: Claude Opus 5.5 --- src/ninep/ctl.zig | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/ninep') diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig index 697ef594..2fa0cd7e 100644 --- a/src/ninep/ctl.zig +++ b/src/ninep/ctl.zig @@ -4467,3 +4467,13 @@ test "a Mount of a socket path that is not there says no such socket, ENOENT" { try testing.expectEqual(@as(usize, 0), p.fs.mounts.items.len); try testing.expectEqual(E.INVAL, wr(p, @intFromEnum(tree.TopFile.ctl), "Mount peer rel/x.sock\n").errno()); } + +test "the init file reads past a BOM, and every line it fails is a notice and an err, never silent" { + const p = try Pardes.init(testing.allocator, .{ .tty_only = true, .startup_config = "\xEF\xBB\xBFTheme dusk\nnosuchword 1\nTheme nosuchtheme\n# a comment\nInactiveDim 30 # not a comment, a bad value\n" }); + defer p.deinit(); + try testing.expectEqualStrings("dusk", p.theme().name); + try testing.expect(th.logHas(p, "err - init file line 2: unknown word \"nosuchword 1\"")); + try testing.expect(th.logHas(p, "err - init file line 3: ")); + try testing.expect(!th.logHas(p, "line 4")); + try testing.expect(th.logHas(p, "err - init file line 5: ")); +} -- cgit v1.3