Skip to content

test: accept '?' from zipinfo in zip interop test - #66979

Closed
vedchaudhari wants to merge 1 commit into
nodejs:mainfrom
vedchaudhari:test-zip-interop-zipinfo
Closed

vedchaudhari wants to merge 1 commit into
nodejs:mainfrom
vedchaudhari:test-zip-interop-zipinfo

Conversation

@vedchaudhari

Copy link
Copy Markdown
Contributor

When zipinfo is built without the natspec patch (Gentoo with USE="unicode -natspec", for example), test-zlib-zip-interop.js fails with:

AssertionError [ERR_ASSERTION]: zipinfo missing unicode-名前.txt

Turns out zipinfo runs every file name through fnfilter() before printing it, and that swaps any byte isprint() doesn't like for a ? (extract.c#L2895-L2924). Most distros switch that off (Debian, Ubuntu, Arch and Alpine build with NO_WORKING_ISPRINT, Fedora and openSUSE patch it, and natspec sets NO_SETLOCALE), but Gentoo without natspec doesn't, so the file shows up as unicode-??????.txt, one ? per byte. The test only checks for UNICODE_SUPPORT in unzip -v, and that doesn't tell you whether names get filtered.

So now, if the exact name isn't in the listing, the test also accepts it with ? in place of the non-ASCII part. The ASCII part still has to match, and bsdtar still checks the real name when it extracts.

To reproduce it, I built Info-ZIP 6.0 on Ubuntu 24.04 in WSL with the same target and flags Gentoo uses (linux_noasm, -DUNICODE_SUPPORT -DUNICODE_WCHAR -DUTF8_MAYBE_NATIVE, no natspec). With that zipinfo the test fails on main and passes with this change. It still passes with Ubuntu's normal zipinfo too.

There's also #66978 for this. The main difference is that this one keeps the UNICODE_SUPPORT check, so macOS still skips the non-ASCII name. Apple's zipinfo only turns some of the bytes into ?: 名前 (e5 90 8d e5 89 8d) comes out as e5 3f 3f e5 3f 3f, so a plain ? pattern doesn't match there. I ran main, #66978 and this branch on a macOS runner (https://github.com/vedchaudhari/node/actions/runs/40075440958): main and this one pass, #66978 doesn't yet.

@LiviaMedeiros can you check if this fixes it on your machine?

Fixes: #66975

Assisted-by: Claude Code. I reproduced the issue, reviewed the change, and tested it with both zipinfo builds myself.

Info-ZIP's fnfilter() prints bytes that isprint() rejects as '?'. Some
builds that report UNICODE_SUPPORT still do this, for example Gentoo's
without the natspec patch, so zipinfo lists the non-ASCII entry name
as a row of '?' and the test fails.

When the exact name is not in the listing, also accept it with the
non-ASCII parts shown as '?'. The ASCII parts and the entry itself are
still checked, and bsdtar still checks the exact name when extracting.

Assisted-by: a closed-source coding agent
Signed-off-by: vedchaudhari <vedc2853@gmail.com>
@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. test Issues and PRs related to Node.js core tests and test infrastructure. labels Oct 24, 2026
@codecov

codecov Bot commented Oct 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.57%. Comparing base (1eb734d) to head (55c9244).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #66979      +/-   ##
==========================================
- Coverage   90.58%   90.57%   -0.01%     
==========================================
  Files         797      797              
  Lines      278298   278298              
  Branches    53523    53516       -7     
==========================================
- Hits       252095   252080      -15     
- Misses      16570    16576       +6     
- Partials     9633     9642       +9     

see 32 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vedchaudhari

Copy link
Copy Markdown
Contributor Author

Closing in favor of #66978, which was opened first and now has the same change, including the macOS case. Thanks @ravi-arnan!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ci PRs that need a full CI run. test Issues and PRs related to Node.js core tests and test infrastructure.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test/parallel/test-zlib-zip-interop.js fails if system's zipinfo is built without natspec

2 participants