Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#26152 closed defect (fixed)

Remove symlink local/share/mathjax/mathjax

Reported by: jdemeyer Owned by:
Priority: blocker Milestone: sage-8.4
Component: build Keywords:
Cc: jhpalmieri, embray Merged in:
Authors: Jeroen Demeyer Reviewers: John Palmieri
Report Upstream: N/A Work issues:
Branch: b9eb92c (Commits, GitHub, GitLab) Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by jdemeyer)

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

This is creating trouble for the Sage documentation (see also #25111).

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.

Change History (28)

comment:1 follow-up: 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:3 Changed 3 years ago by jdemeyer

  • Branch set to u/jdemeyer/remove_symlink_local_share_mathjax_mathjax

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

  • Commit set to b9eb92c31c9ac8268bbea31ada66fa31c09c8d4d
  • Description modified (diff)

Replying to embray:

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:

b9eb92cRebuild 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: Changed 3 years ago by jhpalmieri

Replying to jdemeyer:

Replying to embray:

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

Replying to jhpalmieri:

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: 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: 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

Replying to jhpalmieri:

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: Changed 3 years ago by embray

Replying to 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?

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.

comment:17 follow-up: Changed 3 years ago by 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.

comment:18 in reply to: ↑ 17 ; follow-up: 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

  • Branch changed from u/jdemeyer/remove_symlink_local_share_mathjax_mathjax to b9eb92c31c9ac8268bbea31ada66fa31c09c8d4d
  • Resolution set to fixed
  • Status changed from positive_review to closed

comment:21 in reply to: ↑ 18 Changed 3 years ago by embray

  • Commit b9eb92c31c9ac8268bbea31ada66fa31c09c8d4d deleted

Replying to 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.

I thought I posted it here but maybe forgot. But yes, I arrived at the same conclusion independently, so that's probably the obvious thing to do. Write it first to a temp file, then move it to its proper location once installation completes successfully.

The only trick is that those "temp" files still need to be written some place that the uninstaller can find it. Maybe it would be the same file by with a .tmp extension added, with the uninstaller updated to also find those .tmp files.

comment:22 Changed 3 years ago by dimpase

Could anyone with working MathJax in Jupyter Sage notebooks post their setup?

After this was fixed, I can't get it to work any more...

comment:23 Changed 3 years ago by jhpalmieri

What do you mean by "setup"? I don't think I've done anything special, and math displays fine for me in Sage's Jupyter notebook. So I'm happy to provide information, but what are you looking for?

comment:24 Changed 3 years ago by dimpase

It was possible to set all the display to MathJax, no? What works for me is putting

%display latex
...

in a cell, and then it seems to use MathJax to show stuff in it. So it might be that my memory is fuzzy at this point, and I'm confusing this with some other notebook...

comment:25 Changed 3 years ago by jhpalmieri

(a) The legacy Sage notebook had an option to typeset all output, in which case it would use MathJax by default. Could that be what you're thinking of? I don't know of such an option for the Jupyter notebook, so I can't answer that part of your question.

(b) If you're actually missing a feature, I don't think it would be due to this ticket. (Or if it was, then the feature was relying on seriously buggy behavior, and I think that is unlikely.) In particular, MathJax does work with the Jupyter notebook, for instance if I do show(matrix(10, 10, lambda i, j: i+j)) or I put $x=y$ in a markdown cell. It sounds like you also see MathJax in action.

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.