Unable to retrieve files from tar when the name of the inside files start with `./`

Open Beginner friendly
#810 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
python
Domain
data

Research direction

Start with the extractfile() method in ete4/ncbi_taxonomy/ncbiquery.py, linked in the issue, and reproduce the behavior with the two tar commands shown. Done means files stored with leading ./ in the archive can be retrieved just like files without that prefix.

Written by the indexing model from the issue text.

Description

etetoolkit version used: 3.1.3, but is also seen from the code of the problematic script of ete4 at the time of writing

extractfile() method cannot recognize an existing file inside a tar file when the inside file has leading ./ in the name. Found out when used NCBITaxa(dbfile=ete_db_fpath, taxdump_file=ncbi_taxdump_fpath).

Not working for:

$ tar --create --gzip --file "resources/ncbi_taxdump/taxdump.tar.gz" --directory "resources/ncbi_taxdump/new_taxdump_233" .
$ tar -tf resources/ncbi_taxdump/taxdump.tar.gz 
./
./taxidlineage.dmp
./nodes.dmp
./host.dmp
./readme.txt
./delnodes.dmp
./division.dmp
./typeoftype.dmp
./merged.dmp
./images.dmp
./typematerial.dmp
./gencode.dmp
./gc.prt
./fullnamelineage.dmp
./rankedlineage.dmp
./citations.dmp
./excludedfromtype.dmp
./names.dmp

Working for:

$ tar --create --gzip --file "resources/ncbi_taxdump/taxdump.tar.gz" --directory "resources/ncbi_taxdump/new_taxdump_233" --transform 's|^\./||' .
$ tar -tf resources/ncbi_taxdump/taxdump.tar.gz 
./
taxidlineage.dmp
nodes.dmp
host.dmp
readme.txt
delnodes.dmp
division.dmp
typeoftype.dmp
merged.dmp
images.dmp
typematerial.dmp
gencode.dmp
gc.prt
fullnamelineage.dmp
rankedlineage.dmp
citations.dmp
excludedfromtype.dmp
names.dmp
Dominant language
Python
Stars
885
Forks
232
PR merge metrics
No merged PRs in 30d

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.

More from etetoolkit/ete

All issues in etetoolkit/ete

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.