tensorflow / tensorflow/datasets

Nested extraction create name collision

Open
#2,267 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug contributions welcome
Dominant language
Python
Stars
4.6k
Forks
1.6k
Avg merge
3h 54m
Merged PRs (30d)
1

Description

With two nested archive containing the same filename:

dataset0.zip/
    train.zip/
        ...

dataset1.zip/
    train.zip/
        ...

The two inner filenames will be extracted on the same destination (extracted/ZIP.train.zip), creating a collision between the files:

path0 = dl_manager.download_and_extract('http://ds/dataset0.zip')
dl_manager.extract(path0 / 'train.zip')  # Extract to extracted/ZIP.train.zip

path1 = dl_manager.download_and_extract('http://ds/dataset1.zip')
dl_manager.extract(path1 / 'train.zip')  # Oups, skip extraction to reuse ZIP.train.zip from dataset0.zip

To avoid collisions, we could add the hash of the extracted path, like extract(path) extract at ZIP.hash(path).name instead of ZIP.name currently.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the implementations of download_and_extract and extract, then trace how extracted paths are named and reused. Reproduce the two nested-archive cases from the issue and add coverage for identical inner filenames. Done means distinct source paths no longer collide while repeated extraction of the same path can still reuse its destination.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-engineering
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.