Skip to content

apk.packages treats APK options as package names #2099

Open

Description

@wowi42

Describe the bug

apk.packages accepts APK command-line options in the packages argument. For example, passing --allow-untrusted as a package generates an apk add command where APK treats the value as an option instead of a package name.

There is no explicit operation argument for allowing untrusted packages, so users currently have to rely on this unintended behavior.

To Reproduce

from pyinfra.operations import apk

apk.packages(
    packages=[
        "--allow-untrusted",
    ],
)

The generated install command starts with:

apk add --allow-untrusted

Expected behavior

  • allow_untrusted=True should add --allow-untrusted to the apk add command.
  • Package entries beginning with - should be rejected with OperationValueError rather than passed to APK as options.
  • Invalid package entries should be rejected before any requested update or upgrade commands run.

Meta

Confirmed on the current 3.x source at commit cd95d5a3c8d2a72d5b8f9d64d879082b5c58315b.

Activity

  1. added
    dependency issue
    CLI
    on Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIdependency issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions