Skip to content

[Bug] kit-translate: a trailing # comment is kept in top-level fields and commands[] (command silently skipped) #558

Open

Description

@basiliskus

kit-translate.sh strips a trailing # comment from values in caps.network.allow, files[], environment, volumes[], and publishedPorts[], but not in kit_spec_field (every top-level scalar) or in kit_spec_commands. Valid YAML that a kit author would reasonably write then changes or drops behavior:

displayName: My kit  # c
commands:
  - phase: startup
    user: "1000"  # c          # whole command skipped
    command:
      - echo
      - one
  - phase: startup  # c        # whole command skipped
    user: "1000"
    command:
      - echo
      - two
  - phase: startup
    user: "1000"
    command:
      - git  # c               # argv[0] becomes "git  # c"
      - three

Observed at v4.0.1 (kit_spec_field, kit_spec_commands):

displayName=[My kit  # c]
kit-translate: skipping command with unsafe user: 1000"  # c
kit-translate: skipping command with unknown phase: startup  # c
__CMD__  startup  1000  false
  <base64 of "git  # c">
  <base64 of "three">

Both backends are affected: the msb adapter and the sbx translator both read commands through kit_spec_commands. The only signal is a stderr line during create; acq kit validate reports OK (see #563). A top-level comment is caught only for name: (kebab-case check).

Expected: strip an unquoted #… comment the same way the other field readers do (or reject it in acq kit validate), so a comment never changes a value or drops a command.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions