Commit dd425b79bfd for nodejs
commit dd425b79bfd39e2f6f0d17cbc68aeeea8e6d9e00
Author: Ravi Arnan Irianto <raviarnankeren@gmail.com>
Date: Wed Nov 18 21:18:53 2026 +0800
test: fix zipinfo non-ascii check in test-zlib-zip-interop
Keep UNICODE_SUPPORT guard so macOS skips checking non-ASCII names
in zipinfo output, and accept '?' / U+FFFD placeholders on builds
with UNICODE_SUPPORT that filter non-ASCII bytes in fnfilter()
without wide-character printing support (such as NixOS or Gentoo).
Fixes: https://github.com/nodejs/node/issues/66975
Signed-off-by: Ravi Arnan <raviarnankeren@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/66978
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: LiviaMedeiros <livia@cirno.name>
Reviewed-By: Philipp Dunkel <pip@pipobscure.com>
diff --git a/test/parallel/test-zlib-zip-interop.js b/test/parallel/test-zlib-zip-interop.js
index 429f7b02973..a1c54bed178 100644
--- a/test/parallel/test-zlib-zip-interop.js
+++ b/test/parallel/test-zlib-zip-interop.js
@@ -81,9 +81,19 @@ test('an archive written by createZipArchive is readable by unzip, zipinfo, and
const zipinfo = spawnSync('zipinfo', [archivePath], { env });
assert.strictEqual(zipinfo.status, 0);
+ const zipinfoOut = zipinfo.stdout.toString();
for (const name of Object.keys(files)) {
- if (!zipinfoUnicode && /[^\x20-\x7e]/.test(name)) continue;
- assert.ok(zipinfo.stdout.toString().includes(name), `zipinfo missing ${name}`);
+ if (zipinfoOut.includes(name)) continue;
+ // Info-ZIP's zipinfo replaces non-ASCII bytes with '?' unless built with
+ // wide-character support (e.g. natspec or alt-iconv-utf8-print); stock
+ // builds replace non-ASCII bytes with '?' regardless of UNICODE_SUPPORT,
+ // which can leave replacement characters (U+FFFD) once decoded.
+ if (/[^\x20-\x7e]/.test(name)) {
+ if (!zipinfoUnicode) continue;
+ const placeholder = name.replace(/[^\x20-\x7e]+/g, '?');
+ if (zipinfoOut.replace(/[?\uFFFD]+/g, '?').includes(placeholder)) continue;
+ }
+ assert.fail(`zipinfo missing ${name}`);
}
const extractDir = path.join(dir, 'out');