sagemath / sage

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

Unhandled configure error when multiple installation records exist for the same SPKG #27566

Closed embray closed 4 years ago

embray commented 5 years ago

If, by some accident, one ends up with multiple stamp files for the same package in local/var/lib/sage/installed, an error occurs when running ./configure.

For example, in my case, in the course of development I somehow accidentally wound up with two install records for different versions of mpir. This results in an error appearing during ./configure like:

...
    mpc-1.1.0
    mpfi-1.5.2
    mpfr-4.0.1.p0
    mpfrcx-0.5
./configure: line 10692: test: local/var/lib/sage/installed/mpir-3.0.0-644faf502c56f97d9accd301965fc57d6ec70868: binary operator expected
    mpir-3.0.0-644faf502c56f97d9accd301965fc57d6ec70868.p0
    mpmath-1.1.0
    nauty-26r1.p0

Of course, this should never happen during normal development or usage, but apparently it can since I somehow made it happen.

Attached is a possible fix: The configure script now detects this condition as an error, and aborts with an error message that's at least a bit more useful than none at all:

...
    mpfr-4.0.1.p0
    mpfrcx-0.5
configure: error: multiple installation records for mpir at
local/var/lib/sage/installed/mpir-3.0.0-644faf502c56f97d9accd301965fc57d6ec70868
local/var/lib/sage/installed/mpir-3.0.0-644faf502c56f97d9accd301965fc57d6ec70868.p0
only one should exist so please delete one or both files and re-configure

It's impossible to know for sure what the best course of action is here, so we give the user a hint and leave it up to them to make a decision and retry.

The branch is on top of #28788.

CC: @dimpase @jhpalmieri @saraedum @orlitzky

Component: build: configure

Author: Erik Bray, Matthias Koeppe

Branch/Commit: ec9ab87

Reviewer: Michael Orlitzky

Issue created by migration from https://trac.sagemath.org/ticket/27566

embray commented 5 years ago

Commit: 939c342

embray commented 5 years ago

Description changed:

--- 
+++ 
@@ -16,3 +16,16 @@

 Of course, this should never happen during normal development or usage, but apparently it *can* since I somehow made it happen.

+Attached is a possible fix: The configure script now detects this condition as an error, and aborts with an error message that's at least a bit more useful than none at all:
+
+```
+...
+    mpfr-4.0.1.p0
+    mpfrcx-0.5
+configure: error: multiple installation records for mpir at
+local/var/lib/sage/installed/mpir-3.0.0-644faf502c56f97d9accd301965fc57d6ec70868
+local/var/lib/sage/installed/mpir-3.0.0-644faf502c56f97d9accd301965fc57d6ec70868.p0
+only one should exist so please delete one or both files and re-configure
+```
+
+It's impossible to know for sure what the best course of action is here, so we give the user a hint and leave it up to them to make a decision and retry.
embray commented 5 years ago

Branch: u/embray/build/ticket-27566

embray commented 5 years ago

New commits:

939c342Trac #27566: Detect the condition of multiple SPKG stamp files and error out of the configure script
embray commented 5 years ago

Author: Erik Bray

embray commented 5 years ago
comment:3

Moving tickets from the Sage 8.8 milestone that have been actively worked on in the last six months to the next release milestone (optimistically).

embray commented 4 years ago
comment:4

Ticket retargeted after milestone closed

mkoeppe commented 4 years ago

Dependencies: #28788

mkoeppe commented 4 years ago
comment:5

This should be rebased on top of #28788 because it touches the same code.

mkoeppe commented 4 years ago

Changed branch from u/embray/build/ticket-27566 to u/mkoeppe/build/ticket-27566

mkoeppe commented 4 years ago

Last 10 new commits:

83633dfMerge branch 'develop' into t/28788/mrs/38/verbose-configure
684b80cMerge tag '9.1.beta3' into t/28788/mrs/38/verbose-configure
1dd1252Put configure box messages also into log, via AS_MESSAGE_FD
192c24dSend configure's macOS message to the right FD
0196d25fixup log
5bcc0e4tox.ini [check_configure]: New - test that 'configure --quiet' is quiet
bef6d57Improve spkg messages
bf4ee6cTrac #27566: Detect the condition of multiple SPKG stamp files and error out of the configure script
383290am4/sage_spkg_enable.m4: SAGE_SPKG_ENABLE: Do not trip over multiple install records
51dc4b3Rewrite to avoid use of wc
mkoeppe commented 4 years ago

Changed commit from 939c342 to 51dc4b3

mkoeppe commented 4 years ago

Changed author from Erik Bray to Erik Bray, Matthias Koeppe

mkoeppe commented 4 years ago

Description changed:

--- 
+++ 
@@ -29,3 +29,5 @@

It's impossible to know for sure what the best course of action is here, so we give the user a hint and leave it up to them to make a decision and retry. + +The branch is on top of #28788.

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 4 years ago

Changed commit from 51dc4b3 to e5678b4

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 4 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

e5678b4Merge tag '9.1.beta4' into t/27566/build/ticket-27566
mkoeppe commented 4 years ago
comment:10

Needs review

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 4 years ago

Changed commit from e5678b4 to ec9ab87

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 4 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

ec9ab87Merge tag '9.1.beta6' into t/27566/build/ticket-27566
mkoeppe commented 4 years ago

Changed dependencies from #28788 to none

mkoeppe commented 4 years ago

New commits:

ec9ab87Merge tag '9.1.beta6' into t/27566/build/ticket-27566
mkoeppe commented 4 years ago
comment:13

@embray please take a look.

mkoeppe commented 4 years ago
comment:15

Waiting for review

orlitzky commented 4 years ago
comment:16

I hate to slow down the configure script even more to display a message about a one-in-a-million error condition. The change to sage_spkg_enable.m4 alone avoids the error. But everything works as advertised.

orlitzky commented 4 years ago

Reviewer: Michael Orlitzky

mkoeppe commented 4 years ago
comment:17

Thanks!

vbraun commented 4 years ago

Changed branch from u/mkoeppe/build/ticket-27566 to ec9ab87