Skip to content

File objects seekable returns False even though they are seekable and seek returns None #3

@mxmlnkn

Description

@mxmlnkn
import ext4
f = open("tests/nested-tar-10M.ext4", 'rb')
v = ext4.Volume(f)
i = v.inode_at('/foo/fighter/ufo')
file = i.open()
print(file.read(3))  # b'iri'
print(file.seek(1))  # None
print(file.read(3))  # b'riy'
print(file.seekable())  # False

The reason for this is BlockIO inheriting from io.RawIOBase without overriding the seekable method, which by default is inherited from io.IOBase and returns False.

Second bug: As per definition of io.IOBase, seek should:

Change the stream position to the given byte offset, interpreted relative to the position indicated by whence, and return the new absolute position.

However, it returns None as shown above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions