Repository navigation
fix(PackageKit): stop command-not-found recursing without gettext - #20628
Open
Muhammad Falak R Wani (mfrw) wants to merge 1 commit into
Open
Muhammad Falak R Wani (mfrw) wants to merge 1 commit into
Muhammad Falak R Wani (mfrw) wants to merge 1 commit into
Conversation
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>
Member
Author
|
/azp run |
|
Azure Pipelines: 2 pipeline(s) were filtered out due to trigger conditions. |
Contributor
There was a problem hiding this comment.
🟢 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
Patch0502so 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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