Accepting request 45640 from Base:System
Copy from Base:System/bash based on submit request 45640 from user WernerFink OBS-URL: https://build.opensuse.org/request/show/45640 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/bash?expand=0&rev=62
This commit is contained in:
commit
a49fa568f6
@ -1,6 +1,25 @@
|
|||||||
|
--- command.h
|
||||||
|
+++ command.h 2010-08-13 16:48:35.739125676 +0200
|
||||||
|
@@ -168,6 +168,7 @@ typedef struct element {
|
||||||
|
#define CMD_STDIN_REDIR 0x400 /* async command needs implicit </dev/null */
|
||||||
|
#define CMD_COMMAND_BUILTIN 0x0800 /* command executed by `command' builtin */
|
||||||
|
#define CMD_COPROC_SUBSHELL 0x1000
|
||||||
|
+#define CMD_SYNC_PIPE 0x2000
|
||||||
|
|
||||||
|
/* What a command looks like. */
|
||||||
|
typedef struct command {
|
||||||
--- execute_cmd.c
|
--- execute_cmd.c
|
||||||
+++ execute_cmd.c 2010-06-24 09:18:46.858925084 +0200
|
+++ execute_cmd.c 2010-08-16 15:40:41.975126155 +0200
|
||||||
@@ -1525,7 +1525,7 @@ static struct cpelement *cpl_search __P(
|
@@ -256,6 +256,8 @@ int match_ignore_case = 0;
|
||||||
|
|
||||||
|
struct stat SB; /* used for debugging */
|
||||||
|
|
||||||
|
+extern void addjstatus(COMMAND *, int);
|
||||||
|
+
|
||||||
|
static int special_builtin_failed;
|
||||||
|
|
||||||
|
static COMMAND *currently_executing_command;
|
||||||
|
@@ -1525,7 +1527,7 @@ static struct cpelement *cpl_search __P(
|
||||||
static struct cpelement *cpl_searchbyname __P((char *));
|
static struct cpelement *cpl_searchbyname __P((char *));
|
||||||
static void cpl_prune __P((void));
|
static void cpl_prune __P((void));
|
||||||
|
|
||||||
@ -9,7 +28,7 @@
|
|||||||
|
|
||||||
cplist_t coproc_list = {0, 0, 0};
|
cplist_t coproc_list = {0, 0, 0};
|
||||||
|
|
||||||
@@ -2047,13 +2047,19 @@ execute_coproc (command, pipe_in, pipe_o
|
@@ -2047,13 +2049,19 @@ execute_coproc (command, pipe_in, pipe_o
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -30,14 +49,16 @@
|
|||||||
COMMAND *cmd;
|
COMMAND *cmd;
|
||||||
struct fd_bitmap *fd_bitmap;
|
struct fd_bitmap *fd_bitmap;
|
||||||
|
|
||||||
@@ -2148,11 +2154,37 @@ execute_pipeline (command, asynchronous,
|
@@ -2148,15 +2156,52 @@ execute_pipeline (command, asynchronous,
|
||||||
/* Now execute the rightmost command in the pipeline. */
|
/* Now execute the rightmost command in the pipeline. */
|
||||||
if (ignore_return && cmd)
|
if (ignore_return && cmd)
|
||||||
cmd->flags |= CMD_IGNORE_RETURN;
|
cmd->flags |= CMD_IGNORE_RETURN;
|
||||||
+
|
+
|
||||||
+ begin_unwind_frame ("pipe-file-descriptors");
|
+ begin_unwind_frame ("pipe-file-descriptors");
|
||||||
+ lstdin = -1;
|
+ lstdin = -1;
|
||||||
+ if (!asynchronous && pipe_out == NO_PIPE && prev > 0)
|
+#if 1
|
||||||
|
+ if (!asynchronous && pipe_out == NO_PIPE && prev > 0
|
||||||
|
+ && cmd->type != cm_subshell && ((cmd->flags & CMD_WANT_SUBSHELL) == 0))
|
||||||
+ {
|
+ {
|
||||||
+ lstdin = move_to_high_fd(0, 0, 255);
|
+ lstdin = move_to_high_fd(0, 0, 255);
|
||||||
+ if (lstdin > 0)
|
+ if (lstdin > 0)
|
||||||
@ -45,10 +66,13 @@
|
|||||||
+ dup2(prev, 0);
|
+ dup2(prev, 0);
|
||||||
+ close(prev);
|
+ close(prev);
|
||||||
+ prev = NO_PIPE;
|
+ prev = NO_PIPE;
|
||||||
+ stop_pipeline (0, (COMMAND *)NULL);
|
+ cmd->flags |= CMD_SYNC_PIPE;
|
||||||
|
+ add_process((char*)0, getpid());
|
||||||
|
+ stop_pipeline (0, cmd);
|
||||||
+ add_unwind_protect (restore_stdin, lstdin);
|
+ add_unwind_protect (restore_stdin, lstdin);
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
|
+#endif
|
||||||
+ if (prev >= 0)
|
+ if (prev >= 0)
|
||||||
+ add_unwind_protect (close, prev);
|
+ add_unwind_protect (close, prev);
|
||||||
+
|
+
|
||||||
@ -68,3 +92,87 @@
|
|||||||
#if defined (JOB_CONTROL)
|
#if defined (JOB_CONTROL)
|
||||||
UNBLOCK_CHILD (oset);
|
UNBLOCK_CHILD (oset);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
+ if (cmd->flags & CMD_SYNC_PIPE)
|
||||||
|
+ {
|
||||||
|
+ addjstatus(cmd, exec_result);
|
||||||
|
+ cmd->flags &= ~CMD_SYNC_PIPE;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
QUIT;
|
||||||
|
return (exec_result);
|
||||||
|
}
|
||||||
|
--- jobs.c
|
||||||
|
+++ jobs.c 2010-08-16 15:48:19.479125702 +0200
|
||||||
|
@@ -260,7 +260,6 @@ static int processes_in_job __P((int));
|
||||||
|
static void realloc_jobs_list __P((void));
|
||||||
|
static int compact_jobs_list __P((int));
|
||||||
|
static int discard_pipeline __P((PROCESS *));
|
||||||
|
-static void add_process __P((char *, pid_t));
|
||||||
|
static void print_pipeline __P((PROCESS *, int, int, FILE *));
|
||||||
|
static void pretty_print_job __P((int, int, FILE *));
|
||||||
|
static void set_current_job __P((int));
|
||||||
|
@@ -1065,7 +1064,7 @@ nohup_job (job_index)
|
||||||
|
if (js.j_jobslots == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
- if (temp = jobs[job_index])
|
||||||
|
+ if ((temp = jobs[job_index]))
|
||||||
|
temp->flags |= J_NOHUP;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -1095,7 +1094,7 @@ discard_pipeline (chain)
|
||||||
|
/* Add this process to the chain being built in the_pipeline.
|
||||||
|
NAME is the command string that will be exec'ed later.
|
||||||
|
PID is the process id of the child. */
|
||||||
|
-static void
|
||||||
|
+void
|
||||||
|
add_process (name, pid)
|
||||||
|
char *name;
|
||||||
|
pid_t pid;
|
||||||
|
@@ -3396,6 +3395,34 @@ setjstatus (j)
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+addjstatus(COMMAND *deferred, int status)
|
||||||
|
+{
|
||||||
|
+#if defined (ARRAY_VARS)
|
||||||
|
+ int i;
|
||||||
|
+ JOB *j;
|
||||||
|
+ for (j = jobs[(i = 0)]; j && j->deferred != deferred; j = jobs[(++i)])
|
||||||
|
+ ;
|
||||||
|
+ if (!j || !j->deferred)
|
||||||
|
+ return;
|
||||||
|
+ j->deferred = (COMMAND*)0;
|
||||||
|
+ if (status)
|
||||||
|
+ {
|
||||||
|
+ PROCESS *p, *l;
|
||||||
|
+ p = j->pipe;
|
||||||
|
+ do
|
||||||
|
+ {
|
||||||
|
+ l = p;
|
||||||
|
+ p = p->next;
|
||||||
|
+ }
|
||||||
|
+ while (p != j->pipe);
|
||||||
|
+ l->status = status << 8;
|
||||||
|
+ }
|
||||||
|
+ setjstatus(i);
|
||||||
|
+#endif
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
void
|
||||||
|
run_sigchld_trap (nchild)
|
||||||
|
int nchild;
|
||||||
|
--- jobs.h
|
||||||
|
+++ jobs.h 2010-08-16 15:47:22.463125472 +0200
|
||||||
|
@@ -177,6 +177,8 @@ extern void save_pipeline __P((int));
|
||||||
|
extern void restore_pipeline __P((int));
|
||||||
|
extern void start_pipeline __P((void));
|
||||||
|
extern int stop_pipeline __P((int, COMMAND *));
|
||||||
|
+extern void add_process __P((char *, pid_t));
|
||||||
|
+extern void addjstatus __P((COMMAND *, int));
|
||||||
|
|
||||||
|
extern void delete_job __P((int, int));
|
||||||
|
extern void nohup_job __P((int));
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Aug 16 15:50:43 CEST 2010 - werner@suse.de
|
||||||
|
|
||||||
|
- A modified version of the pipe patch which should handle
|
||||||
|
the PIPESTATUS array
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Fri Aug 13 14:19:02 CEST 2010 - werner@suse.de
|
Fri Aug 13 14:19:02 CEST 2010 - werner@suse.de
|
||||||
|
|
||||||
|
14
bash.spec
14
bash.spec
@ -36,7 +36,7 @@ Suggests: bash-doc = %bash_vers
|
|||||||
%endif
|
%endif
|
||||||
AutoReqProv: on
|
AutoReqProv: on
|
||||||
Version: 4.1
|
Version: 4.1
|
||||||
Release: 13
|
Release: 14
|
||||||
Summary: The GNU Bourne-Again Shell
|
Summary: The GNU Bourne-Again Shell
|
||||||
Url: http://www.gnu.org/software/bash/bash.html
|
Url: http://www.gnu.org/software/bash/bash.html
|
||||||
Source0: ftp://ftp.gnu.org/gnu/bash/bash-%{bash_vers}.tar.bz2
|
Source0: ftp://ftp.gnu.org/gnu/bash/bash-%{bash_vers}.tar.bz2
|
||||||
@ -104,7 +104,7 @@ Group: Documentation/Man
|
|||||||
Provides: bash:%{_infodir}/bash.info.gz
|
Provides: bash:%{_infodir}/bash.info.gz
|
||||||
PreReq: %install_info_prereq
|
PreReq: %install_info_prereq
|
||||||
Version: 4.1
|
Version: 4.1
|
||||||
Release: 13
|
Release: 14
|
||||||
AutoReqProv: on
|
AutoReqProv: on
|
||||||
%if %suse_version > 1120
|
%if %suse_version > 1120
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
@ -140,7 +140,7 @@ License: GPLv2+
|
|||||||
Summary: Include Files mandatory for Development of bash loadable builtins
|
Summary: Include Files mandatory for Development of bash loadable builtins
|
||||||
Group: Development/Languages/C and C++
|
Group: Development/Languages/C and C++
|
||||||
Version: 4.1
|
Version: 4.1
|
||||||
Release: 13
|
Release: 14
|
||||||
AutoReqProv: on
|
AutoReqProv: on
|
||||||
|
|
||||||
%description -n bash-devel
|
%description -n bash-devel
|
||||||
@ -160,7 +160,7 @@ License: GPLv2+
|
|||||||
Summary: Loadable bash builtins
|
Summary: Loadable bash builtins
|
||||||
Group: System/Shells
|
Group: System/Shells
|
||||||
Version: 4.1
|
Version: 4.1
|
||||||
Release: 13
|
Release: 14
|
||||||
AutoReqProv: on
|
AutoReqProv: on
|
||||||
|
|
||||||
%description -n bash-loadables
|
%description -n bash-loadables
|
||||||
@ -229,7 +229,7 @@ Summary: The Readline Library
|
|||||||
Group: System/Libraries
|
Group: System/Libraries
|
||||||
Provides: bash:/%{_lib}/libreadline.so.%{rl_major}
|
Provides: bash:/%{_lib}/libreadline.so.%{rl_major}
|
||||||
Version: 6.1
|
Version: 6.1
|
||||||
Release: 13
|
Release: 14
|
||||||
%if %suse_version > 1020
|
%if %suse_version > 1020
|
||||||
Recommends: readline-doc = %{version}
|
Recommends: readline-doc = %{version}
|
||||||
%endif
|
%endif
|
||||||
@ -260,7 +260,7 @@ Summary: Include Files and Libraries mandatory for Development
|
|||||||
Group: Development/Libraries/C and C++
|
Group: Development/Libraries/C and C++
|
||||||
Provides: bash:%{_libdir}/libreadline.a
|
Provides: bash:%{_libdir}/libreadline.a
|
||||||
Version: 6.1
|
Version: 6.1
|
||||||
Release: 13
|
Release: 14
|
||||||
Requires: libreadline6 = %{version}
|
Requires: libreadline6 = %{version}
|
||||||
Requires: ncurses-devel
|
Requires: ncurses-devel
|
||||||
%if %suse_version > 1020
|
%if %suse_version > 1020
|
||||||
@ -291,7 +291,7 @@ Group: System/Libraries
|
|||||||
Provides: readline:%{_infodir}/readline.info.gz
|
Provides: readline:%{_infodir}/readline.info.gz
|
||||||
PreReq: %install_info_prereq
|
PreReq: %install_info_prereq
|
||||||
Version: 6.1
|
Version: 6.1
|
||||||
Release: 13
|
Release: 14
|
||||||
AutoReqProv: on
|
AutoReqProv: on
|
||||||
%if %suse_version > 1120
|
%if %suse_version > 1120
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
|
Loading…
Reference in New Issue
Block a user