Skip to content

Conversation

andy1li
Copy link
Member

@andy1li andy1li commented Sep 10, 2025

No description provided.

- Changed minimum Zig version from 0.14.0 to 0.15.1 in build.zig.zon and codecrafters.yml files.
- Updated build.zig to use `createModule` for the executable's root module.
- Modified README.md and config.yml to reflect the new required Zig version.
- Adjusted script execution in run.sh and your_program.sh for better compatibility.
- Enhanced stdout handling in main.zig for improved output management.
@andy1li andy1li self-assigned this Sep 10, 2025
Copy link

linear bot commented Sep 10, 2025

if (args.len < 3) {
try std.io.getStdErr().writer().print("Usage: {s} <database_file_path> <command>\n", .{args[0]});
try stdout.print("Usage: {s} <database_file_path> <command>\n", .{args[0]});
try stdout.flush();
Copy link

Choose a reason for hiding this comment

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

Bug: Invalid API Usage Causes Compilation Errors

The stdout_writer initialization uses an invalid Zig API (std.fs.File.stdout().writer(&buffer).interface), which will cause compilation errors. This change also redirects usage error messages from stderr to stdout, which goes against standard Unix conventions.

Additional Locations (2)

Fix in Cursor Fix in Web

if (args.len < 3) {
try std.io.getStdErr().writer().print("Usage: {s} <database_file_path> <command>\n", .{args[0]});
try stdout.print("Usage: {s} <database_file_path> <command>\n", .{args[0]});
try stdout.flush();
Copy link

Choose a reason for hiding this comment

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

Bug: Unix Conventions Violated: Error Messages Redirected

Usage error messages are now printed to stdout instead of stderr. This change breaks standard Unix conventions for command-line tools, affecting script handling and output redirection.

Additional Locations (1)

Fix in Cursor Fix in Web

.root_module = b.createModule(.{
.root_source_file = b.path("src/main.zig"),
.target = b.graph.host,
}),
Copy link

Choose a reason for hiding this comment

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

Bug: Build Configuration Locks Target and Optimization

The build.zig configuration hardcodes the build target to b.graph.host and removes the optimization option. This change eliminates the ability to cross-compile or specify optimization levels via zig build command-line arguments, reducing build flexibility.

Additional Locations (1)

Fix in Cursor Fix in Web

@andy1li andy1li merged commit 1ffecd9 into main Sep 10, 2025
28 checks passed
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.

1 participant