mbutterick / pollen-users

please use https://forums.matthewbutterick.com/c/typesetting/ instead
https://forums.matthewbutterick.com/c/typesetting/
52 stars 0 forks source link

Crash in (load-pagetree "../index.ptree") with "find-relative-path: contract violation" #78

Closed pmarinov closed 3 years ago

pmarinov commented 3 years ago

Hello,

My pollen.rkt is: https://github.com/pmarinov/bash-scripting-guide/blob/master/pollen.rkt

I get this error backtrace:

find-relative-path: contract violation
  expected: (and/c path-for-some-system? simple-form?)
  given: #<path:/home/peterm/work/bash-scripting-guide/pages/../index.ptree>
  context...:
   /usr/share/racket/collects/racket/path.rkt:118:2: for-loop
   /usr/share/racket/collects/racket/path.rkt:116:0: do-explode-path
   /usr/share/racket/collects/racket/path.rkt:126:0: find-relative-path9
   /home/peterm/.racket/7.2/pkgs/pollen/pollen/cache.rkt:50:9: convert-path-to-cache-record
   /home/peterm/.racket/7.2/pkgs/pollen/pollen/private/cache-utils.rkt:124:2: generate-dest-file
   /usr/share/racket/collects/file/cache.rkt:63:2: fetch-and-continue
   /usr/share/racket/collects/racket/contract/private/arrow-val-first.rkt:430:3
   /home/peterm/.racket/7.2/pkgs/pollen/pollen/private/cache-utils.rkt:114:0: cache-ref!11
   /usr/share/racket/collects/racket/private/more-scheme.rkt:376:2: hash-ref!
   /home/peterm/.racket/7.2/pkgs/pollen/pollen/cache.rkt:39:4: cached-require-base
   /home/peterm/work/bash-scripting-guide/pollen.rkt:148:0: node-menu
   (submod "/home/peterm/work/bash-scripting-guide/pages/commands.poly.pm" pollen-module): [running body]
   temp37_0
   for-loop
   run-module-instance!125
   for-loop
   ...
make: *** [makefile:39: pages/command_substit.html] Error 1

Observations of strangeness, this error wouldn't show up if:

I run raco pollen reset before each of the observations above. Any single step will make the problem not show up.

This code (pollen.rkt) has been working for a long time and I have been simply adding pages to the book (index.ptree), and now suddenly it complains.

What could be the problem? Thank you for taking the time to look into it.

mbutterick commented 3 years ago

has been working for a long time and I have been simply adding pages to the book (index.ptree), and now suddenly it complains

What changed? Did you update Pollen or Racket or any other underlying pieces?

pmarinov commented 3 years ago

The new thing is that I had added this at the end of index.ptree:

◊pages/commands.poly.pm{
  pages/commands_internal.poly.pm
}

The function (node-menu) is invoked in many pages prior commands.poly.pm. If I remove the call to (node-menu) from this page specifically the project also compiles successfully.

The strange thing is if I add it to any other part of index.ptree the project compiles (I do "pollen reset" between these experiments)

Otherwise, I've updated the machine a few weeks ago, but I believe I did a "pollen reset" after that.

mbutterick commented 3 years ago

OK, thanks for the report. I’ve pushed a fix for this issue.

pmarinov commented 3 years ago

It works.

I did:

$ raco pkg update pollen
$ raco pollen reset
$ make all

And my project compiled.

Thank you for the fix. Thank you for making Pollen.