ref: dd5712495a3b7a16dcc48f93c7c9017bf79b6218
parent: 5a7ad6eb2cb497076f909e54e14d42f65eb89ff9
author: andrewc <andrewchamberss@gmail.com>
date: Thu Feb 11 06:30:44 EST 2016
stop mbld from opening a directory
--- a/lib/std/syswrap+posixy.myr
+++ b/lib/std/syswrap+posixy.myr
@@ -48,6 +48,7 @@
const fsize : (f : byte[:] -> result(off, errno))
const fexists : (f : byte[:] -> bool)
const fisdir : (f : byte[:] -> bool)
+ const fisreg : (f : byte[:] -> bool)
/* useful/portable bits of uname */
const getsysinfo : (si : sysinfo# -> void)
@@ -130,6 +131,16 @@
if sys.stat(path, &sb) >= 0
-> sb.mode & sys.Sifdir != 0
+ else
+ -> false
+ ;;
+}
+
+const fisreg = {path
+ var sb
+
+ if sys.stat(path, &sb) >= 0
+ -> sb.mode & sys.Sifreg != 0
else
-> false
;;
--- a/lib/std/syswrap-ss+freebsd.myr
+++ b/lib/std/syswrap-ss+freebsd.myr
@@ -5,7 +5,7 @@
use "die"
pkg std =
- const exit : (status:int -> void)
+ $noret const exit : (status:int -> void)
pkglocal const bgetcwd : (buf : byte[:] -> errno)
;;
--- a/lib/std/syswrap-ss+linux.myr
+++ b/lib/std/syswrap-ss+linux.myr
@@ -2,7 +2,7 @@
use "errno"
pkg std =
- const exit : (status:int -> void)
+ $noret const exit : (status:int -> void)
pkglocal const bgetcwd : (buf : byte[:] -> errno)
;;
--- a/lib/std/syswrap-ss+osx.myr
+++ b/lib/std/syswrap-ss+osx.myr
@@ -5,7 +5,7 @@
use "die"
pkg std =
- const exit : (status:int -> void)
+ $noret const exit : (status:int -> void)
pkglocal const bgetcwd : (buf : byte[:] -> errno)
;;
--- a/mbld/deps.myr
+++ b/mbld/deps.myr
@@ -364,21 +364,35 @@
for p in incs
path = std.pathjoin([p, lib][:])
+ if !std.fisreg(path)
+ std.slfree(path)
+ continue
+ ;;
match bio.open(path, bio.Rd)
- | `std.Ok file: -> file
- | `std.Fail m: /* nothing */
+ | `std.Ok file:
+ std.slfree(path)
+ -> file
+ | `std.Fail m:
+ std.fput(std.Err, "could not open {}: {}\n", path, m)
+ goto error
;;
;;
path = std.pathjoin([opt_instbase, config.Libpath, lib][:])
match bio.open(path, bio.Rd)
- | `std.Ok file: -> file
+ | `std.Ok file:
+ std.slfree(path)
+ -> file
| `std.Fail m: /* nothing */
;;
- std.put("could not find library {} in search path:\n", lib)
+ std.fput(std.Err, "could not find library {}\n", lib)
+
+ :error
+ std.fput(std.Err, "search path is:\n")
for p in incs
- std.put("\t{}\n", p)
+ std.fput(std.Err, "\t{}\n", p)
;;
- std.fatal("\t{}\n", config.Libpath)
+ std.fput(std.Err, "\t{}\n", path)
+ std.exit(1)
}
/* pushes a dep into the dependency list */