Skip to content

Fido hanging on skeleton stream (fmt/1000) #189

@ross-spencer

Description

@ross-spencer

Bug spotted while writing docs, the following will hang when calling identify_stream(...).

# -*- coding: utf-8 -*-

"""Reference for Fido-based format identification

1. Create a byte-stream with a known magic number.
2. Call identify_stream(...) to identify the file against Fido's known formats.
"""

from __future__ import print_function

import io

from fido import fido

# Magic-number for fmt/1000.
BIN = b"\x5A\x58\x54\x61\x70\x65\x21\x1A\x01"

# Create the stream object with the known magic-number.
fstream = io.BytesIO(BIN)

# Create a Fido instance and call identify_stream. The identify_stream function
# will work on the stream as-is. This could be an open file handle that the
# caller is managing for itself.
f = fido.Fido()
f.identify_stream(fstream, "filename to display", extension=False)

I haven't looked at the code myself, but Carl has and identified we're getting to the end of the data during a loop and then it's blocking as we've nothing left to consume, but no way to exit. And it sounds like he has a fix, so that's good!

Metadata

Metadata

Assignees

No one assigned

    Labels

    OAGIssues to be discussed by OPF Advisory GroupbugA product defect that needs fixing

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions