Skip to content

Zig 0.16.0#18

Open
Khitiara wants to merge 20 commits into
zig-osdev:mainfrom
Khitiara:zig-0.16.0
Open

Zig 0.16.0#18
Khitiara wants to merge 20 commits into
zig-osdev:mainfrom
Khitiara:zig-0.16.0

Conversation

@Khitiara

@Khitiara Khitiara commented Apr 18, 2026

Copy link
Copy Markdown
Collaborator

This PR disables fuzz tests temporarily because I dont understand the api well enough to update them.

bnuuydev and others added 17 commits February 3, 2026 21:31
the main breakage here is caused by writergate. there's some weirdness
going on to do with file paths and the build system too though, so that
should be dealt with before merging. also the new writer and reader
don't provide any error specificity, so we don't know why a read or a
write failed now. this should also be considered: perhaps creating a
custom interface is warranted?
we set the cwd of dimmer to the script directory such that the run step passes
the correct relative paths. this caused weirdness in zig's dependency
file handling - zig expects relative paths to be relative to the project
root instead of the cwd of the run step. changing paths to be absolute
is a suitable workaround.
@Khitiara

Copy link
Copy Markdown
Collaborator Author

windows compilation failure is due to https://codeberg.org/ziglang/translate-c/issues/327

@bnuuydev

bnuuydev commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Hi! Really happy with this, thank you for your work on it, and sorry that I didn't make further progress on my PR :)

My only little nitpick is when you've continued from my PR, you ended up I think re-breaking the GPT partitioning? If you have a config which doesn't specify the starting LBA, then you get:

error: partition 1 overlaps with gpt. the partition begins at lba 33, and the gpt ends at 33

This is an unfortunate off-by-one error that was introduced in #12. I've been upgrading my kernel to 0.16, so that's how I've just encountered it. As I was looking into it, I realised that I encountered this before and subsequently forgotten that I fixed it in my fork:
bnuuydev@82cc7bd#diff-6d069424b9e9b88383f147fbbeec5b746996afbf3a0f5136961e2b8d59e4fe46R172

It'd be really great if you could re-include that line in your PR :) Or do you think actually it'd be best just to have that in a separate PR?

Thanks again ^_^

@Khitiara

Khitiara commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator Author

it would be good to add that yeah. i havent had time or energy to work on this for a while though, so no ETA unless a maintainer wants to add that change in

@der-teufel-programming

der-teufel-programming commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Since I'm unsure weather will be doing a 0.16 version or jumping straight to 0.17 I don't know if the fix will be added here or if I'll use those two branches as a base for a big 0.17 update, especially since 0.17-dev has some translate-c bugs fixed that are the reason for windows compilation failure

@bnuuydev

bnuuydev commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

I think it'd be nice at least to have a working version for 0.16 merged if thats ok? Then work for 0.17.0/master can be built on this in a separate branch, and other users will have an easier time finding a working version. I'm happy to work on @Khitiara's branch if fae would be happy to give me push access, or alternatively I could open my own PR :)

@Khitiara

Khitiara commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator Author

sent an invite to my fork, should be able to push to this pr when accepted @bnuuydev

@Khitiara Khitiara mentioned this pull request Jul 6, 2026
@Khitiara

Khitiara commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator Author

@ikskuh this is ready to merge pending your review

@ikskuh ikskuh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I already have change requests, will do the BuildInterface review after these issues are addressed

std.log.warn("cannot copy file {!s}: {s} is not a supported file type!", .{
entry.dir.realpath(entry.path, &realpath_buffer),
std.log.warn("cannot copy file {s}: {s} is not a supported file type!", .{
if (entry.dir.realPathFile(io, entry.path, &realpath_buffer)) |l| realpath_buffer[0..l] else |e| @errorName(e),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of printing errorName(), just print entry.path as this is a user information. This information isn't helpful when we print "NotADir" instead of "./foo/bar/bam.h". The relative path is still more valuable than a raw error description

}

fn disk_read(intf: *fatfs.Disk, buff: [*]u8, sector: fatfs.LBA, count: c_uint) fatfs.Disk.Error!void {
fn disk_read(intf: *fatfs.Disk, io: std.Io, buff: [*]u8, sector: fatfs.LBA, count: c_uint) fatfs.Disk.Error!void {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks wrong. Why does fatfs.Disk require std.Io?

The fatfs implementation must not use std.Io, as we can store the Io in the BinaryStreamDisk object.

Comment thread build.zig
Comment on lines +7 to +8
b.release_mode = .fast;
const optimize = b.standardOptimizeOption(.{});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this change do?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this correctly sets the default optimize mode in a way that still allows overriding - using fast instead of safe to work around the translate-c bug in 0.16.0

partitions: []Partition,

pub fn parse(ctx: dim.Context) !dim.Content {
pub fn parse(ctx: dim.Context, stdio: std.Io) !dim.Content {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of passing std.Io through a parameter, we can also pass it through the dim.Context, which is already a fusion of all parameters typically passed around.

It makes the code less dependend and infective of std.Io, and makes it easier to review

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The whole diff should be way slimmer then, as the io isn't required in a lot of places, but is currently dragged through every place

Comment on lines +211 to +212
try stream.write(io, block_size * 2 + pe_ofs, &pe_block);
try stream.write(io, block_size * secondary_pe_array_lba + pe_ofs, &pe_block);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The BinaryStream should also encapsulate std.Io, to keep the core of dimmer free of std.Io assumptions (it is intentionally built in a way that it does not drag std as the I/O layer into it too much)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants