Sage: Ticket #26612: Remove bad mathjax symlink and bad mathjax directories
https://trac.sagemath.org/ticket/26612
<p>
The problem reported in <a class="closed ticket" href="https://trac.sagemath.org/ticket/26152" title="defect: Remove symlink local/share/mathjax/mathjax (closed: fixed)">#26152</a> has returned, it seems. As a result, users may end up with a symlink <code>SAGE_SHARE/mathjax/mathjax</code> pointing to its parent directory, and this ends up producing a directory <code>SAGE_DOC/html/en/reference/_static/mathjax</code> which contains a subdirectory <code>mathjax</code> which also contains a subdirectory <code>mathjax</code>, etc., hence needlessly using gigabytes of disk space. Let's get rid of these problematic files.
</p>
en-usSagehttps://trac.sagemath.org/chrome/site/logo_sagemath_trac.png
https://trac.sagemath.org/ticket/26612
Trac 1.1.6jhpalmieriWed, 31 Oct 2018 18:59:33 GMTbranch set
https://trac.sagemath.org/ticket/26612#comment:1
https://trac.sagemath.org/ticket/26612#comment:1
<ul>
<li><strong>branch</strong>
set to <em>u/jhpalmieri/no-mathjax</em>
</li>
</ul>
TicketjhpalmieriWed, 31 Oct 2018 18:59:43 GMTstatus changed; commit set
https://trac.sagemath.org/ticket/26612#comment:2
https://trac.sagemath.org/ticket/26612#comment:2
<ul>
<li><strong>status</strong>
changed from <em>new</em> to <em>needs_review</em>
</li>
<li><strong>commit</strong>
set to <em>ae3812d060e0df45073d17ff928dcc34b8fcc0eb</em>
</li>
</ul>
<p>
New commits:
</p>
<table class="wiki">
<tr><td><a class="ext-link" href="https://git.sagemath.org/sage.git/commit?id=ae3812d060e0df45073d17ff928dcc34b8fcc0eb"><span class="icon"></span>ae3812d</a></td><td><code>trac 26612: remove bad mathjax symlink and any resulting bad mathjax directories.</code>
</td></tr></table>
TicketjhpalmieriWed, 31 Oct 2018 19:00:32 GMT
https://trac.sagemath.org/ticket/26612#comment:3
https://trac.sagemath.org/ticket/26612#comment:3
<p>
I still don't know what causes the symlink to be created, but let's delete it when we build the documentation.
</p>
TicketjdemeyerFri, 02 Nov 2018 10:55:54 GMTstatus changed
https://trac.sagemath.org/ticket/26612#comment:4
https://trac.sagemath.org/ticket/26612#comment:4
<ul>
<li><strong>status</strong>
changed from <em>needs_review</em> to <em>needs_work</em>
</li>
</ul>
<p>
I don't like this kind of code. We really should fix the underlying problem instead. Do you have a way to reproduce it?
</p>
TicketjhpalmieriFri, 02 Nov 2018 16:18:18 GMT
https://trac.sagemath.org/ticket/26612#comment:5
https://trac.sagemath.org/ticket/26612#comment:5
<p>
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?
</p>
TicketjhpalmieriSun, 04 Nov 2018 05:04:52 GMT
https://trac.sagemath.org/ticket/26612#comment:6
https://trac.sagemath.org/ticket/26612#comment:6
<p>
I have one computer on which I can recreate the self-referential symlink by running <code>./sage -f sagenb</code>. 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:
</p>
<div class="wiki-code"><div xmlns="http://www.w3.org/1999/xhtml" class="diff">
<ul class="entries">
<li class="entry">
<h2>
<a>build/pkgs/sagenb/spkg-install</a>
</h2>
<pre>diff --git a/build/pkgs/sagenb/spkg-install b/build/pkgs/sagenb/spkg-install
index 57864ab0d9..639de1d23d 100644</pre>
<table class="trac-diff inline" summary="Differences" cellspacing="0">
<colgroup><col class="lineno" /><col class="lineno" /><col class="content" /></colgroup>
<thead>
<tr>
<th title="File a/build/pkgs/sagenb/spkg-install">
a
</th>
<th title="File b/build/pkgs/sagenb/spkg-install">
b
</th>
<td><em> fi</em> </td>
</tr>
</thead>
<tbody class="unmod">
<tr>
<th>17</th><th>17</th><td class="l"><span>PYTHON_VERSION=$("$SAGE_LOCAL/bin/$PYTHON" -c 'import sys; print("%d.%d" % sys.version_info[:2])')</span></td>
</tr><tr>
<th>18</th><th>18</th><td class="l"><span>cd "${SAGE_DESTDIR}${SAGE_LOCAL}/lib/python$PYTHON_VERSION/site-packages/sagenb/data" || \</span></td>
</tr><tr>
<th>19</th><th>19</th><td class="l"><span> sdh_die "Cannot find SageNB data directory."</span></td>
</tr>
</tbody><tbody class="add">
<tr class="last first">
<th> </th><th>20</th><td class="r"><ins>rm -rf mathjax</ins></td>
</tr>
</tbody><tbody class="unmod">
<tr>
<th>20</th><th>21</th><td class="l"><span>ln -s -n "$SAGE_SHARE/mathjax/" mathjax || \</span></td>
</tr><tr>
<th>21</th><th>22</th><td class="l"><span> sdh_die "Error: Cannot symlink mathjax into the SageNB data directory."</span></td>
</tr>
</tbody>
</table>
</li>
</ul>
</div></div><p>
along with a command at the start of sagenb's installation to remove the directory <code>sagenb/data/mathjax</code>, if it is not a symlink. Or maybe unconditionally.
</p>
<p>
Or something along these lines.
</p>
TicketjhpalmieriSun, 04 Nov 2018 05:12:10 GMT
https://trac.sagemath.org/ticket/26612#comment:7
https://trac.sagemath.org/ticket/26612#comment:7
<p>
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 <code>develop</code> branch. What remnants from the old build could be causing the symlink to get reproduced each time I do <code>./sage -f sagenb</code>?
</p>
TicketjdemeyerMon, 05 Nov 2018 11:57:00 GMT
https://trac.sagemath.org/ticket/26612#comment:8
https://trac.sagemath.org/ticket/26612#comment:8
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/26612#comment:6" title="Comment 6">jhpalmieri</a>:
</p>
<blockquote class="citation">
<p>
I have one computer on which I can recreate the self-referential symlink
</p>
</blockquote>
<p>
To clarify: which self-referential symlink do you mean? You are talking about sagenb here, but <a class="closed ticket" href="https://trac.sagemath.org/ticket/26152" title="defect: Remove symlink local/share/mathjax/mathjax (closed: fixed)">#26152</a> was about <code>local/share/mathjax/mathjax</code>.
</p>
TicketjdemeyerMon, 05 Nov 2018 11:59:14 GMT
https://trac.sagemath.org/ticket/26612#comment:9
https://trac.sagemath.org/ticket/26612#comment:9
<p>
On the affected machine, can you post the output of
</p>
<pre class="wiki">find local -name mathjax | xargs ls -ld
</pre>
TicketjdemeyerMon, 05 Nov 2018 12:26:04 GMT
https://trac.sagemath.org/ticket/26612#comment:10
https://trac.sagemath.org/ticket/26612#comment:10
<p>
There is certainly something fishy here. On a clean install of sage:
</p>
<pre class="wiki">$ 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
</pre><p>
The <code>local/lib/python2.7/site-packages/sagenb/data/mathjax/mathjax</code> symlink looks wrong to me.
</p>
TicketjdemeyerMon, 05 Nov 2018 12:29:30 GMT
https://trac.sagemath.org/ticket/26612#comment:11
https://trac.sagemath.org/ticket/26612#comment:11
<p>
I'll create a patch based on what you said in <a class="ticket" href="https://trac.sagemath.org/ticket/26612#comment:6" title="Comment 6">6</a>
</p>
TicketjdemeyerMon, 05 Nov 2018 12:51:11 GMT
https://trac.sagemath.org/ticket/26612#comment:12
https://trac.sagemath.org/ticket/26612#comment:12
<p>
The actual problem is that something went wrong with the latest sagenb packaging: <a class="closed ticket" href="https://trac.sagemath.org/ticket/26641" title="defect: Repackage sagenb (closed: fixed)">#26641</a>.
</p>
TicketjhpalmieriMon, 05 Nov 2018 18:13:36 GMT
https://trac.sagemath.org/ticket/26612#comment:13
https://trac.sagemath.org/ticket/26612#comment:13
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/26612#comment:8" title="Comment 8">jdemeyer</a>:
</p>
<blockquote class="citation">
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/26612#comment:6" title="Comment 6">jhpalmieri</a>:
</p>
<blockquote class="citation">
<p>
I have one computer on which I can recreate the self-referential symlink
</p>
</blockquote>
<p>
To clarify: which self-referential symlink do you mean? You are talking about sagenb here, but <a class="closed ticket" href="https://trac.sagemath.org/ticket/26152" title="defect: Remove symlink local/share/mathjax/mathjax (closed: fixed)">#26152</a> was about <code>local/share/mathjax/mathjax</code>.
</p>
</blockquote>
<p>
I mean the one <code>SAGE_LOCAL/share/mathjax/mathjax</code> that points to <code>SAGE_LOCAL/share/mathjax</code>. Force-installing <code>sagenb</code> on that machine recreates this link.
</p>
TicketjdemeyerMon, 05 Nov 2018 18:30:12 GMTdependencies set
https://trac.sagemath.org/ticket/26612#comment:14
https://trac.sagemath.org/ticket/26612#comment:14
<ul>
<li><strong>dependencies</strong>
set to <em>#26641</em>
</li>
</ul>
<p>
Can you run <code>find local -name mathjax | xargs ls -ld</code> on that machine? And then check whether <a class="closed ticket" href="https://trac.sagemath.org/ticket/26641" title="defect: Repackage sagenb (closed: fixed)">#26641</a> fixes the issue?
</p>
TicketjhpalmieriMon, 05 Nov 2018 18:42:50 GMT
https://trac.sagemath.org/ticket/26612#comment:15
https://trac.sagemath.org/ticket/26612#comment:15
<pre class="wiki">$ 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/
</pre>
TicketjhpalmieriMon, 05 Nov 2018 20:53:04 GMT
https://trac.sagemath.org/ticket/26612#comment:16
https://trac.sagemath.org/ticket/26612#comment:16
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/26612#comment:14" title="Comment 14">jdemeyer</a>:
</p>
<blockquote class="citation">
<p>
Can you run <code>find local -name mathjax | xargs ls -ld</code> on that machine? And then check whether <a class="closed ticket" href="https://trac.sagemath.org/ticket/26641" title="defect: Repackage sagenb (closed: fixed)">#26641</a> fixes the issue?
</p>
</blockquote>
<p>
It fixes the issue in the sense that if I delete the bad symlink, then running <code>./sage -f sagenb</code> 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.
</p>
TicketembrayThu, 08 Nov 2018 15:40:29 GMTstatus, milestone changed; resolution set
https://trac.sagemath.org/ticket/26612#comment:17
https://trac.sagemath.org/ticket/26612#comment:17
<ul>
<li><strong>status</strong>
changed from <em>needs_work</em> to <em>closed</em>
</li>
<li><strong>resolution</strong>
set to <em>duplicate</em>
</li>
<li><strong>milestone</strong>
changed from <em>sage-8.5</em> to <em>sage-duplicate/invalid/wontfix</em>
</li>
</ul>
<p>
<a class="new ticket" href="https://trac.sagemath.org/ticket/26612" title="defect: Remove bad mathjax symlink and bad mathjax directories (new)">#26612</a> looks good, so I think we can close this.
</p>
TicketjhpalmieriThu, 08 Nov 2018 16:15:10 GMT
https://trac.sagemath.org/ticket/26612#comment:18
https://trac.sagemath.org/ticket/26612#comment:18
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/26612#comment:17" title="Comment 17">embray</a>:
</p>
<blockquote class="citation">
<p>
<a class="new ticket" href="https://trac.sagemath.org/ticket/26612" title="defect: Remove bad mathjax symlink and bad mathjax directories (new)">#26612</a> looks good, so I think we can close this.
</p>
</blockquote>
<p>
<em>This</em> is <a class="new ticket" href="https://trac.sagemath.org/ticket/26612" title="defect: Remove bad mathjax symlink and bad mathjax directories (new)">#26612</a>, so your comment is as self-referential as the symlink.
</p>
<p>
There is no fix in place which actually cleans up the bad symlink and the bad docbuild. Is that really acceptable?
</p>
TicketjhpalmieriThu, 08 Nov 2018 16:16:47 GMT
https://trac.sagemath.org/ticket/26612#comment:19
https://trac.sagemath.org/ticket/26612#comment:19
<p>
And should there be a doctest that detects whether the symlink is there, so we know quickly if this problem ever reoccurs?
</p>
TicketembrayThu, 08 Nov 2018 16:44:36 GMT
https://trac.sagemath.org/ticket/26612#comment:20
https://trac.sagemath.org/ticket/26612#comment:20
<p>
Sorry, I meant <a class="closed ticket" href="https://trac.sagemath.org/ticket/26641" title="defect: Repackage sagenb (closed: fixed)">#26641</a>.
</p>
TicketjdemeyerFri, 09 Nov 2018 06:24:01 GMTstatus changed; resolution deleted
https://trac.sagemath.org/ticket/26612#comment:21
https://trac.sagemath.org/ticket/26612#comment:21
<ul>
<li><strong>status</strong>
changed from <em>closed</em> to <em>new</em>
</li>
<li><strong>resolution</strong>
<em>duplicate</em> deleted
</li>
</ul>
<p>
I agree with John: <a class="closed ticket" href="https://trac.sagemath.org/ticket/26641" title="defect: Repackage sagenb (closed: fixed)">#26641</a> is only a partial fix.
</p>
TicketembrayFri, 09 Nov 2018 13:04:18 GMT
https://trac.sagemath.org/ticket/26612#comment:22
https://trac.sagemath.org/ticket/26612#comment:22
<p>
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 <code>rm -rf local/share/doc/sage</code> and re-build.
</p>
TicketjhpalmieriFri, 09 Nov 2018 15:46:05 GMT
https://trac.sagemath.org/ticket/26612#comment:23
https://trac.sagemath.org/ticket/26612#comment:23
<p>
What about the people who are affected but don't realize it?
</p>
<p>
By the way, they also need to delete <code>local/share/mathjax/mathjax</code>. Should <code>make doc-clean</code> delete this link?
</p>
TicketjhpalmieriWed, 12 Dec 2018 03:09:22 GMTmilestone changed
https://trac.sagemath.org/ticket/26612#comment:24
https://trac.sagemath.org/ticket/26612#comment:24
<ul>
<li><strong>milestone</strong>
changed from <em>sage-duplicate/invalid/wontfix</em> to <em>sage-8.5</em>
</li>
</ul>
TicketvbraunWed, 12 Dec 2018 14:26:57 GMTpriority changed
https://trac.sagemath.org/ticket/26612#comment:25
https://trac.sagemath.org/ticket/26612#comment:25
<ul>
<li><strong>priority</strong>
changed from <em>blocker</em> to <em>major</em>
</li>
</ul>
Ticket