get-*-source functions raise exception when filename includes a relative path
otherjoel opened this issue · 2 comments
In an empty folder, create example.html.pm
, a folder sub/
and a file sub/another.html.pm
. (The files can be empty, created with touch
) Then in the base folder, create the following pollen.rkt
:
#lang racket
(require pollen/file)
(get-markup-source "example.html")
(get-markup-source "sub/another.html")
Expected output:
#<path:example.html.pm>
#<path:sub/another.html.pm>
Actual output:
#<path:example.html.pm>
../../../Library/Racket/7.7/pkgs/pollen/pollen/setup.rkt:21:0: path->complete-path: second argument is not a complete path
first argument: #<path:pollen.rkt>
second argument: #<path:sub/>
context...:
/Users/joel/Library/Racket/7.7/pkgs/pollen/pollen/setup.rkt:21:0: get-path-to-override
/Users/joel/Library/Racket/7.7/pkgs/pollen/pollen/setup.rkt:48:11: poly-targets
/Users/joel/Library/Racket/7.7/pkgs/pollen/pollen/private/file-utils.rkt:164:11: get-markup-source
/Users/joel/Documents/code/sandbox/pollen.rkt:1:1 [running body]
Important to note, this happens even when there is a sub/pollen.rkt
that provides a valid setup
module.
It looks like this is due to these recent changes in pollen/setup.rkt
surfacing a possible bug in get-path-to-override
.
When get-path-to-override
is called with a relative path+file, the relative “folders” part is passed unmodified into path->complete-path
where it raises the above exception because it is not a complete path.
The functions generated by define-settable
call the get-path-to-override
function. Prior to 912ba08 this call was inside with-handlers
. The bug in this function causes an exn:fail:contract?
exception to be raised even when a valid sub/pollen.rkt
exists, but it was caught by the handler so no error surfaced to the user.
Thanks! Yes, that with-handlers
was incorrectly suppressing some legitimate bugs (not all of which I’ve discovered yet, clearly)
Thank you!