Skip to content

Remove symlink local/share/mathjax/mathjax #26152

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jdemeyer opened this issue Aug 28, 2018 · 32 comments
Closed

Remove symlink local/share/mathjax/mathjax #26152

jdemeyer opened this issue Aug 28, 2018 · 32 comments

Comments

@jdemeyer
Copy link
Contributor

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.

CC: @jhpalmieri @embray

Component: build

Author: Jeroen Demeyer

Branch: b9eb92c

Reviewer: John Palmieri

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

@jdemeyer jdemeyer added this to the sage-8.4 milestone Aug 28, 2018
@embray
Copy link
Contributor

embray commented Aug 28, 2018

comment:1

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.

@jdemeyer

This comment has been minimized.

@jdemeyer
Copy link
Contributor Author

Author: Jeroen Demeyer

@jdemeyer
Copy link
Contributor Author

@jdemeyer

This comment has been minimized.

@jdemeyer
Copy link
Contributor Author

comment:4

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

@jdemeyer
Copy link
Contributor Author

Commit: b9eb92c

@jdemeyer

This comment has been minimized.

@jdemeyer
Copy link
Contributor Author

comment:6

I created #26153 for the sage-spkg problem.

@jdemeyer

This comment has been minimized.

@jhpalmieri
Copy link
Member

comment:9

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.

@jdemeyer
Copy link
Contributor Author

comment:10

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

@jhpalmieri
Copy link
Member

comment:11

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?

@jhpalmieri
Copy link
Member

comment:12

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?

@jdemeyer
Copy link
Contributor Author

comment:13

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).

@embray
Copy link
Contributor

embray commented Aug 29, 2018

comment:14

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.

@embray
Copy link
Contributor

embray commented Aug 29, 2018

comment:15

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.

@jdemeyer
Copy link
Contributor Author

comment:16

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.

@embray
Copy link
Contributor

embray commented Aug 29, 2018

comment:17

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.

@jhpalmieri
Copy link
Member

comment:18

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.

@jhpalmieri
Copy link
Member

Reviewer: John Palmieri

@jhpalmieri
Copy link
Member

comment:19

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.

@vbraun
Copy link
Member

vbraun commented Aug 30, 2018

Changed branch from u/jdemeyer/remove_symlink_local_share_mathjax_mathjax to b9eb92c

@embray
Copy link
Contributor

embray commented Sep 3, 2018

comment:21

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.

@embray
Copy link
Contributor

embray commented Sep 3, 2018

Changed commit from b9eb92c to none

@dimpase
Copy link
Member

dimpase commented Sep 25, 2018

comment:22

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

@jhpalmieri
Copy link
Member

comment:23

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?

@dimpase
Copy link
Member

dimpase commented Sep 25, 2018

comment:24

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

@jhpalmieri
Copy link
Member

comment:25

(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.

@embray
Copy link
Contributor

embray commented Sep 26, 2018

comment:26

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

@jhpalmieri
Copy link
Member

comment:27

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?

@jhpalmieri
Copy link
Member

comment:28

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants