Fix JSON export of "otherfs" excluded type

The exporter would write "othfs" while the import code was expecting
"otherfs". This bug also exists in the 1.x branch and is probably as old
as the JSON import/export feature. D'oh.

Normalized the export to use "otherfs" now (which is what all versions can
read correctly) and fixed the importer to also accept "othfs" (which
is what all previous versions exported).
This commit is contained in:
Yorhel 2024-07-24 10:30:28 +02:00
parent dc42c91619
commit 08d373881c
2 changed files with 2 additions and 2 deletions

View file

@ -337,7 +337,7 @@ fn itemkey(ctx: *Ctx, key: []const u8) void {
var buf: [32]u8 = undefined;
const typ = ctx.p.string(&buf);
// "frmlnk" is also possible, but currently considered equivalent to "pattern".
if (eq(u8, typ, "otherfs")) ctx.special = .other_fs
if (eq(u8, typ, "otherfs") or eq(u8, typ, "othfs")) ctx.special = .other_fs
else if (eq(u8, typ, "kernfs")) ctx.special = .kernfs
else ctx.special = .excluded;
return;

View file

@ -170,7 +170,7 @@ const JsonWriter = struct {
ctx.writeStr(name);
ctx.write(switch (t) {
.err => "\",\"read_error\":true}",
.other_fs => "\",\"excluded\":\"othfs\"}",
.other_fs => "\",\"excluded\":\"otherfs\"}",
.kernfs => "\",\"excluded\":\"kernfs\"}",
.excluded => "\",\"excluded\":\"pattern\"}",
});