sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.46k stars 482 forks source link

src/sage/env.py: don't pass if mismatched SAGE_ROOT is None #38935

Open orlitzky opened 2 weeks ago

orlitzky commented 2 weeks ago

In this file we test that SAGE_ROOT in a subprocess is the same as SAGE_ROOT in the parent. There is a special case for when SAGE_ROOT is None, but that special case can pass if only one of the SAGE_ROOT variables is None and the other is not -- contrary to the intent of the test.

Here we extend the special case to ensure that both SAGE_ROOT variables are None if one of them is.

Thanks to Gonzalo Tornaría for the suggestion.

orlitzky commented 2 weeks ago

wait for CI, I haven't actually tried it

github-actions[bot] commented 2 weeks ago

Documentation preview for this PR (built with commit baecf8cfe833aff051aca9a49cbe7d38e1716915; changes) is ready! :tada: This preview will update shortly after each push to this PR.

kwankyu commented 3 days ago

In what situation, SAGE_ROOT could be None?

What subprocess is this test for? sage -python?

orlitzky commented 3 days ago

On 2024-11-18 19:58:58, Kwankyu Lee wrote:

In what situation, SAGE_ROOT could be None?

I don't have an example handy, but after sagelib is installed, SAGE_ROOT should not matter -- maybe some distro packages are setting it to None to avoid leaking details about the build system?

What subprocess is this test for? sage -python?

Essentially, yes. Whatever python is used to run sage. I think most often it will be the system python.

orlitzky commented 2 days ago

Thanks again.