[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#864743: unblock: nodejs/4.8.3~dfsg-1



Package: release.debian.org
Severity: normal
User: release.debian.org@packages.debian.org
Usertags: unblock

Please unblock package nodejs

- it's a LTS upstream update from 4.8.2 to 4.8.3
- it fixes #855018, #855018 to avoid test failures
- it fixes #864735  with a Priority: optional on source package
- it restores how upstream finds global nodejs modules:
  /usr/lib/nodejs (as before) when executable is in /usr/bin/nodejs
  /usr/local/lib/nodejs (not as before) when executable is in
  /usr/local/bin/nodejs.
  It was a bad idea to disable this in the first place.

I've excluded upstream changes concerning:
- tests and their fixtures
- html documentation
- markdown documentation, changelog, readme, ...

unblock nodejs/4.8.3~dfsg-1

-- System Information:
Debian Release: 9.0
  APT prefers testing
  APT policy: (1001, 'testing'), (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 4.9.0-3-amd64 (SMP w/4 CPU cores)
Locale: LANG=fr_FR.utf8, LC_CTYPE=fr_FR.utf8 (charmap=UTF-8), LANGUAGE=fr_FR.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
diff -Nru --exclude 'test*' --exclude '*.md' --exclude '*.html' nodejs-4.8.2~dfsg/debian/changelog nodejs-4.8.3~dfsg/debian/changelog
--- nodejs-4.8.2~dfsg/debian/changelog	2017-04-04 15:46:55.000000000 +0200
+++ nodejs-4.8.3~dfsg/debian/changelog	2017-06-14 00:23:33.000000000 +0200
@@ -1,3 +1,15 @@
+nodejs (4.8.3~dfsg-1) unstable; urgency=medium
+
+  * New upstream version 4.8.3~dfsg
+  * Let nodejs global modules be searched in ${prefixDir}/lib/nodejs
+    as it was intended by upstream. This does not change behavior
+    of system-installed nodejs.
+  * Add ca-certificates to autopkgtest depends. (Closes: #855018)
+  * Update test_ci_buildd.patch to skip test-process-config (Closes: #855018)
+  * Priority: optional on source package (Closes: #864735)
+
+ -- Jérémy Lal <kapouer@melix.org>  Wed, 14 Jun 2017 00:23:33 +0200
+
 nodejs (4.8.2~dfsg-1) unstable; urgency=medium
 
   * New upstream version 4.8.2~dfsg
diff -Nru --exclude 'test*' --exclude '*.md' --exclude '*.html' nodejs-4.8.2~dfsg/debian/control.in nodejs-4.8.3~dfsg/debian/control.in
--- nodejs-4.8.2~dfsg/debian/control.in	2017-04-03 00:07:03.000000000 +0200
+++ nodejs-4.8.3~dfsg/debian/control.in	2017-06-13 23:01:01.000000000 +0200
@@ -1,5 +1,6 @@
 Source: nodejs
 Section: web
+Priority: optional
 Maintainer: Debian Javascript Maintainers <pkg-javascript-devel@lists.alioth.debian.org>
 Uploaders: Jérémy Lal <kapouer@melix.org>,
  Jonas Smedegaard <dr@jones.dk>
diff -Nru --exclude 'test*' --exclude '*.md' --exclude '*.html' nodejs-4.8.2~dfsg/debian/patches/2001_FHS_and_rename_to_nodejs.patch nodejs-4.8.3~dfsg/debian/patches/2001_FHS_and_rename_to_nodejs.patch
--- nodejs-4.8.2~dfsg/debian/patches/2001_FHS_and_rename_to_nodejs.patch	2017-04-04 15:41:17.000000000 +0200
+++ nodejs-4.8.3~dfsg/debian/patches/2001_FHS_and_rename_to_nodejs.patch	2017-06-13 23:00:41.000000000 +0200
@@ -1,17 +1,18 @@
 Description: FHS path for nodejs, rename man page to nodejs.
  Use /usr/lib/nodejs for packaged modules.
+ Fix test.
  
 Forwarded: not-needed
 Author: Jérémy Lal <kapouer@melix.org>
-Last-Update: 2013-03-16
+Last-Update: 2017-05-03
 --- a/lib/module.js
 +++ b/lib/module.js
-@@ -453,7 +453,7 @@
-     homeDir = process.env.HOME;
+@@ -462,7 +462,7 @@
+   } else {
+     prefixDir = path.resolve(process.execPath, '..', '..');
    }
- 
--  var paths = [path.resolve(process.execPath, '..', '..', 'lib', 'node')];
-+  var paths = ['/usr/lib/nodejs'];
+-  var paths = [path.resolve(prefixDir, 'lib', 'node')];
++  var paths = [path.resolve(prefixDir, 'lib', 'nodejs')];
  
    if (homeDir) {
      paths.unshift(path.resolve(homeDir, '.node_libraries'));
@@ -49,3 +50,22 @@
  .RB [ \-\-v8-options ]
  
  Execute without arguments to start the REPL.
+--- a/test/parallel/test-module-loading-globalpaths.js
++++ b/test/parallel/test-module-loading-globalpaths.js
+@@ -68,12 +68,12 @@
+   env['HOME'] = env['USERPROFILE'] = bothHomeDir;
+   runTest('$HOME/.node_modules', env);
+ 
+-  // Test module in $PREFIX/lib/node.
+-  // Write module into $PREFIX/lib/node.
+-  const expectedString = '$PREFIX/lib/node';
++  // Test module in $PREFIX/lib/nodejs.
++  // Write module into $PREFIX/lib/nodejs.
++  const expectedString = '$PREFIX/lib/nodejs';
+   const prefixLibPath = path.join(prefixPath, 'lib');
+   fs.mkdirSync(prefixLibPath);
+-  const prefixLibNodePath = path.join(prefixLibPath, 'node');
++  const prefixLibNodePath = path.join(prefixLibPath, 'nodejs');
+   fs.mkdirSync(prefixLibNodePath);
+   const pkgPath = path.join(prefixLibNodePath, pkgName + '.js');
+   fs.writeFileSync(pkgPath, 'exports.string = \'' + expectedString + '\';');
diff -Nru --exclude 'test*' --exclude '*.md' --exclude '*.html' nodejs-4.8.2~dfsg/debian/patches/2012_kfreebsd.patch nodejs-4.8.3~dfsg/debian/patches/2012_kfreebsd.patch
--- nodejs-4.8.2~dfsg/debian/patches/2012_kfreebsd.patch	2017-04-04 15:41:17.000000000 +0200
+++ nodejs-4.8.3~dfsg/debian/patches/2012_kfreebsd.patch	2017-06-13 23:00:41.000000000 +0200
@@ -92,7 +92,7 @@
  #endif
 --- a/src/node.cc
 +++ b/src/node.cc
-@@ -3220,7 +3220,7 @@
+@@ -3221,7 +3221,7 @@
  
  static void SignalExit(int signo) {
    uv_tty_reset_mode();
diff -Nru --exclude 'test*' --exclude '*.md' --exclude '*.html' nodejs-4.8.2~dfsg/debian/patches/2014_donotinclude_root_certs.patch nodejs-4.8.3~dfsg/debian/patches/2014_donotinclude_root_certs.patch
--- nodejs-4.8.2~dfsg/debian/patches/2014_donotinclude_root_certs.patch	2017-04-04 15:41:17.000000000 +0200
+++ nodejs-4.8.3~dfsg/debian/patches/2014_donotinclude_root_certs.patch	2017-06-13 23:00:41.000000000 +0200
@@ -38,7 +38,7 @@
    X509_STORE* store = X509_STORE_new();
 --- a/src/node.cc
 +++ b/src/node.cc
-@@ -4400,8 +4400,7 @@
+@@ -4414,8 +4414,7 @@
    Init(&argc, const_cast<const char**>(argv), &exec_argc, &exec_argv);
  
  #if HAVE_OPENSSL
diff -Nru --exclude 'test*' --exclude '*.md' --exclude '*.html' nodejs-4.8.2~dfsg/debian/rules nodejs-4.8.3~dfsg/debian/rules
--- nodejs-4.8.2~dfsg/debian/rules	2017-04-04 15:41:17.000000000 +0200
+++ nodejs-4.8.3~dfsg/debian/rules	2017-06-13 23:05:47.000000000 +0200
@@ -157,6 +157,7 @@
 	rm -f config.mk
 	rm -f test/fixtures/hello.txt
 	rm -rf test/tmp*
+	rm -f node_modules
 	find . -name "*.pyc" -delete
 	rm -rf out
 
@@ -172,6 +173,7 @@
 
 pre-build::
 	mkdir -p $(HOME)
+	ln -sTf /usr/lib/nodejs node_modules
 
 ifeq ($(filter stage1,$(DEB_BUILD_PROFILES)),)
 build/nodejs::
diff -Nru --exclude 'test*' --exclude '*.md' --exclude '*.html' nodejs-4.8.2~dfsg/deps/v8/include/v8-version.h nodejs-4.8.3~dfsg/deps/v8/include/v8-version.h
--- nodejs-4.8.2~dfsg/deps/v8/include/v8-version.h	2017-04-04 14:13:14.000000000 +0200
+++ nodejs-4.8.3~dfsg/deps/v8/include/v8-version.h	2017-05-02 19:07:20.000000000 +0200
@@ -11,7 +11,7 @@
 #define V8_MAJOR_VERSION 4
 #define V8_MINOR_VERSION 5
 #define V8_BUILD_NUMBER 103
-#define V8_PATCH_LEVEL 46
+#define V8_PATCH_LEVEL 47
 
 // Use 1 for candidates and 0 otherwise.
 // (Boolean macro values are not supported by all preprocessors.)
diff -Nru --exclude 'test*' --exclude '*.md' --exclude '*.html' nodejs-4.8.2~dfsg/deps/v8/src/api.cc nodejs-4.8.3~dfsg/deps/v8/src/api.cc
--- nodejs-4.8.2~dfsg/deps/v8/src/api.cc	2017-04-04 14:13:14.000000000 +0200
+++ nodejs-4.8.3~dfsg/deps/v8/src/api.cc	2017-05-02 19:07:20.000000000 +0200
@@ -6580,7 +6580,11 @@
   ENTER_V8(i_isolate);
   i::Handle<i::JSArrayBuffer> obj =
       i_isolate->factory()->NewJSArrayBuffer(i::SharedFlag::kNotShared);
-  i::Runtime::SetupArrayBufferAllocatingData(i_isolate, obj, byte_length);
+  // TODO(jbroman): It may be useful in the future to provide a MaybeLocal
+  // version that throws an exception or otherwise does not crash.
+  if (!i::Runtime::SetupArrayBufferAllocatingData(i_isolate, obj, byte_length)) {
+    i::FatalProcessOutOfMemory("v8::ArrayBuffer::New");
+  }
   return Utils::ToLocal(obj);
 }
 
@@ -6775,8 +6779,12 @@
   ENTER_V8(i_isolate);
   i::Handle<i::JSArrayBuffer> obj =
       i_isolate->factory()->NewJSArrayBuffer(i::SharedFlag::kShared);
-  i::Runtime::SetupArrayBufferAllocatingData(i_isolate, obj, byte_length, true,
-                                             i::SharedFlag::kShared);
+  // TODO(jborman): It may be useful in the future to provide a MaybeLocal
+  // version that throws an exception or otherwise does not crash.
+  if (!i::Runtime::SetupArrayBufferAllocatingData(i_isolate, obj, byte_length, true,
+                                             i::SharedFlag::kShared)) {
+    i::FatalProcessOutOfMemory("v8::SharedArrayBuffer::New");
+  }
   return Utils::ToLocalShared(obj);
 }
 
diff -Nru --exclude 'test*' --exclude '*.md' --exclude '*.html' nodejs-4.8.2~dfsg/lib/module.js nodejs-4.8.3~dfsg/lib/module.js
--- nodejs-4.8.2~dfsg/lib/module.js	2017-04-04 14:13:18.000000000 +0200
+++ nodejs-4.8.3~dfsg/lib/module.js	2017-05-02 19:07:32.000000000 +0200
@@ -453,7 +453,16 @@
     homeDir = process.env.HOME;
   }
 
-  var paths = [path.resolve(process.execPath, '..', '..', 'lib', 'node')];
+  // $PREFIX/lib/node, where $PREFIX is the root of the Node.js installation.
+  var prefixDir;
+  // process.execPath is $PREFIX/bin/node except on Windows where it is
+  // $PREFIX\node.exe.
+  if (isWindows) {
+    prefixDir = path.resolve(process.execPath, '..');
+  } else {
+    prefixDir = path.resolve(process.execPath, '..', '..');
+  }
+  var paths = [path.resolve(prefixDir, 'lib', 'node')];
 
   if (homeDir) {
     paths.unshift(path.resolve(homeDir, '.node_libraries'));
diff -Nru --exclude 'test*' --exclude '*.md' --exclude '*.html' nodejs-4.8.2~dfsg/lib/_tls_wrap.js nodejs-4.8.3~dfsg/lib/_tls_wrap.js
--- nodejs-4.8.2~dfsg/lib/_tls_wrap.js	2017-04-04 14:13:18.000000000 +0200
+++ nodejs-4.8.3~dfsg/lib/_tls_wrap.js	2017-05-02 19:07:32.000000000 +0200
@@ -463,7 +463,9 @@
 
     // Destroy socket if error happened before handshake's finish
     if (!self._secureEstablished) {
-      self.destroy(self._tlsError(err));
+      // When handshake fails control is not yet released,
+      // so self._tlsError will return null instead of actual error
+      self.destroy(err);
     } else if (options.isServer &&
                rejectUnauthorized &&
                /peer did not return a certificate/.test(err.message)) {
diff -Nru --exclude 'test*' --exclude '*.md' --exclude '*.html' nodejs-4.8.2~dfsg/src/node.cc nodejs-4.8.3~dfsg/src/node.cc
--- nodejs-4.8.2~dfsg/src/node.cc	2017-04-04 14:13:18.000000000 +0200
+++ nodejs-4.8.3~dfsg/src/node.cc	2017-05-02 19:07:33.000000000 +0200
@@ -51,6 +51,7 @@
 #endif
 
 #include <errno.h>
+#include <fcntl.h>  // _O_RDWR
 #include <limits.h>  // PATH_MAX
 #include <locale.h>
 #include <signal.h>
@@ -3995,6 +3996,19 @@
     } while (min + 1 < max);
   }
 #endif  // __POSIX__
+#ifdef _WIN32
+  for (int fd = 0; fd <= 2; ++fd) {
+    auto handle = reinterpret_cast<HANDLE>(_get_osfhandle(fd));
+    if (handle == INVALID_HANDLE_VALUE ||
+        GetFileType(handle) == FILE_TYPE_UNKNOWN) {
+      // Ignore _close result. If it fails or not depends on used Windows
+      // version. We will just check _open result.
+      _close(fd);
+      if (fd != _open("nul", _O_RDWR))
+        ABORT();
+    }
+  }
+#endif  // _WIN32
 }
 
 
diff -Nru --exclude 'test*' --exclude '*.md' --exclude '*.html' nodejs-4.8.2~dfsg/src/node_version.h nodejs-4.8.3~dfsg/src/node_version.h
--- nodejs-4.8.2~dfsg/src/node_version.h	2017-04-04 14:13:18.000000000 +0200
+++ nodejs-4.8.3~dfsg/src/node_version.h	2017-05-02 19:07:33.000000000 +0200
@@ -3,7 +3,7 @@
 
 #define NODE_MAJOR_VERSION 4
 #define NODE_MINOR_VERSION 8
-#define NODE_PATCH_VERSION 2
+#define NODE_PATCH_VERSION 3
 
 #define NODE_VERSION_IS_LTS 1
 #define NODE_VERSION_LTS_CODENAME "Argon"
diff -Nru --exclude 'test*' --exclude '*.md' --exclude '*.html' nodejs-4.8.2~dfsg/src/stream_base.h nodejs-4.8.3~dfsg/src/stream_base.h
--- nodejs-4.8.2~dfsg/src/stream_base.h	2017-04-04 14:13:18.000000000 +0200
+++ nodejs-4.8.3~dfsg/src/stream_base.h	2017-05-02 19:07:33.000000000 +0200
@@ -135,10 +135,14 @@
                          const uv_buf_t* buf,
                          uv_handle_type pending,
                          void* ctx);
+  typedef void (*DestructCb)(void* ctx);
 
   StreamResource() : bytes_read_(0) {
   }
-  virtual ~StreamResource() = default;
+  virtual ~StreamResource() {
+    if (!destruct_cb_.is_empty())
+      destruct_cb_.fn(destruct_cb_.ctx);
+  }
 
   virtual int DoShutdown(ShutdownWrap* req_wrap) = 0;
   virtual int DoTryWrite(uv_buf_t** bufs, size_t* count);
@@ -175,15 +179,18 @@
 
   inline void set_alloc_cb(Callback<AllocCb> c) { alloc_cb_ = c; }
   inline void set_read_cb(Callback<ReadCb> c) { read_cb_ = c; }
+  inline void set_destruct_cb(Callback<DestructCb> c) { destruct_cb_ = c; }
 
   inline Callback<AfterWriteCb> after_write_cb() { return after_write_cb_; }
   inline Callback<AllocCb> alloc_cb() { return alloc_cb_; }
   inline Callback<ReadCb> read_cb() { return read_cb_; }
+  inline Callback<DestructCb> destruct_cb() { return destruct_cb_; }
 
  private:
   Callback<AfterWriteCb> after_write_cb_;
   Callback<AllocCb> alloc_cb_;
   Callback<ReadCb> read_cb_;
+  Callback<DestructCb> destruct_cb_;
   uint64_t bytes_read_;
 
   friend class StreamBase;
diff -Nru --exclude 'test*' --exclude '*.md' --exclude '*.html' nodejs-4.8.2~dfsg/src/string_bytes.cc nodejs-4.8.3~dfsg/src/string_bytes.cc
--- nodejs-4.8.2~dfsg/src/string_bytes.cc	2017-04-04 14:13:18.000000000 +0200
+++ nodejs-4.8.3~dfsg/src/string_bytes.cc	2017-05-02 19:07:33.000000000 +0200
@@ -174,13 +174,13 @@
   size_t k = 0;
   for (;;) {
 #define V(expr)                                                               \
-    while (i < srclen) {                                                      \
+    for (;;) {                                                                \
       const uint8_t c = src[i];                                               \
       lo = unbase64(c);                                                       \
       i += 1;                                                                 \
       if (lo < 64)                                                            \
         break;  /* Legal character. */                                        \
-      if (c == '=')                                                           \
+      if (c == '=' || i >= srclen)                                            \
         return k;                                                             \
     }                                                                         \
     expr;                                                                     \
diff -Nru --exclude 'test*' --exclude '*.md' --exclude '*.html' nodejs-4.8.2~dfsg/src/tls_wrap.cc nodejs-4.8.3~dfsg/src/tls_wrap.cc
--- nodejs-4.8.2~dfsg/src/tls_wrap.cc	2017-04-04 14:13:18.000000000 +0200
+++ nodejs-4.8.3~dfsg/src/tls_wrap.cc	2017-05-02 19:07:33.000000000 +0200
@@ -66,6 +66,7 @@
   stream_->set_after_write_cb({ OnAfterWriteImpl, this });
   stream_->set_alloc_cb({ OnAllocImpl, this });
   stream_->set_read_cb({ OnReadImpl, this });
+  stream_->set_destruct_cb({ OnDestructImpl, this });
 
   set_alloc_cb({ OnAllocSelf, this });
   set_read_cb({ OnReadSelf, this });
@@ -426,6 +427,12 @@
       memcpy(buf.base, current, avail);
       OnRead(avail, &buf);
 
+      // Caveat emptor: OnRead() calls into JS land which can result in
+      // the SSL context object being destroyed.  We have to carefully
+      // check that ssl_ != nullptr afterwards.
+      if (ssl_ == nullptr)
+        return;
+
       read -= avail;
       current += avail;
     }
@@ -523,7 +530,7 @@
 
 
 bool TLSWrap::IsAlive() {
-  return ssl_ != nullptr && stream_->IsAlive();
+  return ssl_ != nullptr && stream_ != nullptr && stream_->IsAlive();
 }
 
 
@@ -661,6 +668,12 @@
 }
 
 
+void TLSWrap::OnDestructImpl(void* ctx) {
+  TLSWrap* wrap = static_cast<TLSWrap*>(ctx);
+  wrap->clear_stream();
+}
+
+
 void TLSWrap::OnAllocSelf(size_t suggested_size, uv_buf_t* buf, void* ctx) {
   buf->base = static_cast<char*>(node::Malloc(suggested_size));
   CHECK_NE(buf->base, nullptr);
diff -Nru --exclude 'test*' --exclude '*.md' --exclude '*.html' nodejs-4.8.2~dfsg/src/tls_wrap.h nodejs-4.8.3~dfsg/src/tls_wrap.h
--- nodejs-4.8.2~dfsg/src/tls_wrap.h	2017-04-04 14:13:18.000000000 +0200
+++ nodejs-4.8.3~dfsg/src/tls_wrap.h	2017-05-02 19:07:33.000000000 +0200
@@ -52,6 +52,8 @@
 
   size_t self_size() const override { return sizeof(*this); }
 
+  void clear_stream() { stream_ = nullptr; }
+
  protected:
   static const int kClearOutChunkSize = 16384;
 
@@ -119,6 +121,7 @@
                          const uv_buf_t* buf,
                          uv_handle_type pending,
                          void* ctx);
+  static void OnDestructImpl(void* ctx);
 
   void DoRead(ssize_t nread, const uv_buf_t* buf, uv_handle_type pending);
 

Reply to: