From c4679bf0951e4b21fcf4c447aa9ca2938e36e138 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 10 Jul 2021 17:48:08 -0700 Subject: compiler: disallow trailing slashes in path. * stdlib/compiler.tl (open-compile-streams): If in-path end in a path separator character, throw an error. --- stdlib/compiler.tl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stdlib/compiler.tl b/stdlib/compiler.tl index 0e8d8fe3..ad062e51 100644 --- a/stdlib/compiler.tl +++ b/stdlib/compiler.tl @@ -2165,8 +2165,10 @@ use-sym unuse-sym)) (defun open-compile-streams (in-path out-path test-fn) + (if (and (nullify in-path) + (find [in-path -1] path-sep-chars)) + (error "~s: invalid input pathname ~s" 'compile-file in-path)) (let* ((parent (or *load-path* "")) - (in-path (trim-right #/[\/\\]+/ in-path)) (in-path (if (and (pure-rel-path-p in-path) (not (empty parent))) (path-cat (dir-name parent) in-path) in-path)) -- cgit v1.2.3