Skip to content

Conversation

@ilyam8
Copy link
Member

@ilyam8 ilyam8 commented Dec 27, 2025

Summary

Fixes: #21504

  • Issue:
    edit-config sources /etc/profile, which may define a container environment variable (e.g. container=lxc in LXC environments).

    If container is not explicitly set by the caller, this inherited value is later treated as a command, causing failures.

  • Fix:
    Preserve the container variable only if it was explicitly set by the caller before sourcing /etc/profile.

Test Plan
Additional Information
For users: How does this change affect me?

Summary by cubic

Prevent edit-config from using a container value inherited from /etc/profile unless the caller set it. This avoids failures where inherited values (e.g., container=lxc) are treated as commands.

  • Bug Fixes
    • Save caller-provided container before sourcing /etc/profile.
    • Restore it after sourcing; otherwise unset container.

Written for commit bdae96f. Summary will update automatically on new commits.

@ilyam8 ilyam8 requested a review from a team as a code owner December 27, 2025 11:24
@github-actions github-actions bot added the area/packaging Packaging and operating systems support label Dec 27, 2025
@ilyam8 ilyam8 requested review from Copilot and removed request for a team December 27, 2025 11:24
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug where the edit-config script fails in LXC containers due to an inherited container environment variable from /etc/profile being mistakenly treated as a command.

Key Changes:

  • Preserve caller-provided container variable before sourcing /etc/profile
  • Restore the original value after sourcing, or unset it if it wasn't initially set

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ilyam8 ilyam8 merged commit 17bfcfe into netdata:master Dec 27, 2025
115 checks passed
@ilyam8 ilyam8 deleted the fix-edit-config-ignore-container branch December 27, 2025 14:57
stelfrag pushed a commit to stelfrag/netdata that referenced this pull request Jan 9, 2026
stelfrag pushed a commit to stelfrag/netdata that referenced this pull request Jan 9, 2026
@stelfrag stelfrag mentioned this pull request Jan 9, 2026
Ferroin pushed a commit that referenced this pull request Jan 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/packaging Packaging and operating systems support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: edit-config container misdetection

2 participants