Skip to content

fix(PackageKit): stop command-not-found recursing without gettext - #20628

Open
Muhammad Falak R Wani (mfrw) wants to merge 1 commit into
4.0from
mfrw/packagekit-cnf-gettext-recursion
Open

Muhammad Falak R Wani (mfrw) wants to merge 1 commit into
4.0from
mfrw/packagekit-cnf-gettext-recursion

Conversation

@mfrw

@mfrw Muhammad Falak R Wani (mfrw) commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

The non-interactive fallback in /etc/profile.d/PackageKit.sh prints its
message with "$(gettext PackageKit 'command not found')". When gettext
is not in PATH, that lookup re-enters command_not_found_handle, which
takes the same branch and forks again without bound. On an image
without gettext-runtime, such as the WSL image, one missing command in
a non-interactive login shell (bash -lc, sudo -i, su -) exhausts the
process table.

Backport the upstream fix (PackageKit/PackageKit#1052): call gettext
only when "type -P" finds it, and print the untranslated message
otherwise. Register it as Patch0502, in the spec's proposed-upstream
range. patch-add would pick Patch3002, which falls in the RHEL-only
%autopatch range and is never applied here.

Move PackageKit into its own comp.toml to carry the overlay.

Tested with the rebuilt 1.3.6-3 on the Azure Linux 4 WSL rootfs:
"bash -lc strace" now prints a single "command not found" and returns
127, where 1.3.6-2 spawned 300+ nested shells until it hit the PID
limit. Interactive shells still offer to install the package.

Signed-off-by: Muhammad Falak R Wani falakreyaz@gmail.com

Fixes: https://mariner-org.visualstudio.com/mariner/_workitems/edit/25555

The non-interactive fallback in /etc/profile.d/PackageKit.sh prints its
message with "$(gettext PackageKit 'command not found')". When gettext
is not in PATH, that lookup re-enters command_not_found_handle, which
takes the same branch and forks again without bound. On an image
without gettext-runtime, such as the WSL image, one missing command in
a non-interactive login shell (bash -lc, sudo -i, su -) exhausts the
process table.

Backport the upstream fix (PackageKit/PackageKit#1052): call gettext
only when "type -P" finds it, and print the untranslated message
otherwise. Register it as Patch0502, in the spec's proposed-upstream
range. patch-add would pick Patch3002, which falls in the RHEL-only
%autopatch range and is never applied here.

Move PackageKit into its own comp.toml to carry the overlay.

Tested with the rebuilt 1.3.6-3 on the Azure Linux 4 WSL rootfs:
"bash -lc strace" now prints a single "command not found" and returns
127, where 1.3.6-2 spawned 300+ nested shells until it hit the PID
limit. Interactive shells still offer to install the package.

Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
@mfrw
Muhammad Falak R Wani (mfrw) requested a review from a team as a code owner December 1, 2026 10:17
Copilot AI balanced review requested due to automatic review settings December 1, 2026 10:17
@mfrw

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
2 pipeline(s) were filtered out due to trigger conditions.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues remain for the PackageKit command-not-found fallback fix.

No open issues 🎉

What changed in this PR

This PR fixes PackageKit’s command-not-found fallback on Azure Linux images without gettext, preventing recursive shell creation and process exhaustion.

Changes:

  • Adds a patch that checks for gettext before calling it and otherwise prints an untranslated message.
  • Moves PackageKit into a dedicated component definition and registers the patch as Patch0502 so it applies unconditionally.
  • Refreshes the lock fingerprint and rendered package inputs for release 1.3.6-3.
File Description
specs/​p/​PackageKit/​PackageKit.spec Registers the patch and updates the generated release and changelog.
specs/​p/​PackageKit/​command-not-found-dont-recurse-without-gettext.patch Includes the rendered recursion fix.
locks/​PackageKit.lock Refreshes the component input fingerprint.
base/​comps/​PackageKit/​PackageKit.comp.toml Defines PackageKit separately to support its overlay.
base/​comps/​PackageKit/​overlays/​0001-command-not-found-no-gettext-recursion.overlay.toml Adds the patch file and registers Patch0502.
base/​comps/​PackageKit/​command-not-found-dont-recurse-without-gettext.patch Guards gettext execution in the fallback handler.
base/​comps/​components.toml Removes the relocated inline PackageKit definition.

Review effort: Balanced

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants