SHA256
3
0
forked from pool/bash
OBS User unknown 2008-07-24 20:02:31 +00:00 committed by Git OBS Bridge
parent 1e9219bc66
commit e0417322d8
3 changed files with 78 additions and 5 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Thu Jul 24 16:41:41 CEST 2008 - werner@suse.de
- Add command-not-found.patch for scout support (fate#303730)
-------------------------------------------------------------------
Tue Jun 17 11:05:07 CEST 2008 - werner@suse.de

View File

@ -18,9 +18,10 @@ Group: System/Shells
%define bash_vers 3.2
%define rl_vers 5.2
Recommends: bash-doc = %bash_vers
Suggests: scout
AutoReqProv: on
Version: 3.2
Release: 114
Release: 119
Summary: The GNU Bourne-Again Shell
Url: http://www.gnu.org/software/bash/bash.html
Source0: bash-%{bash_vers}.tar.bz2
@ -51,6 +52,7 @@ Patch21: readline-4.3-input.dif
Patch22: readline-5.2-wrap.patch
Patch23: readline-5.2-conf.patch
Patch30: readline-5.1-destdir.patch
Patch40: command-not-found.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%global _sysconfdir /etc
%global _incdir %{_includedir}
@ -76,7 +78,7 @@ Group: Documentation/Man
Provides: bash:%{_infodir}/bash.info.gz
PreReq: %install_info_prereq
Version: 3.2
Release: 73
Release: 78
AutoReqProv: on
%description -n bash-doc
@ -96,7 +98,7 @@ Summary: The Readline Library
Group: System/Libraries
Provides: bash:/%{_lib}/libreadline.so.5
Version: 5.2
Release: 73
Release: 78
Recommends: readline-doc = %{version}
Provides: readline = 5.2
Obsoletes: readline <= 5.2
@ -120,7 +122,7 @@ Summary: Include Files and Libraries mandatory for Development
Group: Development/Libraries/C and C++
Provides: bash:%{_libdir}/libreadline.a
Version: 5.2
Release: 114
Release: 119
Requires: libreadline5 = %{version}
Requires: ncurses-devel
Recommends: readline-doc = %{version}
@ -144,7 +146,7 @@ Group: System/Libraries
Provides: readline:%{_infodir}/readline.info.gz
PreReq: %install_info_prereq
Version: 5.2
Release: 73
Release: 78
AutoReqProv: on
%description -n readline-doc
@ -183,6 +185,7 @@ unset p
%patch21 -p0 -b .zerotty
%patch22 -p0 -b .wrap
%patch23 -p0 -b .conf
%patch40 -p0 -b .cmdnotfnd
%patch0 -p0
cd ../readline-%{rl_vers}
for p in ../readline-%{rl_vers}-patches/*; do
@ -421,6 +424,8 @@ EOF
%doc %{_defaultdocdir}/readline/
%changelog
* Thu Jul 24 2008 werner@suse.de
- Add command-not-found.patch for scout support (fate#303730)
* Tue Jun 17 2008 werner@suse.de
- Avoid underline the full paragraph in the man page (bnc#400767)
* Sat May 17 2008 coolo@suse.de

63
command-not-found.patch Normal file
View File

@ -0,0 +1,63 @@
--- doc/bash.1
+++ doc/bash.1
@@ -2035,6 +2035,13 @@
be a prefix of a stopped job's name; this provides functionality
analogous to the \fB%\fP\fIstring\fP job identifier.
.TP
+.B command_not_found_handle
+The name of a shell function to be called if a command cannot be
+found. The return value of this function should be 0, if the command
+is available after execution of the function, otherwise 127 (EX_NOTFOUND).
+Enabled only in interactive, non POSIX mode shells. This is a Debian
+extension.
+.TP
.B histchars
The two or three characters which control history expansion
and tokenization (see
--- doc/bashref.texi
+++ doc/bashref.texi
@@ -4809,6 +4809,13 @@
@item UID
The numeric real user id of the current user. This variable is readonly.
+@item command_not_found_handle
+The name of a shell function to be called if a command cannot be
+found. The return value of this function should be 0, if the command
+is available after execution of the function, otherwise 127 (EX_NOTFOUND).
+Enabled only in interactive, non POSIX mode shells. This is a Debian
+extension.
+
@end vtable
@node Bash Features
--- execute_cmd.c
+++ execute_cmd.c
@@ -3722,8 +3722,26 @@
if (command == 0)
{
- internal_error (_("%s: command not found"), pathname);
- exit (EX_NOTFOUND); /* Posix.2 says the exit status is 127 */
+ SHELL_VAR *f, *v;
+ WORD_LIST *cmdlist;
+ WORD_DESC *w;
+ int fval;
+ if( (posixly_correct || interactive_shell == 0) ||
+ (f = find_function ("command_not_found_handle")) == 0)
+ {
+ internal_error (_("%s: command not found"), pathname);
+ exit (EX_NOTFOUND); /* Posix.2 says the exit status is 127 */
+ }
+ w = make_word("command_not_found_handle");
+ cmdlist = make_word_list(w, (WORD_LIST*)NULL);
+
+ w = make_word(pathname);
+ cmdlist->next = make_word_list(w, (WORD_LIST*)NULL);
+
+ fval = execute_shell_function (f, cmdlist);
+ if (fval == EX_NOTFOUND)
+ internal_error (_("%s: command not found"), pathname);
+ exit(fval);
}
/* Execve expects the command name to be in args[0]. So we