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>
---
supersedes Enno's patch which makes this an error
cmd/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
index 56696672..e143aecd 100644
--- 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;
};
--
2.43.0
On 24/02/05 17:32:25, Ember Sawady wrote:
> 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
I'd either vote for a warning ('imported module xyz is empty') or just
exposing all submodules with the parent as prefix? Anyway...
Builds and fixes the issue, without having to do shady stuff with
ctx.tests :) Thanks for investigating!