From c4a484f7c173b866311d872f062f0dd8fd237dad Mon Sep 17 00:00:00 2001 From: Doug Torrance Date: Wed, 4 Jun 2025 11:52:24 -0400 Subject: [PATCH 1/2] Use correct file time for filesLoaded hash table keys The keys were filenames *after* we called realpath, but the keys were file times from *before* we called it, so they may have been incorrect for symlinks. --- M2/Macaulay2/m2/startup.m2.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/M2/Macaulay2/m2/startup.m2.in b/M2/Macaulay2/m2/startup.m2.in index a9dc8e24fb..e0a86e362b 100644 --- a/M2/Macaulay2/m2/startup.m2.in +++ b/M2/Macaulay2/m2/startup.m2.in @@ -55,11 +55,11 @@ if firstTime then ( srcdirs = {}; markLoaded = (filepath, filetime, notify) -> ( - filepath = realpath toAbsolutePath filepath; filesLoaded#filepath = filetime; loadedFiles##loadedFiles = filepath; if notify then printerr("loaded ", filepath)); tryLoad = (filename, filepath, loadfun, notify) -> if fileExists filepath then ( + filepath = realpath toAbsolutePath filepath; filetime := fileTime filepath; if notify then printerr("loading ", filename); ret := loadfun filepath; From 9946d25b611a2cec2388d14a16e2f281285ddbe2 Mon Sep 17 00:00:00 2001 From: Doug Torrance Date: Mon, 9 Jun 2025 09:01:26 -0400 Subject: [PATCH 2/2] Use "realpath" when creating test file to test tests Now that we call "realpath" when loading files, we should get the expected output on systems like macOS where the temporary directory is a symlink. --- M2/Macaulay2/tests/normal/testing.m2 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/M2/Macaulay2/tests/normal/testing.m2 b/M2/Macaulay2/tests/normal/testing.m2 index ef4902fae4..4337351980 100644 --- a/M2/Macaulay2/tests/normal/testing.m2 +++ b/M2/Macaulay2/tests/normal/testing.m2 @@ -1,8 +1,9 @@ -testpkg = minimizeFilename(temporaryFileName() | ".m2") +testpkg = temporaryFileName() | ".m2" testpkg << ///newPackage("TestPackage") beginDocumentation() TEST "assert Equation(1 + 1, 2)" /// << close +testpkg = minimizeFilename realpath testpkg loadPackage("TestPackage", FileName => testpkg) check "TestPackage" pkgtest = tests(0, "TestPackage")