Skip to content
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

Do not run sage-env more than once, for real. #36364

Merged
merged 1 commit into from
Oct 8, 2023

Conversation

jhpalmieri
Copy link
Member

@jhpalmieri jhpalmieri commented Sep 29, 2023

Do not run sage-env more than once.

In the previous version of sage-env, in the lines

SAGE_ENV_VERSION="6:$SAGE_LOCAL:$SAGE_VENV:$SAGE_SRC"
if [ "$SAGE_ENV_SOURCED" = "$SAGE_ENV_VERSION" ]; then
    # Already sourced, nothing to do.
    return 0
fi
export SAGE_ENV_SOURCED="$SAGE_ENV_VERSION"

the test would fail the first time, as it should, but when the rest of the file was executed, SAGE_SRC would get changed. That meant that the test would fail the next time and so the file would get executed again. We move the last line to the end of the file, and also change it to explicitly use SAGE_LOCAL, SAGE_VENV, and SAGE_SRC so that it uses the up-to-date versions.

This should fix part of the problem in #36337: it should prevent duplicate -rpath entries which were arising because sage-env was getting executed twice.

📝 Checklist

  • The title is concise, informative, and self-explanatory.
  • The description explains in detail what this PR is about.
  • I have linked a relevant issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation accordingly.

⌛ Dependencies

@github-actions
Copy link

Documentation preview for this PR (built with commit b081169; changes) is ready! 🎉

Copy link
Contributor

@mkoeppe mkoeppe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@jhpalmieri
Copy link
Member Author

Great, thank you!

vbraun pushed a commit to vbraun/sage that referenced this pull request Oct 1, 2023
    
<!-- ^^^^^
Please provide a concise, informative and self-explanatory title.
Don't put issue numbers in there, do this in the PR body below.
For example, instead of "Fixes sagemath#1234" use "Introduce new method to
calculate 1+1"
-->

Do not run sage-env more than once.

<!-- Describe your changes here in detail -->

<!-- Why is this change required? What problem does it solve? -->
<!-- If this PR resolves an open issue, please link to it here. For
example "Fixes sagemath#12345". -->

In the previous version of sage-env, in the lines
```
SAGE_ENV_VERSION="6:$SAGE_LOCAL:$SAGE_VENV:$SAGE_SRC"
if [ "$SAGE_ENV_SOURCED" = "$SAGE_ENV_VERSION" ]; then
    # Already sourced, nothing to do.
    return 0
fi
export SAGE_ENV_SOURCED="$SAGE_ENV_VERSION"
```
the test would fail the first time, as it should, but when the rest of
the file was executed, SAGE_SRC would get changed. That meant that the
test would fail the next time and so the file would get executed again.
We move the last line to the end of the file, and also change it to
explicitly use `SAGE_LOCAL`, `SAGE_VENV`, and `SAGE_SRC` so that it uses
the up-to-date versions.

This should fix part of the problem in sagemath#36337: it should prevent
duplicate `-rpath` entries which were arising because sage-env was
getting executed twice.

<!-- If your change requires a documentation PR, please link it
appropriately. -->

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->
<!-- If your change requires a documentation PR, please link it
appropriately -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
<!-- Feel free to remove irrelevant items. -->

- [X] The title is concise, informative, and self-explanatory.
- [X] The description explains in detail what this PR is about.
- [X] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on
- sagemath#12345: short description why this is a dependency
- sagemath#34567: ...
-->

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
    
URL: sagemath#36364
Reported by: John H. Palmieri
Reviewer(s): Dima Pasechnik, John H. Palmieri, Matthias Köppe
@vbraun vbraun merged commit 16aaae1 into sagemath:develop Oct 8, 2023
20 of 22 checks passed
@mkoeppe mkoeppe added this to the sage-10.2 milestone Oct 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants