Opened 3 years ago

Closed 3 years ago

## #26152 closed defect (fixed)

Reported by: Owned by: jdemeyer blocker sage-8.4 build jhpalmieri, embray Jeroen Demeyer John Palmieri N/A b9eb92c

There is a symlink local/share/mathjax/mathjax pointing to local/share/mathjax. Presumably, this was created by old sagenb versions.

The bug that the symlink is created is fixed in #24646 (but not completely, see #26153). But the symlink should be removed if it already exists.

### comment:1 follow-up: ↓ 4 Changed 3 years ago by embray

This is already fixed--it does not get created anymore. The question is whether or not to bother putting in something to remove it if it exists. Personally I don't think it's a blocker because it can easily just be removed, and would only be a problem in the case of some incremental builds that wound up with it at some point.

### comment:2 Changed 3 years ago by jdemeyer

• Authors set to Jeroen Demeyer
• Description modified (diff)

### comment:4 in reply to: ↑ 1 ; follow-up: ↓ 9 Changed 3 years ago by jdemeyer

• Description modified (diff)

This is already fixed--it does not get created anymore.

I also assumed that also but we are wrong! The symlink does get created when sagenb is rebuilt (this may also be a bug in the sage-spkg script). So there is certainly something to be fixed here.

New commits:

 ​b9eb92c Rebuild mathjax to remove mathjax/mathjax symlink

### comment:5 Changed 3 years ago by jdemeyer

• Description modified (diff)

### comment:6 Changed 3 years ago by jdemeyer

I created #26153 for the sage-spkg problem.

### comment:7 Changed 3 years ago by jdemeyer

• Status changed from new to needs_review

### comment:8 Changed 3 years ago by jdemeyer

• Description modified (diff)

### comment:9 in reply to: ↑ 4 ; follow-up: ↓ 10 Changed 3 years ago by jhpalmieri

This is already fixed--it does not get created anymore.

I also assumed that also but we are wrong! The symlink does get created when sagenb is rebuilt (this may also be a bug in the sage-spkg script). So there is certainly something to be fixed here.

I am unable to recreate the symlink. Can you do this reliably?

To test so far, I have created the symlink by hand, and then when I ran make with this branch, it got deleted. So that's good.

### comment:10 in reply to: ↑ 9 Changed 3 years ago by jdemeyer

I am unable to recreate the symlink. Can you do this reliably?

(cd local/var/lib/sage/installed; rm mathjax* sagenb*); make sagenb


### comment:11 follow-up: ↓ 13 Changed 3 years ago by jhpalmieri

Okay, that does it. I don't know why the various combinations of ./sage -f mathjax and ./sage -f sagenb don't also do it. And in fact, you don't need to delete the whole sagenb file in installed: for me, just deleting the line

        "lib/python2.7/site-packages/sagenb/data/mathjax",


is enough for ./sage -f sagenb to recreate the link. I don't know what these file manifests are supposed to do, especially since at the beginning of the sagenb install, it says

No record that 'sagenb' was ever installed; skipping uninstall


That implied to me that the manifest was being ignored, but I guess that's not the case. Are these manifest files and their roles documented anywhere?

### comment:12 follow-up: ↓ 15 Changed 3 years ago by jhpalmieri

It seems to me that the solution here is temporary: it will fix the issue for anyone who has the link right now, but as you point out, if sagenb is reinstalled, the link may come back. Will #26153 fix the problem permanently? Is there a way to force mathjax to be reinstalled after sagenb (even though mathjax is a dependency for sagenb), to ensure that any bad links are removed?

### comment:13 in reply to: ↑ 11 Changed 3 years ago by jdemeyer

I don't know what these file manifests are supposed to do, especially since at the beginning of the sagenb install, it says

No record that 'sagenb' was ever installed; skipping uninstall


That implied to me that the manifest was being ignored, but I guess that's not the case.

I agree that this may be confusing. The answer is that ./sage -f is really an uninstall followed by an install, not a reinstall. The message that you quoted refers to uninstallation done as part of the installation. But by the time, sagenb is already uninstalled. This would be different if the uninstall would be part of a reinstall (for a version upgrade for example).

### comment:14 Changed 3 years ago by embray

Now that running sage-spkg-uninstall is part of the normal package installation/upgrade process anyways it would be less confusing to change ./sage -f to somehow force calling sage-spkg <package> without checking (via make) whether it is already up-to-date.

### comment:15 in reply to: ↑ 12 ; follow-up: ↓ 16 Changed 3 years ago by embray

It seems to me that the solution here is temporary: it will fix the issue for anyone who has the link right now, but as you point out, if sagenb is reinstalled, the link may come back. Will #26153 fix the problem permanently? Is there a way to force mathjax to be reinstalled after sagenb (even though mathjax is a dependency for sagenb), to ensure that any bad links are removed?

This is only a problem if you're doing things that you are not supposed to do, like removing the package installation record (the one in local/var/lib/sage/installed) without also removing the files installed by that package. We can't account for every possible way someone's $SAGE_LOCAL is corrupted. The issue caused by symlinks in this case is somewhat unique to symlinks, and the existing package installation code not handling existing symlinks properly; that's what #26153 is addressing. ### comment:16 in reply to: ↑ 15 Changed 3 years ago by jdemeyer Replying to embray: This is only a problem if you're doing things that you are not supposed to do, like removing the package installation record (the one in local/var/lib/sage/installed) without also removing the files installed by that package. We can't account for every possible way someone's $SAGE_LOCAL is corrupted.

I agree partially. We should be mostly assuming a consistent state, but I can imagine some realistic scenarios where the information in local/var/lib/sage/installed is not consistent with the actual filesystem. For example, pressing CTRL-C while the files are being installed.

We shouldn't worry about it too much but we also shouldn't ignore it either.

Maybe it would be better, in that case, if the file manifest were written first. Currently it is only written after file installation is complete. If it were written first then it would represent, at least, what is supposed to be in $SAGE_LOCAL, and then uninstallation can still be used for cleanup. The only problem with that is that the manifest is written to the same file that indicates that installation succeeded. Maybe it should be a separate file; I don't know. ### comment:18 in reply to: ↑ 17 ; follow-up: ↓ 21 Changed 3 years ago by jhpalmieri Replying to embray: Maybe it would be better, in that case, if the file manifest were written first. Currently it is only written after file installation is complete. If it were written first then it would represent, at least, what is supposed to be in $SAGE_LOCAL, and then uninstallation can still be used for cleanup.

The only problem with that is that the manifest is written to the same file that indicates that installation succeeded. Maybe it should be a separate file; I don't know.

Maybe I'm misunderstanding, but you could write the manifest in a temporary location (and use it there for uninstallation) and then install it after file installation is complete.

### comment:19 Changed 3 years ago by jhpalmieri

• Reviewers set to John Palmieri
• Status changed from needs_review to positive_review

I'm willing to give this a positive review as a stopgap measure. I hope the real issue with symlinks can be addressed at #26153.

### comment:20 Changed 3 years ago by vbraun

• Resolution set to fixed
• Status changed from positive_review to closed

### comment:26 Changed 3 years ago by embray

Yeah all this ticket did was force reinstallation of the mathjax spkg for some people.

### comment:27 Changed 3 years ago by jhpalmieri

This problem has returned for me. As part of Sage's installation (part of some package, I'm not sure which one, or maybe a level up from that), should we check whether this link exists, and if so, delete it?

### comment:28 Changed 3 years ago by jhpalmieri

See #26612 for a proposed solution (although I still don't know what is causing the problem).

Note: See TracTickets for help on using tickets.