Package: command-not-found
Version: 23.04.0-2

When command-not-found has identified a package containing the command I
failed to run, but doesn't believe I have the ability to install that
package myself, it suggests "Please ask your administrator".

However, most of the output goes to standard error, but that one last
message goes to standard output, so when one or other fd is redirected
or piped, the command-not-found display is broken up, and the last line
of it can be misinterpreted as the legitimate output of the actual
command, which in fact never ran at all. Or, if not, it at least ends up
without its context – one sees "Please ask your administrator." and
doesn't know _what_ to ask them.

Surely the final message ought to go to standard error just like
everything else.

Demonstration on a test container with a test user:

stoat@c591b30c69bc:/$ less
Command 'less' not found, but can be installed with:
apt install less
Please ask your administrator.
stoat@c591b30c69bc:/$ less >/dev/null
Command 'less' not found, but can be installed with:
apt install less
stoat@c591b30c69bc:/$ less 2>/dev/null
Please ask your administrator.

Cheers,
Simon

-- 
import hashlib; print((lambda p,q,g,y,r,s,m: (lambda w:(pow(g,int(hashlib.sha1(
m.encode('ascii')).hexdigest(),16)*w%q,p)*pow(y,r*w%q,p)%p)%q)(pow(s,q-2,q))==r
and s%q!=0 and m)(12342649995480866419, 2278082317364501, 1670428356600652640,
5398151833726432125, 645223105888478, 1916678356240619, "<[email protected]>"))

Reply via email to