[Bug 520096] Re: for zsh cnf_command is populated with incorrect value
Alex Jurkiewicz
alex at bluebottle.net.au
Thu Aug 11 02:08:44 UTC 2011
Attached patch uses the zsh command_not_found_handler function which
works the same as command_not_found_handle in bash. It's been in zsh
since v3 (I didn't bother testing any zsh but the latest 4.3).
Patch does something slightly different from the bash file: instead of
testing every time the function runs that [ -x command-not-found ] it's
just done once at initialisation, and the function is defined if so.
Less work done this way, although users will get strange errors after
uninstalling command-not-found until they restart their shell.
** Patch added: "patch-improve-zsh-integration.diff"
https://bugs.launchpad.net/command-not-found/+bug/520096/+attachment/2267337/+files/patch-improve-zsh-integration.diff
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to command-not-found in Ubuntu.
https://bugs.launchpad.net/bugs/520096
Title:
for zsh cnf_command is populated with incorrect value
Status in Automatic command lookup from available packages:
In Progress
Status in “command-not-found” package in Ubuntu:
In Progress
Bug description:
Binary package hint: command-not-found
for 'echo|cat' cnf_command is assigned value 'echo|cat'. Expected
assignment is 'echo'.
Example:
[ytti at lintukoto ~/tmp/FOO]% ls
[ytti at lintukoto ~/tmp/FOO]% find|grep foo
find|grep: command not found
[1 ytti at lintukoto ~/tmp/FOO]% find |grep foo
[1 ytti at lintukoto ~/tmp/FOO]% function cnf_preexec() {
function> typeset -g cnf_command="${2%% *}"
function> }
[ytti at lintukoto ~/tmp/FOO]% find|grep foo
[1 ytti at lintukoto ~/tmp/FOO]%
It is important to test with command which returns non-true value. Above it is unexpected that 'find|grep' is printed with 'command not found' obviously such command does not exist.
"${1%% *}" appears to want white-space or new line to split, ending command with | will incorrectly continue match further
Note, I'm not ZSH literate, I'm not recommending that the fix presented above is used as-is.
ProblemType: Bug
Architecture: amd64
CheckboxSubmission: 27ea4f2fd44978993c33d11dbccf69e2
CheckboxSystem: b845c366ea09c60efa3a45c1b5b21525
Date: Wed Feb 10 23:03:46 2010
DistroRelease: Ubuntu 10.04
Package: command-not-found 0.2.40ubuntu1
PackageArchitecture: all
ProcVersionSignature: Ubuntu 2.6.32-12.17-generic
SourcePackage: command-not-found
Uname: Linux 2.6.32-12-generic x86_64
To manage notifications about this bug go to:
https://bugs.launchpad.net/command-not-found/+bug/520096/+subscriptions
More information about the foundations-bugs
mailing list