Fedora Account System
Red Hat Associate
Red Hat Customer
User-Agent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:66.0) Gecko/20100101 Firefox/66.0 Build Identifier: When using mksh, a newly launched gnome-terminal (with the login shell option on) will display this message before the command prompt: mksh: /etc/profile.d/PackageKit.sh[14]: syntax error: unexpected operator/operand '=~' Reproducible: Always Steps to Reproduce: 1. Make mksh the user's default shell. 2. Launch gnome-terminal (as a login shell). Actual Results: gnome-terminal displays: mksh: /etc/profile.d/PackageKit.sh[14]: syntax error: unexpected operator/operand '=~' fedora$ Expected Results: Simply displayed the command prompt.
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.