Opened 7 years ago

Closed 7 years ago

#8005 closed defect (fixed)

stem parse_file errors when using descriptor_type='server-descriptor 1.0'

Reported by: cypherpunks Owned by: atagar
Priority: Medium Milestone:
Component: Core Tor/Stem Version:
Severity: Keywords:
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

On a call like

"stem.descriptor.parse_file(f,'server-descriptor 1.0')"

the new parse_file() fails with an error like

"ValueError: Line contains invalid characters: @downloaded-at 2012-09-17 17:44:50"

or

"ValueError: Line contains invalid characters: @type server-descriptor 1.0"

when it encounters annotations in a descriptor file, and it fails with an error like

"ValueError: The 'router' entry can only appear once in a descriptor"

when there are no annotations but multiple router entries.

Child Tickets

Attachments (2)

tst-descriptors (2.8 KB) - added by amj703 7 years ago.
tst-descriptors.2 (2.7 KB) - added by amj703 7 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 Changed 7 years ago by atagar

"ValueError: Line contains invalid characters: @type server-descriptor 1.0"

Oops! Sorry about that. Added a test to repro the issue and fixed...

https://gitweb.torproject.org/stem.git/commitdiff/3d3e69417975499fbe5d2a3eb591d808c6800874

"ValueError: Line contains invalid characters: @downloaded-at 2012-09-17 17:44:50"

Hmmm, I'm not entirely sure about that one. Please attach a file that's causing this and the call you're using.

"ValueError: The 'router' entry can only appear once in a descriptor"

When I get the descriptor_type argument I'm treating it like a metrics archive. Maybe I should just drop the 'there's only one descriptor' check entirely. Please attach a small descriptor file that exemplifies this issue for me to use in the tests.

Cheers! -Damian

Changed 7 years ago by amj703

Attachment: tst-descriptors added

comment:2 in reply to:  1 Changed 7 years ago by amj703

"ValueError: Line contains invalid characters: @downloaded-at 2012-09-17 17:44:50"

Hmmm, I'm not entirely sure about that one. Please attach a file that's causing this and the call you're using.

Attached as tst-descriptors.

"ValueError: The 'router' entry can only appear once in a descriptor"

When I get the descriptor_type argument I'm treating it like a metrics archive. Maybe I should just drop the 'there's only one descriptor' check entirely. Please attach a small descriptor file that exemplifies this issue for me to use in the tests.

Attached as tst-descriptors.2. Again, I want to be able to parse files containing multiple descriptors in, say, a the cached-descriptors format (although better would be that, given a descriptor_type, parse_file just goes ahead and tries to parse as many router entries as exist) even though it is not named cached-descriptors. I want to do that because I'm writing a simulator that is operating over a series of effective cached-descriptors representing the changing state of the network over time.

Thanks!

Changed 7 years ago by amj703

Attachment: tst-descriptors.2 added

comment:3 Changed 7 years ago by atagar

Resolution: fixed
Status: newclosed

Parsing all descriptors from non-cached files. This should also address extra annotations in server descriptors like @download (technically those shouldn't appear outside of cached descriptors, but meh)...

https://gitweb.torproject.org/stem.git/commitdiff/9183f64f2085d0f22d66b6cc381b6e66eef227f7

Also exposing validate as requested on irc...

https://gitweb.torproject.org/stem.git/commitdiff/998abb262eb4ed6a3d88a7be865412685ab26d3a

Feel free to reopen if I missed something!

Note: See TracTickets for help on using tickets.