Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.7 installation possibly broken on MacOS #5

Closed
pmatos opened this issue Apr 17, 2020 · 4 comments
Closed

v0.7 installation possibly broken on MacOS #5

pmatos opened this issue Apr 17, 2020 · 4 comments

Comments

@pmatos
Copy link
Contributor

pmatos commented Apr 17, 2020

(Possibly related to #4)

I am seeing an error when trying to test one of my libraries using github actions. Do you own a mac for testing by any chance.
https://github.com/pmatos/racket-loci/pull/4/checks?check_run_id=592076853#step:5:10

standard-module-name-resolver: collection not found
  for module path: (submod (lib "racket/init") configure-runtime)
  collection: "racket"
  in collection directories:
   /Users/runner/Library/Racket/snapshot/collects
   /usr/local/collects
   /Users/runner/runners/2.168.0/work/racket-loci/racket-loci
  context...:
   show-collection-err
   standard-module-name-resolver
   module-path-index-resolve
   module-declared?
#%top-interaction: unbound identifier;
 also, no #%app syntax transformer is bound
  at: #%top-interaction
  in: (#%top-interaction eval (read))
  context...:
   do-raise-syntax-error
   expand-capturing-lifts
   temp98_0
   temp71_0
   compile
   temp65_0

Thanks.

@Bogdanp
Copy link
Owner

Bogdanp commented Apr 17, 2020

I just tried it on my mac and I get the same error:

~/s/racket-loci (pmatos-macos-test)> racket test/test_locus-context.rkt 4
Starting core 0
standard-module-name-resolver: collection not found
  for module path: (submod (lib "racket/init") configure-runtime)
  collection: "racket"
  in collection directories:
   /Users/bogdan/Library/Racket/7.6/collects
   /usr/local/collects
   ... [35 additional linked and package directories]
  context...:
   show-collection-err
   standard-module-name-resolver
   module-path-index-resolve
   module-declared?
#%top-interaction: unbound identifier;
 also, no #%app syntax transformer is bound
  at: #%top-interaction
  in: (#%top-interaction eval (read))
  context...:
   do-raise-syntax-error
   expand-capturing-lifts
   temp98_0
   temp71_0
   compile
   temp65_0
^Cuser break
  context...:
   /Applications/Racket v7.6/share/pkgs/unix-socket-lib/racket/unix-socket.rkt:263:0: unix-socket-accept
   /Applications/Racket v7.6/collects/racket/contract/private/arrow-val-first.rkt:486:18
   /Users/bogdan/sandbox/racket-loci/loci/private/locus-local.rkt:99:0: dynamic-locus
   /Users/bogdan/sandbox/racket-loci/test/test_locus-context.rkt:8:0: go
   /Applications/Racket v7.6/collects/racket/private/more-scheme.rkt:336:52
   (submod "/Users/bogdan/sandbox/racket-loci/test/test_locus-context.rkt" main): [running body]
   temp35_0
   for-loop
   run-module-instance!

I can try to dig in a little deeper later.

@Bogdanp
Copy link
Owner

Bogdanp commented Apr 17, 2020

Oh, I see what's going on.

  (define (current-executable-path)
    (parameterize ([current-directory (find-system-path 'orig-dir)])
      (find-executable-path (find-system-path 'exec-file) #false)))
  (define (current-collects-path)
    (define p (find-system-path 'collects-dir))
    (if (complete-path? p)
        p
        (path->complete-path p (or (path-only (current-executable-path))
                                  (find-system-path 'orig-dir)))))

for me this resolves to

locus-local.rkt> (current-collects-path)
#<path:/usr/local/bin/../collects>

because

locus-local.rkt> (current-executable-path)
#<path:/usr/local/bin/racket>

but that's wrong because /usr/local/bin/racket is just a symlink of the real executable in /Applications

~/s/racket-loci (pmatos-macos-test)> ls -l (which racket)
lrwxr-xr-x  1 bogdan  admin  36 Feb 14 11:33 /usr/local/bin/racket@ -> /Applications/Racket v7.6/bin/racket

so the collects path it guesses is wrong.

The docs mention this problem:

'collects-dir — a path to the main collection of libraries (see Libraries and Collections). If this path is relative, then it is relative to the executable as reported by (find-system-path 'exec-file)—though the latter could be a soft-link or relative to the user’s executable search path, so that the two results should be combined with find-executable-path. The 'collects-dir path is normally embedded in the Racket executable, but it can be overridden by the --collects or -X command-line flag.

So it seems like you either need to follow the link before resolving the collection path of drop the -X parameter in

  (define worker-cmdline-list (list (current-executable-path)
                                    ;; "-X"
                                    ;; (path->string (current-collects-path))
                                    "-e"
                                    "(eval (read))"))

If I do that, this test passes:

~/s/racket-loci (pmatos-macos-test) [1]> racket test/test_locus-context.rkt 4
Starting core 0
(/usr/local/bin/racket -e (eval (read)))
Starting core 1
(/usr/local/bin/racket -e (eval (read)))
Starting core 2
(/usr/local/bin/racket -e (eval (read)))
Starting core 3
(/usr/local/bin/racket -e (eval (read)))
Locus 0 done
0
Locus 1 done
1
Locus 2 done
2
Locus 3 done
3
cpu time: 21 real time: 20835 gc time: 0
'(0 0 0 0)

@Bogdanp
Copy link
Owner

Bogdanp commented Apr 17, 2020

This patch fixes the problem:

From 1e7467dfb12acc76729560fe74f1eda2fbc2bc68 Mon Sep 17 00:00:00 2001
From: Bogdan Popa <bogdan@defn.io>
Date: Fri, 17 Apr 2020 11:07:24 +0300
Subject: [PATCH] locus-local: follow links when building collects paths

---
 loci/private/locus-local.rkt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/loci/private/locus-local.rkt b/loci/private/locus-local.rkt
index 75bdc19..67e9784 100644
--- a/loci/private/locus-local.rkt
+++ b/loci/private/locus-local.rkt
@@ -104,8 +104,8 @@
     (define p (find-system-path 'collects-dir))
     (if (complete-path? p)
         p
-        (path->complete-path p (or (path-only (current-executable-path))
-                                  (find-system-path 'orig-dir)))))
+        (path->complete-path p (or (path-only (resolve-path (current-executable-path)))
+                                   (find-system-path 'orig-dir)))))
   (define worker-cmdline-list (list (current-executable-path)
                                     "-X"
                                     (path->string (current-collects-path))
-- 
2.25.1

pmatos pushed a commit to pmatos/racket-loci that referenced this issue Apr 17, 2020
@pmatos
Copy link
Contributor Author

pmatos commented Apr 17, 2020

It worked! Great. Thanks.

@pmatos pmatos closed this as completed Apr 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants