#745688 libjs-d3: SyntaxError - non-ASCII variable names

Package:
libjs-d3
Source:
d3
Submitter:
Ramakrishnan Muthukrishnan
Date:
2017-09-29 07:21:04 UTC
Severity:
minor
#745688#5
Date:
2014-04-24 02:14:20 UTC
From:
To:
Hi,

I noticed that the d3.js generated by the Debian package is very
different from the d3.js shipped with the upstream tarball. I don't
know at this point, if any functionality is affected. But a simple
diff a lot of changes.

One of the reason for this could be that the d3 upstream package
requires uglify version 2.4.0 where as the d3 debian package is
using the one shipped with Debian, which is 1.3.4. I have raised
a wishlist bug against the node-uglify package (#745687) requesting
an upgrade of the uglify package. I don't know at this point if
this will fix the problem. I built the d3 upstream sources without
using the Debian shipped libraries (but using the nodejs and npm
shipped with Debian unstable) and it produced exactly same d3.js
as the one in d3 upstream tarball. Just fyi.

Thanks
Ramakrishnan


- -- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.13-1-amd64 (SMP w/1 CPU core)
Locale: LANG=en_IN.UTF-8, LC_CTYPE=en_IN.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

- -- no debconf information
iQIcBAEBCAAGBQJTWHN3AAoJEM9kzWHrRsqa+zEP/3vUYjSOzEbMUOpwJJYNR4Ak
Pq+BfNc6hai8pq8LQnmOqMPBMWaGbXiyIsseBvctrw/JocsjXZY96hsYXwOD/BjN
QLwb/jLy6xCJGG+SKIv0PHZ4f4szJb7YBF1Jx8oQ2m/ymeHJYroJ0F4DAs2yjhY2
1TCKPuju4DrCxSnNtQHvsFrbKT7hGp6+wvpqpT0tewcjWx66he30au8iK79dMfXr
2ZquEWFNQjpqeqP19TWBS/4m6oC9Yt17hZdqqUoKeTJe9yAoY9RBe4w0fkXUoXJY
2BoQQDRdzru93buv99CVpcexKk6ud34JKEivuDIiZKwCZ1UW7SUGRhBL/g8zwGuM
Xw+Q6My0DMaOJOFyxou3A5rKxnYO8noJ7FZNSibhuJbLe7oRiO7FBHddszO7nb/R
nzp276vKpoGiCeZP88AVH/siWxIIQxqjE+lMHOtcS0PhpIzue6vjom5uVlX6G7hX
WaP1TtozYJDi5YAKBW3XNDglvIsd1dgu+kBOfzwJYqQoGMUtMKqzjyQNyo4zhQ+c
ToKjua0m2Ojy8FodC93FQMqo22Ne03quhElIpXWEZy+Y8cQN1p04KbR4TeUV8Se9
d9twHUm4M1TYltQC4/rZiofOoOs6wQmu09uudow0DN0VXJpoewuuHTqvfhoFCO/e
ca9oSc+NS7d9P23iwUy5
=HW7O
-----END PGP SIGNATURE-----

#745688#10
Date:
2014-04-27 09:06:08 UTC
From:
To:
Hi Ramakrishnan,
 I've several complex examples locally. Those works normally.
 Yes, this is the reason. UglifyJS does several alternations, not
affecting the code itself. As such, the UglifyJS build dependency is
not a hard one.
 That would 'fix' it, ie it would look like the same to the one from upstream.
But please note that UglifyJS 1.x [1] and 2.y [2] are different
projects, developed differently and not an upgrade.
I'd like to see UglifyJS2 2.y packaged as well, but it seems the
JavaScript team is lacking manpower.

Regards,
Laszlo/GCS
[1] https://github.com/mishoo/UglifyJS
[2] https://github.com/mishoo/UglifyJS2

#745688#15
Date:
2014-05-03 01:17:03 UTC
From:
To:
Hi László,

Sorry for the late response.

I just noticed that Jonas created a package for Uglify2 and uploaded[1]
it.

Thanks. I understand. I hope this upload will help you change the
packaging to use the uglify2. I would love to join the debian js team
and contribute. I just lack time at this point. But I surely hope to
come back and help out. A big thanks for all the work you and other
Debian JS hackers are doing to get things going.

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=745687

#745688#20
Date:
2016-12-08 08:28:50 UTC
From:
To:
If I understand correctly, this bts report is about the observation that
the debian package is using a different javascript minimiser than upstream,
making the reporter worry if the library work as it should in Debian.

As far as I can tell from the rest of the discussion, the worry is unfounded,
and the library work as it should.  Because of this I change the title to reflect
what I believe is the key request and lower the severity to wishlist, which seem
more appropriate as it only affect the ability to compare the library to the
upstream version, and not the functionallity of the library.

#745688#29
Date:
2017-09-29 07:02:13 UTC
From:
To:
This actually does have practical consequences: because d3's source
contains Greek-alphabet variable names (e.g. in
http://sources.debian.net/src/d3/3.5.17-2/src/math/trigonometry.js) and
the Debian-minified version keeps these, using it in a document that
doesn't declare a character encoding is a SyntaxError.

e.g. after replacing theano's embedded copy of d3 with a symlink to the
Debian package, d3viz diagrams fail to appear, and and checking the
developer console finds this:

SyntaxError: illegal character  d3.v3.min.js:1:31212
ReferenceError: d3 is not defined[Learn More]  d3-context-menu.js:1:1
ReferenceError: d3 is not defined[Learn More]  mlp.html:50:3
The character encoding of the HTML document was not declared. The
document will render with garbled text in some browser configurations if
the document contains characters from outside the US-ASCII range. The
character encoding of the page must be declared in the document or in
the transfer protocol.

Using uglifyjs -m -c (i.e. also minify variable names) fixes this
problem; I haven't tried upstream's script
(http://sources.debian.net/src/d3/3.5.17-2/bin/uglify/ ) but it looks
like it also would.