Directory-related error processing .pm files #32

Closed
opened 10 years ago by RenaissanceBug · 5 comments
RenaissanceBug commented 10 years ago (Migrated from github.com)

I'm getting an error (running pollen on OS X Mavericks) that seems to depend on the directory in which I place my pollen project files.

Here is the error text displayed in the console by raco pollen:

render: foo.html.pm
Servlet (@ /foo.html) exception:
include-at/relative-to/reader: can't open include file (open-input-file: cannot open input file
  path: /tmp/test/../../Users/jordan/Library/Racket/6.1/pkgs/pollen/server-extras/fallback.html
  system error: No such file or directory; errno=2)
  at: #<path:/tmp/test/../../Users/jordan/Library/Racket/6.1/pkgs/pollen/server-extras/fallback.html>
  in: (include-at/relative-to/reader (file "../../Users/jordan/Library/Racket/6.1/pkgs/pollen/server-extras/fallback.html") (file "../../Users/jordan/Library/Racket/6.1/pkgs/pollen/server-extras/fallback.html") (file "../../Users/jordan/Library/Racket/6.1/pkgs/pollen/server-extras/fallback.html") (let ((xs #f) (command-char-v #\◊)) (λ (src inp) (unless xs (set! xs (if command-char-v (scribble:read-syntax-inside #:command-char command-char-v src inp) (scribble:read-syntax-inside src inp))) (when (syntax? xs) (set! xs (or (syntax->list xs) (list xs))))) (if (null? xs) eof (let ((x (car xs))) (set! xs (cdr xs)) (if (and (null? xs) (let ((p (syntax-property x (quote scribble)))) (and (pair? p) (eq? (car p) (quote newline))))) eof x))))))

  context...:
   /usr/local/racket/collects/racket/private/more-scheme.rkt:162:2: select-handler/no-breaks
   /usr/local/racket/collects/racket/include.rkt:13:0
   /usr/local/racket/share/pkgs/scribble-text-lib/scribble/text/syntax-utils.rkt:72:0
   /usr/local/racket/share/pkgs/scribble-text-lib/scribble/text/syntax-utils.rkt:121:2: loop
   /usr/local/racket/share/pkgs/scribble-text-lib/scribble/text/syntax-utils.rkt:148:0
   core219
   render-to-file
   unpack56
   /Users/jordan/Library/Racket/6.1/pkgs/pollen/server-routes.rkt:223:0: route-default
   /usr/local/racket/share/pkgs/web-server-lib/web-server/dispatchers/dispatch-servlets.rkt:58:2
   /usr/local/racket/share/pkgs/web-server-lib/web-server/private/dispatch-server-unit.rkt:112:8

Procedure that produced the bug for me:

  1. Create a minimal foo.txt.pm or foo.html.pm file in /tmp/test/
  2. Run raco pollen start in /tmp/test/
  3. Load the ptree page and click on foo.html.

This error does not occur if I follow the identical procedure in ~/tmp/ instead. AFAICT this seems like a problem in how OS X handles references to parent dir references; I'm basing that on this experiment at the shell:

$ ls /tmp/test/../..
etc      tftpboot tmp      var
$ ls /tmp/test/../../..
Applications     Users            etc              sbin
Library          Volumes          home             tmp
Network          bin              mach_kernel      usr
System           cores            net              var
User Information dev              private

The latter directory listing shows the actual contents of /; I'm not sure where it's getting the former listing. So, perhaps this is an OS X (or Racket-on-OS X) bug, but maybe it can be worked around in Racket?

I'm getting an error (running pollen on OS X Mavericks) that seems to depend on the directory in which I place my pollen project files. Here is the error text displayed in the console by `raco pollen`: ``` render: foo.html.pm Servlet (@ /foo.html) exception: include-at/relative-to/reader: can't open include file (open-input-file: cannot open input file path: /tmp/test/../../Users/jordan/Library/Racket/6.1/pkgs/pollen/server-extras/fallback.html system error: No such file or directory; errno=2) at: #<path:/tmp/test/../../Users/jordan/Library/Racket/6.1/pkgs/pollen/server-extras/fallback.html> in: (include-at/relative-to/reader (file "../../Users/jordan/Library/Racket/6.1/pkgs/pollen/server-extras/fallback.html") (file "../../Users/jordan/Library/Racket/6.1/pkgs/pollen/server-extras/fallback.html") (file "../../Users/jordan/Library/Racket/6.1/pkgs/pollen/server-extras/fallback.html") (let ((xs #f) (command-char-v #\◊)) (λ (src inp) (unless xs (set! xs (if command-char-v (scribble:read-syntax-inside #:command-char command-char-v src inp) (scribble:read-syntax-inside src inp))) (when (syntax? xs) (set! xs (or (syntax->list xs) (list xs))))) (if (null? xs) eof (let ((x (car xs))) (set! xs (cdr xs)) (if (and (null? xs) (let ((p (syntax-property x (quote scribble)))) (and (pair? p) (eq? (car p) (quote newline))))) eof x)))))) context...: /usr/local/racket/collects/racket/private/more-scheme.rkt:162:2: select-handler/no-breaks /usr/local/racket/collects/racket/include.rkt:13:0 /usr/local/racket/share/pkgs/scribble-text-lib/scribble/text/syntax-utils.rkt:72:0 /usr/local/racket/share/pkgs/scribble-text-lib/scribble/text/syntax-utils.rkt:121:2: loop /usr/local/racket/share/pkgs/scribble-text-lib/scribble/text/syntax-utils.rkt:148:0 core219 render-to-file unpack56 /Users/jordan/Library/Racket/6.1/pkgs/pollen/server-routes.rkt:223:0: route-default /usr/local/racket/share/pkgs/web-server-lib/web-server/dispatchers/dispatch-servlets.rkt:58:2 /usr/local/racket/share/pkgs/web-server-lib/web-server/private/dispatch-server-unit.rkt:112:8 ``` Procedure that produced the bug for me: 1. Create a minimal `foo.txt.pm` or `foo.html.pm` file in `/tmp/test/` 2. Run `raco pollen start` in `/tmp/test/` 3. Load the ptree page and click on `foo.html`. This error does _not_ occur if I follow the identical procedure in `~/tmp/` instead. AFAICT this seems like a problem in how OS X handles references to parent dir references; I'm basing that on this experiment at the shell: ``` $ ls /tmp/test/../.. etc tftpboot tmp var $ ls /tmp/test/../../.. Applications Users etc sbin Library Volumes home tmp Network bin mach_kernel usr System cores net var User Information dev private ``` The latter directory listing shows the actual contents of `/`; I'm not sure where it's getting the former listing. So, perhaps this is an OS X (or Racket-on-OS X) bug, but maybe it can be worked around in Racket?
mbutterick commented 10 years ago (Migrated from github.com)

I believe this is a bug that I caused, and that I fixed on Oct 26 ( 1d31988f2b). If you installed Pollen before then, please do raco pkg update --update-deps pollen to get the fix and let me know if the problem persists.

I believe this is a bug that I caused, and that I fixed on Oct 26 ( 1d31988f2bb16e11cd27bddb629fbfa273bf389e). If you installed Pollen before then, please do `raco pkg update --update-deps pollen` to get the fix and let me know if the problem persists.
RenaissanceBug commented 10 years ago (Migrated from github.com)

Hm. Nope, I installed Pollen last night, and the pkg update command shows no further updates available.

Hm. Nope, I installed Pollen last night, and the pkg update command shows no further updates available.
mbutterick commented 10 years ago (Migrated from github.com)

OK. I will investigate further.

On Nov 14, 2014, at 8:01 AM, Jordan Johnson notifications@github.com wrote:

Hm. Nope, I installed Pollen last night, and the pkg update command shows no further updates available.


Reply to this email directly or view it on GitHub.

OK. I will investigate further. > On Nov 14, 2014, at 8:01 AM, Jordan Johnson notifications@github.com wrote: > > Hm. Nope, I installed Pollen last night, and the pkg update command shows no further updates available. > > — > Reply to this email directly or view it on GitHub.
mbutterick commented 10 years ago (Migrated from github.com)

I reproduced the problem. The specific issue is that /tmp in OS X is actually a symlink to /private/tmp. The general issue is that Pollen was not resolving symlinks. I've just pushed a fix. Thanks for the report.

I reproduced the problem. The specific issue is that `/tmp` in OS X [is actually a symlink](http://apple.stackexchange.com/questions/1043/why-is-tmp-a-symlink-to-private-tmp) to `/private/tmp`. The general issue is that Pollen was not resolving symlinks. I've just pushed a fix. Thanks for the report.
RenaissanceBug commented 10 years ago (Migrated from github.com)

Great! Thanks for the quick reply.

Great! Thanks for the quick reply.
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: mbutterick/pollen#32
Loading…
There is no content yet.