Repository navigation
test: fix zipinfo non-ascii check in test-zlib-zip-interop - #66978
Conversation
|
Welcome to Node.js, and thank you for your first contribution! Before review, please take a moment to read:
Please make sure every commit is signed off. For a first pull request, GitHub Actions require collaborator approval and Jenkins CI must be started by a collaborator or triager, so an initial wait is normal. |
|
Hi @ravi-arnan, thanks for working on this! Two things I noticed:
I opened #66979 with a version that keeps the |
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: nodejs#66975 Signed-off-by: Ravi Arnan <raviarnankeren@gmail.com>
288cb78 to
d64e99d
Compare
|
Hi @vedchaudhari, thanks for the review and for catching the macOS behavior! I reproduced and verified this directly on a physical macOS machine (Darwin 21.6.0, built-in Info-ZIP 6.0). As you noted:
I have updated this PR to:
Linter and test assertions are verified clean. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #66978 +/- ##
==========================================
+ Coverage 90.58% 90.60% +0.01%
==========================================
Files 797 797
Lines 278298 278298
Branches 53523 53518 -5
==========================================
+ Hits 252095 252140 +45
+ Misses 16570 16519 -51
- Partials 9633 9639 +6 🚀 New features to boost your workflow:
|
vedchaudhari
left a comment
There was a problem hiding this comment.
Tested on macOS with the system zipinfo, passes. LGTM, thanks!
pipobscure
left a comment
There was a problem hiding this comment.
Why can't we just force the entire world to use UTF8 😢 😜
|
Landed in dd425b7 |
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: #66975 Signed-off-by: Ravi Arnan <raviarnankeren@gmail.com> PR-URL: #66978 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: LiviaMedeiros <livia@cirno.name> Reviewed-By: Philipp Dunkel <pip@pipobscure.com>
Fixes: #66975
Problem
In
test/parallel/test-zlib-zip-interop.js,zipinfoUnicodeis evaluated as/UNICODE_SUPPORT/.test(unzip -v). However, stock Info-ZIP builds (common on Linux distros such as NixOS, Arch Linux, Alpine, and Debian) still sanitize non-ASCII bytes to'?'infnfilter()unless patched with wide-character/UTF-8 printing support (e.g.USE_NATSPECoralt-iconv-utf8-print).On these systems,
zipinfooutputsunicode-??.txt(orunicode-??????.txt) instead ofunicode-名前.txt, which causes the assertion:to fail.
Solution
When checking
zipinfooutput:zipinfolisted the entry with'?'placeholders.The actual UTF-8 decoding and round-trip extraction continue to be verified by
bsdtardirectly afterwards.Verification
node tools/eslint/node_modules/eslint/bin/eslint.js test/parallel/test-zlib-zip-interop.js(clean, 0 warnings/errors).zipinfoexecution on Linux (NixOS) where stock Info-ZIP printsunicode-??.txt(clean pass).