3-manifolds / Sage_macOS

SageMath as a macOS application bundle.
152 stars 15 forks source link

Bug in Sage_macOS #33

Closed koffie closed 2 years ago

koffie commented 2 years ago

First of all thank you @culler for providing a binary on OS X.

The below is I think a bug in the binary being caused by somehow certain paths (like "/Users/culler/programs" ) unintentionally ending up in the Sage_macOS binary.

sage: f =x ** 8 - 2 * x ** 7 - 12 * x ** 6 + 26 * x ** 5 + 17 * x ** 4 - 36 * x ** 3 - 5 * x ** 2 + 11 * x - 1 
sage: K = NumberField(f, "a") 
sage: K.galois_group()                                                                                                       
<repr(<sage.rings.number_field.galois_group.GaloisGroup_v2_with_category at 0x26dd4a5e0>) failed: cypari2.handle_error.PariError: error opening galois file: `/Users/culler/programs/Sage_macOS/Sage_framework/bigrepo/sage/local/share/pari/galdata/COS8_49_45'>

I think in order to reproduce this bug you would need to install the sage binary on another OS X machine, that doesn't have the user 'culler' on it. Or maybe install it using a user other then 'culler' that just doesn't have read access to '/Users/culler/programs/'.

culler commented 2 years ago

Thank you @koffie. Indeed it is hard to track down all of the hard-wired paths in the Sage tree, and my script for fixing them missed this one. I will see what I can do about that.

koffie commented 2 years ago

p.s. Is the relocate once script being used in Sage_macOS?

https://github.com/sagemath/binary-pkg/blob/master/binary_pkg/templates/relocate-once.py 

Cause I always thought that the goal of that script was to fix these kind of issues. I'll try and see if it also breaks on another binary install. It might be an honest sage bug.

culler commented 2 years ago

No. I do not use that script. I have to do something similar but more complex that also involves a global symlink in /var/tmp and resetting rpaths for all executables because library paths in a signed application bundle are not allowed to be absolute paths.

I do not think this is a Sage bug. It think it is just a matter of processing some files that I did not realize needed to be processed.

culler commented 2 years ago

I think I have found the bad hardwired path. It is in the libpari dylib. Fixing this is not going to be simple, I am afraid.

culler commented 2 years ago

@koffie I have now completely reworked my build system so as to reliably avoid these kinds of path issues. I used the new system to build the SageMath-9.5 prerelease. I tested with your example on both intel and arm, after ensuring that the path referenced in your error message did not exist. It worked fine.

I am not sure that I want to completely rebuild the 9.4 release with the release of 9.5 so imminent. Can you please verify that this problem is fixed in the 9.5 prerelease? Thank you.

koffie commented 2 years ago

Sorry for taking some time to come back on this but this is the result with the prerelease:


┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 9.5.rc2, Release Date: 2022-01-16                 │
│ Using Python 3.9.9. Type "help()" for help.                        │
└────────────────────────────────────────────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Warning: this is a prerelease version, and it may be unstable.     ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
sage: f =x ** 8 - 2 * x ** 7 - 12 * x ** 6 + 26 * x ** 5 + 17 * x ** 4 - 3
....: 6 * x ** 3 - 5 * x ** 2 + 11 * x - 1  
....: K = NumberField(f, "a")  
....: K.galois_group()                                                    
Galois group 8T4 ([4]2) with order 8 of x^8 - 2*x^7 - 12*x^6 + 26*x^5 + 17*x^4 - 36*x^3 - 5*x^2 + 11*x - 1

Thanks for fixing this.

culler commented 2 years ago

Excellent! Thanks. I'll close the ticket then.