authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-07-11 13:20:48 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-07-11 13:20:48 -07:00
log98a31a81030224e13cb1977a8ef2792dfe478c8b
treed93715462ee147c407759e41d2c58a32b5641ebf
parent5af4278d85991fc3ccac30994184bb454b1ff8ef

cmd/fetch- fix cache segfault when using `local` type dependencies


1 files changed, 7 insertions(+), 3 deletions(-)

src/common.zig+7-3
......@@ -89,8 +89,9 @@ fn get_moddir(basedir: []const u8, d: u.Dep, parent_name: []const u8, options: *
8989 const p = try std.fs.path.join(gpa, &.{ basedir, try d.clean_path() });
9090 const pv = try std.fs.path.join(gpa, &.{ basedir, try d.clean_path_v() });
9191
92 if (u.list_contains(options.already_fetched.items, p)) return p;
93 if (u.list_contains(options.already_fetched.items, pv)) return pv;
92 const nocache = d.type == .local or d.type == .system_lib;
93 if (!nocache and u.list_contains(options.already_fetched.items, p)) return p;
94 if (!nocache and u.list_contains(options.already_fetched.items, pv)) return pv;
9495
9596 const tempdir = try std.fs.path.join(gpa, &.{ basedir, "temp" });
9697 if (options.log and d.type != .local) {
......@@ -199,7 +200,10 @@ pub fn get_module_from_dep(d: *u.Dep, dir: []const u8, parent_name: []const u8,
199200 }
200201 }
201202 const moddir = try get_moddir(dir, d.*, parent_name, options);
202 try options.already_fetched.append(moddir);
203
204 const nocache = d.type == .local or d.type == .system_lib;
205 if (!nocache) try options.already_fetched.append(moddir);
206
203207 switch (d.type) {
204208 .system_lib => {
205209 return u.Module{