Bug 1699038
| Summary: | syntax error in /etc/profile.d/PackageKit.sh | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Micah Muer <micah_bugzilla> |
| Component: | PackageKit | Assignee: | Richard Hughes <rhughes> |
| Status: | CLOSED RAWHIDE | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | low | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 30 | CC: | jonathan, klember, mhlavink, mihai, rdieter, redhat-bugzilla, rhughes, smparrish, tg |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | PackageKit-command-not-found-1.1.13-2.fc32 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2020-04-30 23:50:43 UTC | Type: | --- |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
|
Description
Micah Muer
2019-04-11 15:32:12 UTC
From my point of view, this is a bug in /etc/profile.d/PackageKit.sh as shipped by the PackageKit-command-not-found RPM package caused by using bashisms. 14: [[ $- =~ i ]] || runcnf=0 Yes, a totally clear bashism. The Korn shell equivalent is:
[[ $- = *i* ]] || runcnf=0
Stuff in /etc/profile.d/ must run with all POSIX-compatible shells, so you want this instead:
case $- in
(*i*) ;;
(*) runcnf=0 ;;
esac
Feel free to forward this fix to the PackageKit people.
Given /etc/profile.d/PackageKit.sh consists out of pure bashism currently, here's a proposal (POSIX sh plus "local") by Thorsten:
--- 8< ---
# Copyright (C) 2008 Richard Hughes <richard>
# Copyright © 2019 mirabilos <m>
#
# Licensed under the GNU General Public License Version 2
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
command_not_found_handle() {
local runcnf=1
local retval=127
# only search for the command if we're interactive
case $- in
(*i*) ;;
(*) runcnf=0
esac
# don't run if DBus isn't running
test -S /run/dbus/system_bus_socket || runcnf=0
# don't run if packagekitd doesn't exist in the _system_ root
test -x /usr/libexec/packagekitd || runcnf=0
# don't run if bash command completion is being run
test -z "${COMP_CWORD-}" || runcnf=0
# don't run if we've been uninstalled since the shell was launched
test -x /usr/libexec/pk-command-not-found || runcnf=0
# run the command, or just print a warning
if test $runcnf -eq 1; then
'/usr/libexec/pk-command-not-found' "$@"
retval=$?
elif test -n "${BASH_VERSION-}"; then
printf >&2 'bash: %scommand not found\n' "${1:+$1: }"
fi
# return success or failure
return $retval
}
if test -n "${ZSH_VERSION-}"; then
command_not_found_handler() {
command_not_found_handle "$@" && return 127
}
fi
--- 8< ---
Alternatively, insert the following line at the very first beginning (maybe even the better solution):
--- 8< ---
test -n "${BASH_VERSION-}${ZSH_VERSION-}" || return 0
--- 8< ---
This message is a reminder that Fedora 30 is nearing its end of life. Fedora will stop maintaining and issuing updates for Fedora 30 on 2020-05-26. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as EOL if it remains open with a Fedora 'version' of '30'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version. Thank you for reporting this issue and we are sorry that we were not able to fix it before Fedora 30 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged change the 'version' to a later Fedora version prior this bug is closed as described in the policy above. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete. This was changed to a compatible syntax in the latest package (thanks Robert!) so the bug can be closed. |