Opened 7 years ago

Closed 6 years ago

#10977 closed defect (implemented)

parse_file should warn if the user attempts to parse a tarball

Reported by: karsten Owned by: atagar
Priority: Medium Milestone:
Component: Archived/Stem Version:
Severity: Keywords: descriptor
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:


The following code throws a ValueError at some point:

from stem.descriptor import parse_file
for desc in parse_file('server-descriptors-2014-02.tar',
                       'server-descriptor 1.0'):

atagar and I figured out that parse_file is attempting to parse the tarball as text file. And it actually finds text portions that are server descriptors. But the tarball file also contains non-text stuff that makes stem unhappy.

The solution is probably to warn if the input file to parse_file is a text file and not a binary file.

Child Tickets

Change History (2)

comment:1 Changed 6 years ago by atagar

Keywords: descriptor added

Oops, sorry Karsten! I somehow missed when you filed this ticket months back. I'll include a fix in the upcoming release this month.

comment:2 Changed 6 years ago by atagar

Resolution: implemented
Status: newclosed

On reflection rather than warning I added tarfile support. Stem's parse_file() method now handles tarfiles and tar paths.

Thanks for the catch!

Note: See TracTickets for help on using tickets.