Skip to content

needsPackage bug #3851

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mahrud opened this issue May 26, 2025 · 1 comment
Open

needsPackage bug #3851

mahrud opened this issue May 26, 2025 · 1 comment

Comments

@mahrud
Copy link
Member

mahrud commented May 26, 2025

The workshop testbot seems to have broken:

2025-05-26T13:19:54.6482302Z  -- Found 1 test file(s) matching '/__w/Workshop-2024-Leipzig/Workshop-2024-Leipzig/tests/*.m2'.
2025-05-26T13:19:54.7222293Z  -- capturing check(0, "User")/usr/share/Macaulay2/Core/packages.m2:195:68:(1):[20]: error: key not found in hash table:
2025-05-26T13:19:54.7224192Z         "/usr/share/Macaulay2/Core/startup.m2" (of class String)
2025-05-26T13:19:54.7224958Z /usr/share/Macaulay2/Core/packages.m2:195:14:(1):[19]: --back trace--
2025-05-26T13:19:54.7225754Z /usr/share/Macaulay2/Core/methods.m2:154:98:(1):[18]: --back trace--
2025-05-26T13:19:54.7226558Z /usr/share/Macaulay2/Core/examples.m2:96:73:(1):[16]: --back trace--
2025-05-26T13:19:54.7232804Z /usr/share/Macaulay2/Core/methods.m2:154:98:(1):[15]: --back trace--
2025-05-26T13:19:54.7233350Z /usr/share/Macaulay2/Core/option.m2:17:14:(1):[14]: --back trace--
2025-05-26T13:19:54.7233784Z /usr/share/Macaulay2/Core/testing.m2:66:32:(1):[13]: --back trace--
2025-05-26T13:19:54.7234204Z /usr/share/Macaulay2/Core/testing.m2:121:48:(1):[12]: --back trace--
2025-05-26T13:19:54.7234515Z  -- .0718583s elapsed
2025-05-26T13:19:54.7234815Z /usr/share/Macaulay2/Core/testing.m2:107:101:(1):[12]: --back trace--
2025-05-26T13:19:54.7235265Z /usr/share/Macaulay2/Core/methods.m2:154:98:(1):[11]: --back trace--
2025-05-26T13:19:54.7235675Z /usr/share/Macaulay2/Core/option.m2:17:14:(1):[10]: --back trace--
2025-05-26T13:19:54.7236131Z /usr/share/Macaulay2/Core/testing.m2:101:37:(1):[9]: --back trace--
2025-05-26T13:19:54.7236534Z /usr/share/Macaulay2/Core/methods.m2:154:98:(1):[8]: --back trace--
2025-05-26T13:19:54.7236941Z /usr/share/Macaulay2/Core/option.m2:17:14:(1):[7]: --back trace--
2025-05-26T13:19:54.7237303Z tests/testbot.m2:36:5:(3):[6]: --back trace--
2025-05-26T13:19:54.7237647Z /usr/share/Macaulay2/Core/startup.m2:65:23:(0):[6]: --back trace--
2025-05-26T13:19:54.7238047Z /usr/share/Macaulay2/Core/Core.m2:131:28:(1):[5]: --back trace--
2025-05-26T13:19:54.7238448Z /usr/share/Macaulay2/Core/Core.m2:127:13:(1):[3]: --back trace--
2025-05-26T13:19:54.7238825Z /usr/share/Macaulay2/Core/Core.m2:138:29:(1):[2]: --back trace--
2025-05-26T13:19:54.7239212Z /usr/share/Macaulay2/Core/startup.m2:533:66:(0):[1]: --back trace--
2025-05-26T13:19:54.7239608Z /usr/share/Macaulay2/Core/startup.m2:623:30:(0): --back trace--

Here is the surroundings of packages.m2:195:

needsPackage String := opts -> pkgname -> (
if PackageDictionary#?pkgname
and instance(pkg := value PackageDictionary#pkgname, Package)
and (opts.FileName === null or
realpath opts.FileName == realpath pkg#"source file")
and pkg.PackageIsLoaded
then (
if any(packageFiles pkg, file -> fileTime file > filesLoaded#file)
then loadPackage(pkgname, opts ++ {Reload => true})
else use pkg)
else loadPackage(pkgname, opts))

Based on this, I'm guessing the bug was introduced in #3741, and if possible would be great to resolve it before the patch release.

cc: @d-torrance

@mahrud
Copy link
Member Author

mahrud commented May 26, 2025

Ah, I'm guessing this is the cause:

ii17 : packageFiles User

oo17 = {/usr/share/Macaulay2/Core/startup.m2}

Which is because of this:

ii20 : User#"source file"

oo20 = /usr/share/Macaulay2/Core/startup.m2

This was referenced May 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant