1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 11:50:28 +02:00

Fix include-from-path when file found in relative path

* module/ice-9/psyntax.scm (include-from-path): Canonicalize result of
  %search-load-path.  Otherwise a relative path passed to `include'
  would be treated as relative to the directory of the file that
  contains the `include-from-path'.  Fixes #21347.
* module/ice-9/psyntax-pp.scm: Regenerate.
This commit is contained in:
Andy Wingo 2016-06-24 10:40:09 +02:00
parent 395582b218
commit 5ca24b6ba1
2 changed files with 14 additions and 12 deletions

View file

@ -3285,14 +3285,15 @@
(let ((fn (syntax->datum filename))) (let ((fn (syntax->datum filename)))
(let ((tmp (datum->syntax (let ((tmp (datum->syntax
filename filename
(let ((t (%search-load-path fn))) (canonicalize-path
(if t (let ((t (%search-load-path fn)))
t (if t
(syntax-violation t
'include-from-path (syntax-violation
"file not found in path" 'include-from-path
x "file not found in path"
filename)))))) x
filename)))))))
(let ((fn tmp)) (let ((fn tmp))
(list '#(syntax-object include ((top)) (hygiene guile)) fn))))) (list '#(syntax-object include ((top)) (hygiene guile)) fn)))))
tmp) tmp)

View file

@ -3204,10 +3204,11 @@
(let ((fn (syntax->datum #'filename))) (let ((fn (syntax->datum #'filename)))
(with-syntax ((fn (datum->syntax (with-syntax ((fn (datum->syntax
#'filename #'filename
(or (%search-load-path fn) (canonicalize-path
(syntax-violation 'include-from-path (or (%search-load-path fn)
"file not found in path" (syntax-violation 'include-from-path
x #'filename))))) "file not found in path"
x #'filename))))))
#'(include fn))))))) #'(include fn)))))))
(define-syntax unquote (define-syntax unquote