Bug 98175

Summary: pk-command-not-found does not handle PATH without /sbin very cleanly
Product: PackageKit Reporter: Matthew Miller <mattdm>
Component: GeneralAssignee: Richard Hughes <richard>
Status: NEEDINFO --- QA Contact:
Severity: trivial    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Matthew Miller 2016-10-09 19:12:09 UTC
Because I'm old-school, I don't have /usr/sbin or /sbin in my $PATH. That makes tab-completion work better with less in the namespace for the normal case, and sudo has /sbin in _its_ path, and the tab completion for sudo understands that, so generally, no problem.

However, pk-command-not-found occasionally gives funny results in this case. For example:

$ reboot
bash: reboot: command not found...
Similar command is: 'reboot'

or

$ ip
bash: ip: command not found...
Install package 'iproute' to provide command 'ip'? [N/y] y
 * Waiting in queue... 
 * Loading list of packages.... Failed to install packages: iproute-4.6.0-1.fc25.x86_64 is already installed


The easiest fix, I think, would be a simple check for [/usr]/sbin not being in the path, and in that case, give results like:

$ reboot
bash: reboot: command not found...
Perhaps you meant: '/sbin/reboot'

$ ip
bash: ip: command not found...
Perhaps you meant: '/sbin/ip'
Comment 1 Richard Hughes 2016-10-10 16:51:25 UTC
Is running without /sbin in PATH common? I guess we could add extra code to handle different paths being not in PATH, although I don't want to add extra code if it's not a common set up.
Comment 2 Matthew Miller 2016-10-10 19:41:52 UTC
(In reply to Richard Hughes from comment #1)
> Is running without /sbin in PATH common? I guess we could add extra code to
> handle different paths being not in PATH, although I don't want to add extra
> code if it's not a common set up.

In Fedora, it's likely to be only cranky old sysadmins like me. :)

However, it's the default for non-root users on Debian, so I expect it's pretty common in the world.

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.