Skip to content

Commit

Permalink
Escape dots in regex for using startupString in "code"
Browse files Browse the repository at this point in the history
Otherwise, we could theoretically load a file named something like
"startupxm2xin", call "code" on something from that file, and
end up with some code from startup.m2.in.
  • Loading branch information
d-torrance committed Sep 18, 2024
1 parent 97fdf9a commit 0fceb0f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion M2/Macaulay2/m2/code.m2
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ code FilePosition := x -> (
(
wp := set characters " \t\r);";
file := (
if match("startup.m2.in$", filename) then startupString
if match("startup\\.m2\\.in$", filename) then startupString
else if filename === "currentString" then (
if currentString === null
then error "code no longer available"
Expand Down

0 comments on commit 0fceb0f

Please sign in to comment.