hare

[hare] The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit f56dcd5b5b7520ec6b3336db2a13e10305a676da
parent eac36b91505385a02601362e029713a48d09ac9c
Author: Ember Sawady <ecs@d2evs.net>
Date:   Mon,  5 Feb 2024 17:32:25 +0000

hare build: create empty td file if necessary

we can decide whether to make modules without hare sources illegal to
import later, but the simplest thing to do is to just make them work as
you'd expect

the reason this caused an abort earlier is that the os::open() for the
temporary td would fail and cleanup_ssa_task would return before
initializing ctx.hashes[mod][stage::TD], such that when the run_task for
the module that depended on it called get_deps(), the
get_cache(..., stage::TD) failed

Fixes: https://todo.sr.ht/~sircmpwn/hare/909
Signed-off-by: Ember Sawady <ecs@d2evs.net>

Diffstat:
Mcmd/hare/build/queue.ha | 4+---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/cmd/hare/build/queue.ha b/cmd/hare/build/queue.ha @@ -279,11 +279,9 @@ fn cleanup_ssa_task(ctx: *context, t: *task, out: str) (void | error) = { let tmp = strings::concat(out, ".td.tmp"); defer free(tmp); - let f = match (os::open(tmp)) { + let f = match (os::create(tmp, 0o644, fs::flag::RDWR)) { case let f: io::file => yield f; - case errors::noentry => - return; case let err: fs::error => return err; };