Skip to content
This repository was archived by the owner on Feb 10, 2021. It is now read-only.
This repository was archived by the owner on Feb 10, 2021. It is now read-only.

Images.build incorrectly uses os.walk #79

@eddsalkield

Description

@eddsalkield

The method podman/libs/images.py#Images.build runs os.walk, and expects it to return a list of files from context_directory. It actually yields a 3-tuple (dirpath, dirnames, filenames) as described here. Later, when trying to add files into the tar archive (line 176), the program fails with error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/edd/.local/lib/python3.8/site-packages/podman/libs/images.py", line 189, in build
    tar.addfile(tar.gettarinfo(fileobj=open(name)))
TypeError: expected str, bytes or os.PathLike object, not tuple

While we're at it, how is this code expected to function when encountering an empty directory?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions