From 8334504f4e5aa253502a45db3eeb4db265490b4e Mon Sep 17 00:00:00 2001 From: Calvin Rose Date: Sat, 25 May 2024 13:23:11 -0500 Subject: [PATCH] More work on fixing bunlde tools install. --- src/boot/boot.janet | 4 +++- src/core/util.c | 3 +++ test/suite-bundle.janet | 3 +-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/boot/boot.janet b/src/boot/boot.janet index 5dac149d..8460e025 100644 --- a/src/boot/boot.janet +++ b/src/boot/boot.janet @@ -4067,6 +4067,7 @@ (def manifest (bundle/manifest bundle-name)) (def dir (os/cwd)) (def workdir (get manifest :local-source ".")) + (def fixed-syspath (os/realpath (dyn *syspath*))) (try (os/cd workdir) ([_] (print "cannot enter source directory " workdir " for bundle " bundle-name))) @@ -4077,8 +4078,9 @@ (put new-env *module-make-env* (fn make-bundle-env [&] (make-env new-env))) (put new-env :workdir workdir) (put new-env :bundle-name bundle-name) - (put new-env :bundle-dir (bundle-dir bundle-name)) + (put new-env *syspath* fixed-syspath) (with-env new-env + (put new-env :bundle-dir (bundle-dir bundle-name)) # get the syspath right (require (string "@syspath/bundle/" bundle-name))))) (defn- do-hook diff --git a/src/core/util.c b/src/core/util.c index 9d7aab3a..09cf36f2 100644 --- a/src/core/util.c +++ b/src/core/util.c @@ -958,6 +958,9 @@ const char *janet_strerror(int e) { #ifdef JANET_WINDOWS /* Microsoft strerror seems sane here and is thread safe by default */ return strerror(e); +#elif defined(_GNU_SOURCE) + /* See https://linux.die.net/man/3/strerror_r */ + return strerror_r(e, janet_vm.strerror_buf, sizeof(janet_vm.strerror_buf)); #else strerror_r(e, janet_vm.strerror_buf, sizeof(janet_vm.strerror_buf)); return janet_vm.strerror_buf; diff --git a/test/suite-bundle.janet b/test/suite-bundle.janet index 9fd35dbc..8904b4a7 100644 --- a/test/suite-bundle.janet +++ b/test/suite-bundle.janet @@ -39,7 +39,7 @@ (rmrf syspath) (os/mkdir syspath) (put root-env *syspath* (os/realpath syspath)) -(setdyn *out* @"") +#(setdyn *out* @"") (assert (empty? (bundle/list)) "initial bundle/list") (assert (empty? (bundle/topolist)) "initial bundle/topolist") @@ -49,7 +49,6 @@ # Install deps (dep1 as :auto-remove) (assert-no-error "sample-dep2" - (print (dyn *syspath*)) (bundle/install "./examples/sample-dep2")) (assert-no-error "sample-dep1" (bundle/install "./examples/sample-dep1")) (assert-no-error "sample-dep2 reinstall" (bundle/reinstall "sample-dep2"))