Bug 45598 - pk-command-not-found should default to return 127
Summary: pk-command-not-found should default to return 127
Status: RESOLVED NOTABUG
Alias: None
Product: PackageKit
Classification: Unclassified
Component: General (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Richard Hughes
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-03 08:51 UTC by Dan Nicholson
Modified: 2018-08-21 15:52 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
[PATCH] cnf: Default to exit code 127 for command not found (3.26 KB, patch)
2012-02-03 10:38 UTC, Dan Nicholson
Details | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Dan Nicholson 2012-02-03 08:51:34 UTC
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...
0

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.
Comment 1 Dan Nicholson 2012-02-03 10:38:54 UTC
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(-)
Comment 2 Dan Nicholson 2012-02-03 10:40:25 UTC
Patch was tested on 0.6.21. The only conflict forward porting to master was egg_strlen vs strlen.
Comment 3 Richard Hughes 2018-08-21 15:52:31 UTC
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.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.