Merge lp:~dholbach/command-not-found/1479805 into lp:~command-not-found-developers/command-not-found/trunk

Proposed by Daniel Holbach
Status: Needs review
Proposed branch: lp:~dholbach/command-not-found/1479805
Merge into: lp:~command-not-found-developers/command-not-found/trunk
Diff against target: 46 lines (+18/-12)
2 files modified
bash_command_not_found (+11/-8)
zsh_command_not_found (+7/-4)
To merge this branch: bzr merge lp:~dholbach/command-not-found/1479805
Reviewer Review Type Date Requested Status
CarstenHey (community) Approve
Command Not Found Developers Pending
Review via email: mp+275678@code.launchpad.net

Commit message

* bash_command_not_found:
      - Print an error message if a command is not found, and the package
        has been removed but not purged. (LP: #1479805)
      - Do not define the handler function if the package has been
        removed.
      - Do not define the handler function if the shell is not
        interactive.
  * zsh_command_not_found:
      - Do not define the handler function if the shell is not
        interactive.
      - Reindent file in order to fit on an 80 characters wide terminal
        without line wrapping.

To post a comment you must log in.
Revision history for this message
CarstenHey (c.hey) wrote :

Hi,

thanks for putting all this into a merge request :)

You copied my error into the bash part of the commit message, this:

| - Do not define the handler function if the shell is interactive.

should be:

| - Do not define the handler function if the shell is not interactive.

Also, this part is missing in the commit message (but the fix is
upstream only, to fix it in Ubuntu, the bash package has to be
adapted):

| - Don't run command-not-found if bash_completion is used.

Changing the merge request just because of an suboptimal commit
message (JFTR: this was my fault) might be a waste of time, though.

The reason I choose to abstain instead of to approve is because
the Ubuntu package already contains a fixed zsh_command_not_found,
to which this merge request adds some minor improvements. If merging
from the package to upstream first avoids a merge conflict, then
doing so might be a good idea - since I lack some essential
launchpad related knowledge, I'm not able to judge this.

The changelog entry of the previous upload to wily is:

  [ Carsten Hey ]
  * Update /etc/zsh_command_not_found:
    - Don't overwrite an already defined command-not-found handler.
    - Don't try to run command-not-found if the package has been
      removed since the shell has been started.

  [ Michael Vogt ]
  * updated for latest wily

 -- Michael Vogt <email address hidden> Tue, 21 Jul 2015 08:02:05 +0200

Even though the actual bug does not affect the Ubuntu package,
I think this patch should be applied - I just don't know which
way the former change to zsh_command_not_found should be merged
(actually, the new file should replace the old one, but bzr does
not know that).

Regards
Carsten

review: Abstain
Revision history for this message
CarstenHey (c.hey) wrote :

I could change this to "approve" if the possible merge conflict in the package is not an relevant issue for you or mvo, and if it makes any difference if I abstain or approve.

Revision history for this message
CarstenHey (c.hey) wrote :

I think the possible merge conflict is not relevant in practice

review: Approve

Unmerged revisions

157. By Daniel Holbach

Apply patches from Carsten Hey from LP: #1479805

  * bash_command_not_found:
      - Print an error message if a command is not found, and the package
        has been removed but not purged. (LP: #1479805)
      - Do not define the handler function if the package has been removed.
      - Do not define the handler function if the shell is interactive.
  * zsh_command_not_found:
      - Do not define the handler function if the shell is not interactive.
      - Reindent file in order to fit on an 80 characters wide terminal without
        line wrapping.

156. By Zygmunt Krynicki

Merge locale fix from Anthony Wong

155. By Zygmunt Krynicki

Merge fix for python3 support

154. By Michael Vogt

setup.py: call version 0.3 as its a python*3* verison ;)

153. By Michael Vogt

merged python3 port lp:~cjwatson/command-not-found/python3, thanks to Colin Watson

152. By Zygmunt Krynicki

Merge support for building pot files when running ./setup.py sdist

151. By Michael Vogt

merge from ubuntu but remove fixes we don't need

150. By Michael Vogt

cherry pick fixes from ubuntu

149. By Michael Vogt

merged lp:~mvo/command-not-found/remove-debian-dir

148. By Michael Vogt

merged lp:~mvo/command-not-found/install-prompt-env

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bash_command_not_found'
2--- bash_command_not_found 2012-06-13 15:03:33 +0000
3+++ bash_command_not_found 2015-10-26 10:26:51 +0000
4@@ -4,11 +4,14 @@
5 # This script will look-up command in the database and suggest
6 # installation of packages available from the repository
7
8-command_not_found_handle() {
9- if [ -x /usr/lib/command-not-found ]; then
10- /usr/lib/command-not-found -- "$1"
11- return $?
12- else
13- return 127
14- fi
15-}
16+if [[ -n "${PS1-}" && -x /usr/lib/command-not-found ]]; then
17+ function command_not_found_handle() {
18+ local FUNCNEST=5
19+ if [[ -z "${COMP_CWORD+set}" && -x /usr/lib/command-not-found ]]; then
20+ /usr/lib/command-not-found -- ${1+"$1"} || return $?
21+ else
22+ printf >&2 'bash: %scommand not found\n' ${1+"$1: "} || true
23+ return 127
24+ fi
25+ }
26+fi
27
28=== modified file 'zsh_command_not_found'
29--- zsh_command_not_found 2011-08-26 00:04:02 +0000
30+++ zsh_command_not_found 2015-10-26 10:26:51 +0000
31@@ -4,8 +4,11 @@
32 # This script will look-up command in the database and suggest
33 # installation of packages available from the repository
34
35-if [[ -x /usr/lib/command-not-found ]] ; then
36- function command_not_found_handler() {
37- /usr/lib/command-not-found --no-failure-msg -- $1
38- }
39+if (( ! ${+functions[command_not_found_handler]} )) &&
40+ [[ -n ${PS1-} && -x /usr/lib/command-not-found ]]
41+then
42+ function command_not_found_handler {
43+ [[ -x /usr/lib/command-not-found ]] &&
44+ /usr/lib/command-not-found --no-failure-msg -- ${1+"$1"} && return 1
45+ }
46 fi

Subscribers

People subscribed via source and target branches