Opened 13 months ago

Last modified 12 months ago

#26612 new defect

Remove bad mathjax symlink and bad mathjax directories

Reported by: jhpalmieri Owned by:
Priority: major Milestone: sage-8.5
Component: documentation Keywords:
Cc: Merged in:
Authors: John Palmieri Reviewers:
Report Upstream: N/A Work issues:
Branch: u/jhpalmieri/no-mathjax (Commits) Commit: ae3812d060e0df45073d17ff928dcc34b8fcc0eb
Dependencies: #26641 Stopgaps:

Description

The problem reported in #26152 has returned, it seems. As a result, users may end up with a symlink SAGE_SHARE/mathjax/mathjax pointing to its parent directory, and this ends up producing a directory SAGE_DOC/html/en/reference/_static/mathjax which contains a subdirectory mathjax which also contains a subdirectory mathjax, etc., hence needlessly using gigabytes of disk space. Let's get rid of these problematic files.

Change History (25)

comment:1 Changed 13 months ago by jhpalmieri

  • Branch set to u/jhpalmieri/no-mathjax

comment:2 Changed 13 months ago by jhpalmieri

  • Commit set to ae3812d060e0df45073d17ff928dcc34b8fcc0eb
  • Status changed from new to needs_review

New commits:

ae3812dtrac 26612: remove bad mathjax symlink and any resulting bad mathjax directories.

comment:3 Changed 13 months ago by jhpalmieri

I still don't know what causes the symlink to be created, but let's delete it when we build the documentation.

comment:4 Changed 13 months ago by jdemeyer

  • Status changed from needs_review to needs_work

I don't like this kind of code. We really should fix the underlying problem instead. Do you have a way to reproduce it?

comment:5 Changed 13 months ago by jhpalmieri

I don't have a way to reproduce it. There are two issues, in my mind: first, yes, we want to fix the underlying issue, but that seems hard since we don't know what the issue is. Second, there may be people out there who are suffering from this problem and don't realize it and so are wasting huge amounts of disk space. Shouldn't we clean up that mess?

comment:6 follow-up: Changed 13 months ago by jhpalmieri

I have one computer on which I can recreate the self-referential symlink by running ./sage -f sagenb. I think the problem comes from this: sagenb is distributed with a full copy of mathjax in its data directory. The installation procedure is supposed to replace this copy with a symlink, and something goes wrong. Why is sagenb distributed with a copy of mathjax in the first place, since mathjax has been a separate Sage package for a while? Now I'm tempted to do this:

  • build/pkgs/sagenb/spkg-install

    diff --git a/build/pkgs/sagenb/spkg-install b/build/pkgs/sagenb/spkg-install
    index 57864ab0d9..639de1d23d 100644
    a b fi 
    1717PYTHON_VERSION=$("$SAGE_LOCAL/bin/$PYTHON" -c 'import sys; print("%d.%d" % sys.version_info[:2])')
    1818cd "${SAGE_DESTDIR}${SAGE_LOCAL}/lib/python$PYTHON_VERSION/site-packages/sagenb/data" || \
    1919    sdh_die "Cannot find SageNB data directory."
     20rm -rf mathjax
    2021ln -s -n "$SAGE_SHARE/mathjax/" mathjax || \
    2122    sdh_die "Error: Cannot symlink mathjax into the SageNB data directory."

along with a command at the start of sagenb's installation to remove the directory sagenb/data/mathjax, if it is not a symlink. Or maybe unconditionally.

Or something along these lines.

Last edited 13 months ago by jhpalmieri (previous) (diff)

comment:7 Changed 13 months ago by jhpalmieri

This doesn't explain things completely, of course: why can I reliably reproduce this on one computer and not another? On the computer where I can reproduce it, I first installed an older version of sagenb, removed the bad symlink, and then did an incremental update to the current develop branch. What remnants from the old build could be causing the symlink to get reproduced each time I do ./sage -f sagenb?

comment:8 in reply to: ↑ 6 ; follow-up: Changed 13 months ago by jdemeyer

Replying to jhpalmieri:

I have one computer on which I can recreate the self-referential symlink

To clarify: which self-referential symlink do you mean? You are talking about sagenb here, but #26152 was about local/share/mathjax/mathjax.

comment:9 Changed 13 months ago by jdemeyer

On the affected machine, can you post the output of

find local -name mathjax | xargs ls -ld
Last edited 13 months ago by jdemeyer (previous) (diff)

comment:10 Changed 13 months ago by jdemeyer

There is certainly something fishy here. On a clean install of sage:

