Skip to content

Fix conftest.py being deleted by configure script#41333

Merged
vbraun merged 2 commits intosagemath:developfrom
cxzhong:patch-7
Dec 29, 2025
Merged

Fix conftest.py being deleted by configure script#41333
vbraun merged 2 commits intosagemath:developfrom
cxzhong:patch-7

Conversation

@cxzhong
Copy link
Copy Markdown
Contributor

@cxzhong cxzhong commented Dec 25, 2025

Problem

When running make after switching branches or when reconfiguration is needed, conftest.py (the pytest configuration file) gets deleted.

Root Cause

The configure_wrapper script backs up conftest.py before running ./real_configure and restores it afterward:

trap 'mv bak_conftest.py conftest.py; trap - EXIT; exit' EXIT INT HUP TERM
cp conftest.py bak_conftest.py
./real_configure $@

However, when make triggers a reconfigure, it runs:

./config.status --recheck

The config.status file is generated by real_configure and contains a hardcoded path:

# Line 502 in config.status
set X /bin/bash './real_configure' $ac_configure_extra_args --no-create --no-recursion

This bypasses the ./configure wrapper entirely, so:

  1. conftest.py is not backed up
  2. real_configure runs and deletes all conftest* files
  3. conftest.py is gone

When This Happens

  • Running make after git checkout to a different branch
  • Running make after any change that triggers reconfigure target
  • Running ./config.status --recheck directly

Potential Solutions

Modify config.status generation - Patch the autoconf output to call ./configure instead of ./real_configure

📝 Checklist

  • The title is concise and informative.
  • 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 and checked the documentation preview.

⌛ Dependencies

…gure

Updated backup file naming and modified configure script behavior to protect conftest.py during configuration.
@cxzhong cxzhong reopened this Dec 25, 2025
@cxzhong cxzhong marked this pull request as ready for review December 25, 2025 11:35
@github-actions
Copy link
Copy Markdown

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

@dimpase
Copy link
Copy Markdown
Member

dimpase commented Dec 25, 2025

seems to be the right path to fix this, finally, not sure about details

@dimpase
Copy link
Copy Markdown
Member

dimpase commented Dec 25, 2025 via email

@dimpase
Copy link
Copy Markdown
Member

dimpase commented Dec 26, 2025

oops, I actually made a testing error, sorry. It seems to work all right.

Comment thread configure_wrapper
@vbraun vbraun merged commit 3ce19ea into sagemath:develop Dec 29, 2025
29 of 31 checks passed
@cxzhong cxzhong deleted the patch-7 branch December 29, 2025 12:50
Comment thread configure_wrapper

# Fix config.status to call ./configure instead of ./real_configure
# so that --recheck also protects conftest.py
sed -i "s|'./real_configure'|'./configure'|g" config.status
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this is non-posix use of sed, it breaks macOS builds.
https://groups.google.com/g/sage-release/c/fG2pnz3Hfi0/m/dF2iSSIjBgAJ
@cxzhong

dimpase added a commit to dimpase/sage that referenced this pull request Jan 6, 2026
@dimpase dimpase mentioned this pull request Jan 6, 2026
5 tasks
dimpase added a commit to dimpase/sage that referenced this pull request Jan 7, 2026
dimpase added a commit to dimpase/sage that referenced this pull request Jan 7, 2026
fixes a bug in sagemath#41333
tested on macOS and Linux now
vbraun pushed a commit to vbraun/sage that referenced this pull request Jan 13, 2026
sagemathgh-41399: allow macOS sed
    
fixes a bug in sagemath#41333

<!-- ^ Please provide a concise and informative title. -->
<!-- ^ Don't put issue numbers in the title, do this in the PR
description below. -->
<!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method
to calculate 1 + 2". -->
<!-- v Describe your changes below in detail. -->
<!-- v Why is this change required? What problem does it solve? -->
<!-- v If this PR resolves an open issue, please link to it here. For
example, "Fixes sagemath#12345". -->



### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [x] The title is concise and informative.
- [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 and checked the documentation
preview.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on. For example,
-->
<!-- - sagemath#12345: short description why this is a dependency -->
<!-- - sagemath#34567: ... -->
    
URL: sagemath#41399
Reported by: Dima Pasechnik
Reviewer(s): John H. Palmieri
vbraun pushed a commit to vbraun/sage that referenced this pull request Jan 14, 2026
sagemathgh-41399: allow macOS sed
    
fixes a bug in sagemath#41333

<!-- ^ Please provide a concise and informative title. -->
<!-- ^ Don't put issue numbers in the title, do this in the PR
description below. -->
<!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method
to calculate 1 + 2". -->
<!-- v Describe your changes below in detail. -->
<!-- v Why is this change required? What problem does it solve? -->
<!-- v If this PR resolves an open issue, please link to it here. For
example, "Fixes sagemath#12345". -->



### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [x] The title is concise and informative.
- [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 and checked the documentation
preview.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on. For example,
-->
<!-- - sagemath#12345: short description why this is a dependency -->
<!-- - sagemath#34567: ... -->
    
URL: sagemath#41399
Reported by: Dima Pasechnik
Reviewer(s): John H. Palmieri
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.

3 participants