Skip to content

Fix apt_conffile_report exiting 1 when uutils comm sees locale-sorted input - #146

Merged
MickLesk merged 1 commit into
community-scripts:mainfrom
BadFlo:fix-conffile-report-comm-order
Oct 16, 2026
Merged

MickLesk merged 1 commit into
community-scripts:mainfrom
BadFlo:fix-conffile-report-comm-order

Conversation

@BadFlo

@BadFlo BadFlo commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

✍️ Description

On Ubuntu 26.04 (uutils coreutils), apt_conffile_report() makes every update end with exit code 1 when a container has two or more leftover *.dpkg-new / *.dpkg-dist files. _cs_conffile_list sorts with the locale, uutils comm compares bytes, so comm declares its input unsorted and exits 1. The ERR trap then reports a failure even though the update worked.

Fix: sort and compare in the same order.

  • _cs_conffile_list: sort -> LC_ALL=C sort
  • apt_conffile_report: comm -13 -> LC_ALL=C comm -13

Details and reproduction (with a verbose log) are in the linked issue, which I filed in ProxmoxVE because I hit it through ct/plex.sh.

🔗 Related Issue

Fixes community-scripts/ProxmoxVE#17967

✅ Prerequisites (X in brackets)

  • Self-review completed – Code follows project standards.
  • Tested thoroughly – The real functions were run on an Ubuntu 26.04 LXC on Proxmox VE with three leftovers that sort differently by locale and by byte. Unpatched: ERR trap rc=1. Patched: rc=0 and the new conffile is still reported. Not tested on Incus (the change is plain shell and not backend-specific).
  • No security risks – No hardcoded secrets, unnecessary privilege escalations, or permission issues.
  • API.txt regenerated – Not applicable, no function signature or behavior change.

🤖 AI Assistance (X in brackets)

  • No AI used – Code was written without AI assistance.
  • AI was used – Claude (Sonnet 5.5) found the cause and wrote the two-line change. I reviewed it and ran the test on my own container, and I take responsibility for it matching this repo's conventions.

🛠️ Type of Change (X in brackets)

  • 🐞 Bug fix – Resolves an issue without breaking functionality.
  • ✨ New feature – Adds new, non-breaking functionality.
  • 💥 Breaking change – Alters existing behavior in a way that may require updates in every downstream script.
  • 🔧 Refactoring / Code Cleanup – Improves readability or maintainability without changing functionality.
  • 📝 Documentation update – Changes to README, docs/, CONTRIBUTING.md, or other docs.

🤖 Generated with Claude Code

… input

_cs_conffile_list sorted with the locale while uutils comm (Ubuntu 26.04)
compares bytes, so comm reported its input as unsorted and exited 1 as soon
as two leftover *.dpkg-new/*.dpkg-dist files sorted differently. The ERR trap
then made every update end with exit code 1. Sort and compare with LC_ALL=C.

Fixes community-scripts/ProxmoxVE#17967

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Try this branch

The engine and the scripts resolve independently, so a production script can
be run against the engine from this PR by setting one variable:

COMMUNITY_SCRIPTS_CORE_URL=https://raw.githubusercontent.com/BadFlo/core/fix-conffile-report-comm-order \
bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/debian.sh)"

Swap ct/debian.sh for whatever exercises the change.

Run a script from a fork as well
curl -fsSL https://raw.githubusercontent.com/BadFlo/core/fix-conffile-report-comm-order/tools/run.sh |
  bash -s -- https://raw.githubusercontent.com/YOU/DevScripts/your-branch ct/debian.sh \
             https://raw.githubusercontent.com/BadFlo/core/fix-conffile-report-comm-order

Note that run.sh is reached through a pipe, so the script it starts inherits
an exhausted stdin. Whiptail is fine — it opens /dev/tty — but a plain read
would see EOF. The single-variable form above does not have that problem.

Useful flags while testing

dev_mode=net logs every engine fetch with status and duration, which is the
quickest way to confirm the branch is really being used. dev_mode=keep stops a
failed build from deleting the container along with the evidence.

@MickLesk
MickLesk merged commit 3fba487 into community-scripts:main Oct 16, 2026
4 checks passed
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.

apt_conffile_report fails every update with exit 1 on Ubuntu 26.04 (uutils sort and comm disagree on order)

2 participants