[Pkg-javascript-devel] Bug#1010457: ftbfs: test failure will prevent nodejs 16 migration

Jérémy Lal kapouer at melix.org
Sun May 1 23:10:50 BST 2022


Package: node-browserify-zlib
Version: 0.2.0+20170820git8b3f0a862f6b+dfsg-7
Severity: important
Tags: ftbfs

This module is old and uses internal nodejs api.
Also it still assumes old streams model:
it is a miracle it has not many more tests failures.

I attached a NON-working patch, to help anyone willing to give it a shot.


This is the failure:

AssertionError [ERR_ASSERTION]: after calling flush, writable stream should not need to drain
    at process.<anonymous> (/<<PKGBUILDDIR>>/test/test-zlib-flush-drain.js:41:10)
    at Object.onceWrapper (node:events:646:26)
    at process.emit (node:events:526:28) {
  generatedMessage: false,
  code: 'ERR_ASSERTION',
  actual: true,
  expected: false,
  operator: '=='
}
test/test-zlib-flush-drain.js




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

Kernel: Linux 5.17.0-1-amd64 (SMP w/4 CPU threads; PREEMPT)
Kernel taint flags: TAINT_WARN
Locale: LANG=fr_FR.utf8, LC_CTYPE=fr_FR.utf8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages node-browserify-zlib depends on:
ii  node-pako  2.0.4+ds-1

node-browserify-zlib recommends no packages.

node-browserify-zlib suggests no packages.

-- no debconf information
-------------- next part --------------
--- a/src/index.js
+++ b/src/index.js
@@ -443,20 +443,19 @@
 };
 
 Zlib.prototype.flush = function(kind, callback) {
-  var ws = this._writableState;
 
   if (typeof kind === 'function' || (kind === undefined && !callback)) {
     callback = kind;
     kind = binding.Z_FULL_FLUSH;
   }
 
-  if (ws.ended) {
+  if (this.writableEnded) {
     if (callback)
       process.nextTick(callback);
-  } else if (ws.ending) {
+  } else if (this.writableFinished) {
     if (callback)
       this.once('end', callback);
-  } else if (ws.needDrain) {
+  } else if (this.writableNeedDrain) {
     if (callback) {
       this.once('drain', () => this.flush(kind, callback));
     }
@@ -489,9 +488,8 @@
 
 Zlib.prototype._transform = function(chunk, encoding, cb) {
   var flushFlag;
-  var ws = this._writableState;
-  var ending = ws.ending || ws.ended;
-  var last = ending && (!chunk || ws.length === chunk.length);
+  var ending = this.writableEnded;
+  var last = ending && (!chunk || this.writableLength === chunk.length);
 
   if (chunk !== null && !Buffer.isBuffer(chunk))
     return cb(new Error('invalid input'));
@@ -510,7 +508,7 @@
     flushFlag = this._flushFlag;
     // once we've flushed the last of the queue, stop flushing and
     // go back to the normal behavior.
-    if (chunk.length >= ws.length) {
+    if (chunk.length >= this.writableLength) {
       this._flushFlag = this._opts.flush || binding.Z_NO_FLUSH;
     }
   }
--- a/test/test-zlib-flush-drain.js
+++ b/test/test-zlib-flush-drain.js
@@ -3,7 +3,7 @@
 const assert = require('assert');
 const zlib = require('../');
 
-const bigData = Buffer.alloc(10240, 'x');
+const bigData = Buffer.alloc(100240, 'x');
 
 const opts = {
   level: 0,
@@ -24,12 +24,11 @@
 
 deflater.write(bigData);
 
-const ws = deflater._writableState;
-const beforeFlush = ws.needDrain;
-var afterFlush = ws.needDrain;
+const beforeFlush = deflater.writableNeedDrain;
+var afterFlush = deflater.writableNeedDrain;
 
 deflater.flush(function(err) {
-  afterFlush = ws.needDrain;
+  afterFlush = deflater.writableNeedDrain;
 });
 
 deflater.on('drain', function() {


More information about the Pkg-javascript-devel mailing list