Skip to content

Fix operational get-data crash on containers with shell chars#1509

Open
rical wants to merge 1 commit into
mainfrom
fix-flaky-container-tests
Open

Fix operational get-data crash on containers with shell chars#1509
rical wants to merge 1 commit into
mainfrom
fix-flaky-container-tests

Conversation

@rical
Copy link
Copy Markdown
Contributor

@rical rical commented May 19, 2026

Description

Yanger was populating a strict-pattern config leaf from podman's full entrypoint, breaking every operational read of containers whose command contained characters disallowed by the pattern. To fix this, we simply remove "command" from the data as "command" is config not operational.

Checklist

Tick relevant boxes, this PR is-a or has-a:

  • Bugfix
    • Regression tests
    • ChangeLog updates (for next release)
  • Feature
    • YANG model change => revision updated?
    • Regression tests added?
    • ChangeLog updates (for next release)
    • Documentation added?
  • Test changes
    • Checked in changed Readme.adoc (make test-spec)
    • Added new test to group Readme.adoc and yaml file
  • Code style update (formatting, renaming)
  • Refactoring (please detail in commit messages)
  • Build related changes
  • Documentation content changes
    • ChangeLog updated (for major changes)
  • Other (please describe):

@rical rical force-pushed the fix-flaky-container-tests branch 2 times, most recently from de177ec to a015e1b Compare May 19, 2026 13:34
@mattiaswal
Copy link
Copy Markdown
Contributor

This feels like a bandaid fix, the core problem is that containers is not removed when change configuration to test config, right? Or what did you find out in your investigation @rical?

Comment thread test/case/containers/cleanup/test.adoc Outdated
@rical
Copy link
Copy Markdown
Contributor Author

rical commented May 19, 2026

This feels like a bandaid fix, the core problem is that containers is not removed when change configuration to test config, right? Or what did you find out in your investigation @rical?

Yes, I totally agree. I rushed this. I'm normally the advocacy of aggressive pruning in the pursuit of immutability :)

I will drop the commit from this PR. Rewrite the test to fail if it finds dangling containers and submit it in another PR, so we can merge the actual fix in this PR.

@rical rical force-pushed the fix-flaky-container-tests branch from a015e1b to e8e8fab Compare May 19, 2026 17:30
The 'command' leaf is config, with a strict pattern that doesn't allow
'&', quotes or pipes.  Yanger was populating it from podman's full,
untruncated container command -- so any container whose entrypoint
uses shell metacharacters (e.g. sh -c "... && ...") failed YANG
validation.

The symptom: every operational read of /infix-containers:containers
returns SR_ERR_INTERNAL, which in turn fails the whole get-data on
the operational datastore.  This breaks case/misc/operational_all and
any RESTCONF/NETCONF read that touches containers.

This was introduced in 59028c4 ("Fix #1466: 'show container' shows no
output"), which added the operational, pattern-less 'cmdline' leaf
but left the old 'command' assignment in place.  Drop it -- 'cmdline'
already carries the full command line, and 'command' belongs to
running config.

Note: the failure can look intermittent across test runs because
podman storage is persistent.  It only triggers once a container with
a bad-pattern command ends up in 'podman ps -a', including stale or
exited leftovers from earlier runs.

Signed-off-by: Richard Alpe <richard@bit42.se>
@rical rical force-pushed the fix-flaky-container-tests branch from e8e8fab to bcc2df7 Compare May 19, 2026 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants