shithub: mc

Download patch

ref: e44f649c1ed1037595650a461e130cde1bb9a30c
parent: 2980a6f863a6fb262f78c8ecd305d7775e73f802
author: Ori Bernstein <ori@eigenstate.org>
date: Sun Feb 22 08:23:47 EST 2015

Pass permissions to blat.

--- a/install.myr
+++ b/install.myr
@@ -29,11 +29,11 @@
 	for t in p.targs
 		match t
 		| `Bin bt:
-			movefile(delete, bt.name, opt_instroot, opt_destdir, "bin")
+			movefile(delete, bt.name, opt_instroot, opt_destdir, "bin", 0o755)
 		| `Lib lt:
-			movefile(delete, lt.name, opt_instroot, opt_destdir, "lib/myr")
+			movefile(delete, lt.name, opt_instroot, opt_destdir, "lib/myr", 0o644)
 			libarchive = std.fmt("lib%s.a", lt.name)
-			movefile(delete, libarchive, opt_instroot, opt_destdir, "lib/myr")
+			movefile(delete, libarchive, opt_instroot, opt_destdir, "lib/myr", 0o644)
 			std.slfree(libarchive)
 		| `Gen gt:
 			/* nothing to do (?) */
@@ -51,7 +51,7 @@
 }
 
 
-const movefile = {delete, file, instdir, destdir, prefix
+const movefile = {delete, file, instdir, destdir, prefix, perm
 	var path
 
 	path = std.pathjoin([destdir, instdir, prefix, file][:])
@@ -66,7 +66,7 @@
 		match std.slurp(file)
 		| `std.Fail m:	std.fatal(1, "Could not open %s for reading\n", file)
 		| `std.Ok buf:
-			if !std.blat(path, buf)
+			if !std.blat(path, buf, perm)
 				std.put("Could not write %s\n", file)
 			;;
 			std.slfree(buf)
@@ -89,6 +89,6 @@
 	;;
 
 	manrel = std.fmt("%s%s", opt_manpath, man[sect:])
-	movefile(delete, man, opt_instroot, opt_destdir, manrel)
+	movefile(delete, man, opt_instroot, opt_destdir, manrel, 0o644)
 	std.slfree(manrel)
 }
--- a/subdir.myr
+++ b/subdir.myr
@@ -17,9 +17,9 @@
 			;;
 		;;
 
-		std.put("Entering directory %s\n", s)
+		std.put("Entering directory '%s'\n", s)
 		run(p.cmd, s)
-		std.put("Leaving directory %s\n", s)
+		std.put("Leaving directory '%s'\n", s)
 	;;
 }
 
--- a/test.myr
+++ b/test.myr
@@ -12,7 +12,7 @@
 use "config.use"
 
 pkg bld =
-	const test	: (p : parser# -> bool)
+	const test	: (p : parser# -> void)
 ;;
 
 const test = {p
@@ -44,7 +44,12 @@
 		;;
 		std.slfree(bin)
 	;;
-	-> ok
+	if ok
+		std.put("TESTS PASSED\n")
+	else
+		std.put("TESTS FAILED\n")
+		std.exit(1)
+	;;
 }
 
 const dotest = {p, targ, ok
@@ -111,8 +116,9 @@
 		std.fatal(1, "unable to run test: %s\n", m)
 	| `std.Ok (pid, infd, outfd):
 		match std.fslurp(outfd)
+		| `std.Ok "":	/* empty output; nothing to log */
 		| `std.Ok buf:
-			std.blat(log, buf)
+			std.blat(log, buf, 0o644)
 		| `std.Fail m:
 		;;
 		std.slfree(log)