Skip to content

Detect valid archives #96

Open
Open
@arlininger

Description

@arlininger

I'm in the process of migrating from python2 using python-libarchive to python3 using python-libarchive-c. In all, the process has been quite easy (and many thanks to you folks for keeping a similar interface). However, I have run in to a bit of a snag.

I've been detecting whether or not a file is a legitimate archive based on trying to open it and detect errors. This works well for most files, but has been failing when I feed it something that looks like a /etc/passwd file. Previously, when libarchive returns Missing type keyword in mtree specification, the old python-libarchive would raise a ValueError. Now, this simply produces a Warning to the logger and the process continues.

Is there an easy way to make this produce an error that I can catch or otherwise detect invalid archives?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions