Member identity and destination filename collisions, not generic backup restoration or export completeness.
Substantively revised October 21, 2026. Author interpretation, documented cases and hypothetical examples are distinguished below.
A ZIP archive can contain two different members called the same thing. It can also contain two visibly different names that a destination model treats as one path. Opening the archive successfully does not settle which member will become which file. Before delivering an extracted folder, inspect the mapping from archive entries to destination names, because a useful inventory can disappear the moment a tool assumes every name is a unique identity.
Direct answer
List ZIP entries as individual members, retain their entry identities and compare their proposed destination paths before extraction. Check exact duplicate names separately from collisions introduced by the intended destination rules or flattening. Resolve ambiguous mappings explicitly while retaining the original archive. A pure-path comparison is only a model of a naming rule, not a test of the actual volume or a secure extraction implementation. Validate the real receiving tool and destination when the deliverable requires an observed extracted result.
Key takeaways
An archive member and its filename are different kinds of identity. Two entries can share a name while containing different payloads. A name-keyed dictionary or a single successful lookup can conceal that multiplicity.
Destination planning can introduce a collision even when the original member names differ. Case rules and deliberate directory flattening are examples to inspect. A folder that contains fewer files after extraction does not by itself establish that fewer meaningful objects were present.
Passing a member-integrity check does not establish an unambiguous naming plan. Preserve the evidence about every member until the mapping is resolved. Keep a narrow collision inspection separate from claims about safe extraction, complete backup recovery or malicious-archive handling.
Definitions and relationships
A ZIP member is an entry inside the archive. Its information includes a name and other metadata used by the library to address that entry. A destination path is where the receiving process intends to materialize a file. The mapping between them can lose distinctions the archive itself retains.
An exact duplicate name means the same name occurs for multiple entries. A destination collision means two intended outputs compete for one destination identity under the selected rules. Flattening is a deliberate transformation that discards directory context and keeps only a simpler output name; it can create a collision even when the full original paths are distinct.
A path-flavour model supplies computational comparison rules without querying a filesystem. A real destination includes an actual volume, directory state and extraction tool. This article uses pure models to expose particular naming disagreements. It does not infer every real destination's behavior from an operating-system label or from a library class name.
The problem with counting only names
Imagine a hypothetical editor receiving a ZIP containing contributions from several folders. A listing looks plausible, and a quick helper turns the names into a dictionary to make selection easy. The helper then reports one document per name, although the archive originally contained multiple members for one repeated name.
The editor may believe the dictionary is a faithful inventory. In reality, it has already selected a representation that cannot describe all the archive entries independently. An output list can look tidy precisely because it has hidden the question that needed review: which distinct member should the recipient use when a name alone is ambiguous?
A second helper flattens all nested files into one output folder for convenience. Two different full paths can now compete for the same basename. The source archive's structure was part of the distinguishing information. Discarding it is an editorial or delivery decision, not a harmless formatting detail established by the success of opening the ZIP.
Root cause: a locator is mistaken for a unique identity
A filename is often a convenient locator, but it is not a guarantee that the archive contains exactly one entry with that value. A program that assumes uniqueness may replace a previous mapping without asking which payload the user intended to receive. The library can return a result while the handoff loses the evidence needed to explain that selection.
Destination handling adds another interpretation layer. A receiver can compare names differently from the archive listing, normalize separators or apply a delivery transformation. The original name and the output name are therefore related representations rather than interchangeable labels. A process that records only the final output path can conceal where the distinguishing information disappeared.
The root repair is to keep entry identity, member name and proposed destination side by side. That small separation lets the investigator identify ambiguity before producing files. It also creates a basis for an explicit mapping decision rather than letting the extraction tool's incidental overwrite behavior become the project's unrecorded policy.
Framework: the Member Destination Ledger
The Member Destination Ledger is the author's proposed inspection method. It has four fields: Entry Reference, Original Name, Proposed Target and Resolution. It is an evidence ledger for a naming decision, not a secure extraction library or a complete archive validator.
Entry Reference identifies the individual member in the inspected archive. In the local exercise, list indexes and ZipInfo records distinguish entries, including the repeated name. Bind the ledger to the particular archive being examined. A changed archive can contain different entries even when the outer ZIP filename remains the same.
Original Name preserves the member's reported name before the delivery process transforms it. Retain directory context here, even if the requested output will be flat. A source path that will not appear in the final folder can still be necessary to explain why two contributions need different destination names.
Proposed Target applies the intended naming plan or comparison model. Keep the model explicit. A pure Windows-path comparison and a pure POSIX-path comparison can nominate different groups without either operation probing the actual receiving volume. A flattening model should say it discards directory context rather than presenting the shorter name as though it were original.
Resolution records what should happen when more than one entry competes for a target. An authorized sender might rename members and issue a new archive; an editor might assign explicit distinct output names; a process might refuse an ambiguous delivery. The right decision depends on the work. The ledger prevents an arbitrary last-arriving member from silently becoming that decision.
To apply the ledger, preserve the archive, enumerate entries without assuming unique names and produce groups under the proposed target rule. Review every ambiguous group before materialization. When the intended folder is consequential, test the approved mapping with the actual receiving process and inspect the outputs. The grouping stage alone does not establish that extraction completed correctly.
Three documented library mechanisms
Python's zipfile documentation supplies the first real mechanism. Reading operations can address a member with a ZipInfo object, which is useful when an archive has duplicate names. An entry-oriented listing therefore supports a question a unique-name lookup cannot fully express: which of several identically named members is being examined? [S1]
Python's pathlib documentation supplies the second mechanism. PureWindowsPath and PurePosixPath use different path-flavour equality rules, including their documented case behavior, and perform computational operations without filesystem access. That makes them useful for an explicitly named model. It does not make either class a detector of every volume-specific filename rule. [S2]
Python's shutil documentation supplies the third mechanism. Its archive-unpacking interface requires attention to the extraction destination and warns against extracting untrusted archives without inspection. Its filter parameter is not accepted for ZIP files. This article does not turn a filter intended for another archive format into a ZIP safety claim, and it does not execute an unpacking operation. [S3]
Case study: seven entries that do not mean seven distinct file targets
A local synthetic research script ran on Python 3.11.9 and passed 19 assertions. It created a small ZIP_STORED archive in memory, inspected its entries and read known tiny payloads. It extracted no files and probed no destination volume. The exercise is about entry identity and naming models, not a measured delivery outcome for a real archive.
The archive contains seven entries: two named notes/report.txt, a pair named Readme.txt and README.txt, two nested data files under north and south, and one directory entry. Six entries are non-directory members. The repeated report entries have different small payloads, first and second, so losing one distinction would conceal actual different content in this constructed case.
The script observes the library's duplicate-name warning while building the fixture. Its entry listing retains both occurrences, and their member offsets differ. Reading each through its own ZipInfo retrieves the intended distinct payload. These actual results demonstrate why the member reference matters even when the name string is identical.
A name-only lookup returns the second report payload in this tested runtime. The article records that observation rather than prescribing it as a selection policy or promising the same outcome in another tool. A recipient who needs the first entry should not depend on a lookup whose input cannot express which duplicate was intended.
The archive's member CRC check also passes in the fixture. That result does not remove the duplicate-name ambiguity. The stored members can be internally readable while the proposed output naming plan remains unresolved. Integrity of these selected payloads and uniqueness of their destination identities are different acceptance questions.
Case-only names under explicit pure-path models
The six non-directory entries have five distinct exact name strings. Under the pure POSIX-path model, their full relative paths form five groups. Under the pure Windows-path model, the case-only Readme and README pair shares a key, leaving four groups. These are actual computational results for the selected names and Python path classes.
The result is intentionally described as a model. The research does not create either file on a real volume, inspect case-sensitivity settings or evaluate a particular extraction application's naming rules. A model can identify a question worth resolving before delivery without pretending it already observed the actual receiver's behavior.
This distinction is useful in a cross-environment handoff. Instead of telling a colleague that their operating system will certainly overwrite one file, show which selected model makes the two names compare equal. Then identify the real destination and tool that need to be checked. The evidence remains accurate even when the actual environment has a more specific configuration than the broad platform label suggests.
Flattening spends the directory distinction
The nested members north/data.txt and south/data.txt remain distinct under both full-path models in the rehearsal. The directory components distinguish them. A flattening operation discards that distinction by proposing only data.txt for both outputs.
With flattening, the fixture produces four pure POSIX basename groups and three pure Windows basename groups. The smaller counts do not demonstrate more duplicates in the source content. They demonstrate that the proposed delivery transformation has removed additional naming information. A useful review should ask whether the flattened output is still capable of representing all required contributions.
The ledger can support an explicit repair. The sender might supply distinct meaningful output names, or the receiver might retain the original directories instead of flattening them. Which choice is appropriate depends on how the recipient will use the files. The research does not invent a universal automatic renaming algorithm or claim that adding a numerical suffix preserves every external reference to the original names.
Failure example: the tidy inventory that already overwrote an entry
A fictional import script enumerates a ZIP and inserts each member into a dictionary keyed by its name. The script later extracts the dictionary's selected members and congratulates itself on having one output per unique name. The underlying archive may have contained multiple entries for one name, but that evidence vanished before the review began.
The failure is in the inventory model, before any filesystem operation is necessary. The dictionary cannot represent all entries independently under the assumed key. An analyst inspecting only that reduced inventory cannot reliably decide whether one entry was intentionally selected or silently displaced.
Repair the inventory by retaining all member references in each group. The research's full Windows model preserves references to all six non-directory entries even though it has four keys. That is a useful intermediate result: no collision group loses its contributing entries. It is not yet permission to materialize files, because the resolution and actual receiving behavior still need review.
Counterargument and tradeoff: renaming can break the deliverable
It is tempting to solve every collision by assigning a new unique name. That can be useful for a collection of independent reading copies. It can also break relative links, project references or a workflow that expects specific filenames. The ability to make two output names different does not prove the resulting delivery still works.
The tradeoff therefore concerns more than keeping both payloads. The destination mapping must preserve the relationships the recipient needs. Keeping original directories may be preferable when they carry meaningful references. Asking the producer for a corrected archive may be preferable when the receiver cannot determine which entry a name was intended to select.
A blocked ambiguous extraction can feel slower than a folder produced immediately. Yet the folder's existence is a weak success condition when its mapping cannot be explained. The Member Destination Ledger makes the remaining decision visible and keeps enough evidence for an authorized resolution, without pretending every archive can be repaired safely through a generic naming trick.
What the research deliberately does not establish
The script uses known small in-memory members and does not implement an extraction engine. It does not handle malicious resource consumption, symlinks, traversal, races, reserved destination names, all Unicode interactions or every separator rule. A successful result should not be advertised as permission to extract an arbitrary untrusted archive.
It also does not verify complete backup recovery, account-export coverage or the usability of an offline project. Those questions require different evidence about required objects and their dependencies. This article's narrower operation is whether the proposed name mapping preserves the distinctions between particular archive members before they become output files.
Finally, pure-path equality is not an observed filesystem acceptance test. When a production deliverable requires actual extraction, identify the real tool, target environment and permitted mapping, then obtain an appropriate observed result. Preserve the narrower ledger findings as useful prior evidence without promoting them into a stronger execution claim.
Common mistakes and precise corrections
Mistake: equating the member count with the count of distinct final files. Correction: separate directory entries, individual members, exact names and proposed target groups. The seven-entry fixture contains six non-directory entries, five exact names and different modeled target counts.
Mistake: assuming readable payloads remove naming ambiguity. Correction: inspect destination grouping independently of the selected integrity check. The fixture passes its CRC check while containing distinct report payloads under one repeated name.
Mistake: announcing a real overwrite based only on PureWindowsPath equality. Correction: describe the computational model and its limitation. It nominates a conflict under its rules; the actual volume and tool still require relevant inspection before an observed extraction claim.
Mistake: treating flattening as a display-only choice. Correction: record the original full name and proposed basename side by side. If external relationships depend on directories, verify that any approved transformation preserves those relationships rather than only producing distinct-looking files.
Action plan for a received ZIP
Preserve the archive being inspected and identify its particular version. Enumerate members as entries, including directory status and an entry reference suitable for the chosen library. Avoid a data structure that silently assumes names are unique before the naming question has been answered.
Create proposed-target groups under an explicit delivery plan. Check exact duplicates first, then examine transformations such as case comparison and flattening relevant to the intended environment. Retain every contributing member reference in every group so the report can explain all collisions without reconstructing a discarded inventory.
Resolve ambiguity with someone authorized to decide the intended delivery. Record the approved mapping, any preserved directories and any consequential references that must still work. If the source does not provide enough information to choose between members, keep the ambiguity visible rather than inventing an answer from whichever lookup happens to return a payload.
When actual output is required, use the appropriate receiving process and inspect that output against the approved mapping and other required checks. Keep the research's narrow findings separate from an execution result. The handoff should explain which member became which file and what remains unverified, instead of asking the recipient to trust a folder simply because it exists.
FAQ
Can two ZIP entries really have the same filename?
The constructed archive contains two such entries, and the documented API supports addressing entries by ZipInfo when names repeat. An archive inspection should therefore retain individual member references instead of assuming every name is unique.
Does a name-only read identify both duplicates?
No. One name does not express which repeated entry the reader intends. The local runtime returns the second fixture payload for its name-only lookup; the article does not use that incidental result as a universal selection policy.
Why use ZipInfo in the experiment?
It allows the research to read each known duplicate separately. The two entries retain different payloads despite sharing a name. That distinction is the evidence a name-keyed reduced inventory would conceal.
Does a passed CRC check mean the output mapping is unambiguous?
No. The synthetic archive passes that check while its repeated report name still needs a resolution. Integrity of selected member data and uniqueness of destination paths are separate questions.
How many files did the seven-entry archive contain?
The fixture has six non-directory entries and one directory entry. Those six entries have five distinct exact name strings. A destination model can group those names further, so none of these counts alone establishes a final delivered-file count.
Are Readme.txt and README.txt always the same real file?
The pure Windows model used here compares them equal; the pure POSIX model does not. No actual volume was probed. The receiving environment and extraction tool need their own relevant inspection before claiming observed behavior.
Why not rely only on the destination operating system's name?
A broad label does not record the actual volume settings, tool behavior or naming transformation. Use an explicit model to expose the question, then check the environment the deliverable will really use.
Why does flattening create another collision?
The two data.txt members are distinct under their north and south directory paths. Flattening proposes the same basename for both. The transformation discards naming information that previously kept them apart.
Is adding a suffix always a valid repair?
No. A renamed file may lose relationships that depend on its original path. Decide and test the approved mapping in the actual delivery context rather than assuming unique-looking output names establish a usable result.
Did this experiment extract any archive member?
No. It created and inspected a small in-memory ZIP and read known tiny payloads. The research report records zero extracted files and makes no actual destination-output claim.
Is the script a secure archive extractor?
No. It is a bounded naming inspection. It does not validate arbitrary malicious input, enforce resource limits, resolve races or supply all destination safety checks. Its scope should remain visible wherever its results are reused.
Can a tar extraction filter be assumed to protect ZIP unpacking?
The consulted Python shutil documentation states that filter is not accepted for ZIP files. Do not transfer a guarantee from another format's interface to this one without inspecting the actual contract.
What should happen to an unresolved duplicate group?
Keep all contributing entries and request an authorized mapping decision. The appropriate resolution can be a corrected source archive, distinct approved names, preserved directories or refusal of an ambiguous output. The name lookup itself does not decide the user's intent.
Does this verify an entire account export or backup?
No. Required-object coverage, restore behavior and project dependencies are separate tasks. This article concerns a particular member-to-name mapping that should be understood before materialization.
What makes the handoff record useful?
It identifies the inspected archive, every relevant entry, its original name, its proposed target and the approved resolution. An actual output result is recorded separately when obtained. A recipient can then trace a delivered file without assuming the archive name was a unique identity.
Recommended books
The Pragmatic Programmer, 20th Anniversary Edition, by David Thomas and Andrew Hunt, published in 2019, provides context for making assumptions and operational decisions explicit. Its relevance is the unexamined claim that a filename uniquely identifies an object. The documented library rules and actual synthetic results remain the technical evidence for this article.
Designing Data-Intensive Applications, first edition, by Martin Kleppmann, published by O'Reilly in 2017, supplies broader context for representations, identity and data movement. It does not validate an extraction tool or decide which duplicate member a receiver should retain. The Member Destination Ledger is a proposed inspection aid for that narrower decision.
A Philosophy of Software Design, second edition, by John Ousterhout, released in July 2021, offers context for exposing important complexity through a clearer interface. An entry-oriented ledger reveals ambiguity that a convenient unique-name interface can hide. The book is not a ZIP security specification or proof that the proposed output mapping is correct for another environment.
Further exploration
Inspect one authorized archive handoff where someone currently assumes that every listed name is unique. Keep the entry references and compare the proposed delivery names before extraction. Determine whether any transformation discards context the recipient still needs.
Then trace one approved output back to its particular archive member. If that connection cannot be explained when names repeat, improve the ledger before calling the folder complete. A useful delivery preserves both the needed content and enough identity to show which source entry each file represents.
Primary evidence sources
- [S1] Actually read duplicate names and ZipInfo-addressed member operations; archive names are not unique by assumption.
- [S2] Actually read PurePosixPath/PureWindowsPath differing case-fold comparisons; these are path-flavour semantics not proof of actual volume behavior.
- [S3] Actually read unpack destination/default and untrusted archive inspection warning; ZIP lacks tar filter option.
Related concepts: systems thinking, wealth structure, and the survival loop. Read the editorial policy and citation guide.