pk-command-not-found typically returns before doing anything useful for me, but it always returns 0, which is success in shell. This would be really bad if one was depending on the return status of the command to decide what to do next.
$ really_important_command_i_need_to_succeed && echo $?
bash: really_important_command_i_need_to_succeed: command not found...
I haven't figured out exactly why it returns without doing anything useful (suspect timeout), but it should return 127 (command not found) unless it actually installed the program and ran it. This is on F16 with PackageKit-command-not-found-0.6.21-2.fc16.x86_64.
Created attachment 56581 [details] [review]
[PATCH] cnf: Default to exit code 127 for command not found
The only way success should be returned is if there was no input or if
the command was installed and run successfully. All other exit paths
should return the shell's command not found code of 127.
contrib/command-not-found/pk-command-not-found.c | 23 +++++----------------
1 files changed, 6 insertions(+), 17 deletions(-)
Patch was tested on 0.6.21. The only conflict forward porting to master was egg_strlen vs strlen.
We moved the upstream bugtracker to GitHub a long time ago. If this issue still affects you please re-create the issue here: https://github.com/hughsie/PackageKit/issues
Sorry for the impersonal message, and fingers crossed your issue no longer happens. Thanks.