$ find local -name mathjax |xargs ls -ld
drwxr-xr-x 7 jdemeyer jdemeyer 4096 Nov  5 13:22 local/lib/python2.7/site-packages/sagenb/data/mathjax
lrwxrwxrwx 1 jdemeyer jdemeyer   44 Nov  5 13:22 local/lib/python2.7/site-packages/sagenb/data/mathjax/mathjax -> /usr/local/src/sage-git/local/share/mathjax/
lrwxrwxrwx 1 jdemeyer jdemeyer   43 Nov  5 10:19 local/share/jupyter/nbextensions/mathjax -> /usr/local/src/sage-git/local/share/mathjax
drwxr-xr-x 7 jdemeyer jdemeyer 4096 Sep 27 07:21 local/share/mathjax

The local/lib/python2.7/site-packages/sagenb/data/mathjax/mathjax symlink looks wrong to me.

comment:11 Changed 13 months ago by jdemeyer

I'll create a patch based on what you said in 6

comment:12 Changed 13 months ago by jdemeyer

The actual problem is that something went wrong with the latest sagenb packaging: #26641.

comment:13 in reply to: ↑ 8 Changed 13 months ago by jhpalmieri

Replying to jdemeyer:

Replying to jhpalmieri:

I have one computer on which I can recreate the self-referential symlink

To clarify: which self-referential symlink do you mean? You are talking about sagenb here, but #26152 was about local/share/mathjax/mathjax.

I mean the one SAGE_LOCAL/share/mathjax/mathjax that points to SAGE_LOCAL/share/mathjax. Force-installing sagenb on that machine recreates this link.

comment:14 follow-up: Changed 13 months ago by jdemeyer

  • Dependencies set to #26641

Can you run find local -name mathjax | xargs ls -ld on that machine? And then check whether #26641 fixes the issue?

comment:15 Changed 13 months ago by jhpalmieri

$ find local -name mathjax | xargs ls -ld
lrwxr-xr-x   1 jpalmier  staff   64 Oct  3 09:58 local/lib/python2.7/site-packages/sagenb/data/mathjax -> /Users/jpalmier/Desktop/Sage_stuff/git/sage/local/share/mathjax/
lrwxr-xr-x   1 jpalmier  staff   63 Nov  3 11:45 local/share/jupyter/nbextensions/mathjax -> /Users/jpalmier/Desktop/Sage_stuff/git/sage/local/share/mathjax
drwxr-xr-x  14 jpalmier  staff  448 Nov  5 10:12 local/share/mathjax
lrwxr-xr-x   1 jpalmier  staff   64 Nov  5 10:12 local/share/mathjax/mathjax -> /Users/jpalmier/Desktop/Sage_stuff/git/sage/local/share/mathjax/

comment:16 in reply to: ↑ 14 Changed 13 months ago by jhpalmieri

Replying to jdemeyer:

Can you run find local -name mathjax | xargs ls -ld on that machine? And then check whether #26641 fixes the issue?

It fixes the issue in the sense that if I delete the bad symlink, then running ./sage -f sagenb does not recreate it, whereas forcing installation of sagenb-1.1.0 does recreate it. You know the following already: it doesn't fix the issue in the sense that if the bad symlink is present, it is not deleted, and if the docs have been built with the bad symlink, therefore using up way too much disk space, that problem is not cleaned up.

comment:17 follow-up: Changed 13 months ago by embray

  • Milestone changed from sage-8.5 to sage-duplicate/invalid/wontfix
  • Resolution set to duplicate
  • Status changed from needs_work to closed

#26612 looks good, so I think we can close this.

comment:18 in reply to: ↑ 17 Changed 13 months ago by jhpalmieri

Replying to embray:

#26612 looks good, so I think we can close this.

This is #26612, so your comment is as self-referential as the symlink.

There is no fix in place which actually cleans up the bad symlink and the bad docbuild. Is that really acceptable?

comment:19 Changed 13 months ago by jhpalmieri

And should there be a doctest that detects whether the symlink is there, so we know quickly if this problem ever reoccurs?

comment:20 Changed 13 months ago by embray

Sorry, I meant #26641.

comment:21 Changed 13 months ago by jdemeyer

  • Resolution duplicate deleted
  • Status changed from closed to new

I agree with John: #26641 is only a partial fix.

comment:22 Changed 13 months ago by embray

I'm not really sure what else you want to do here. If someone feels like they're being affected by this they can do an rm -rf local/share/doc/sage and re-build.

comment:23 Changed 13 months ago by jhpalmieri

What about the people who are affected but don't realize it?

By the way, they also need to delete local/share/mathjax/mathjax. Should make doc-clean delete this link?

comment:24 Changed 12 months ago by jhpalmieri

  • Milestone changed from sage-duplicate/invalid/wontfix to sage-8.5

comment:25 Changed 12 months ago by vbraun

  • Priority changed from blocker to major
Note: See TracTickets for help on using tickets.