bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

BASh Restrictions on use of "wait" Builtin Excessively Restrictive


From: Jakub Sadowski
Subject: BASh Restrictions on use of "wait" Builtin Excessively Restrictive
Date: Thu, 25 Oct 2007 15:54:19 -0600

Machine: i586

OS: linux-gnu

Compiler: gcc

Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i586'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i586-mandriva-linux-gnu'
-DCONF_VENDOR='mandriva' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash'
-DSHELL -DHAVE_CONFIG_H   -I.  -I.. -I../include -I../lib   -O2  -pipe
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fomit-frame-pointer -march=i586
-mtune=pentiumpro -fasynchronous-unwind-tables
uname output: Linux localhost 2.6.18.8.tex5 #1 SMP Thu May 10 11:36:58 WST
2007 i686 Intel(R) Pentium(R) 4 CPU 3.00GHz GNU/Linux
Machine Type: i586-mandriva-linux-gnu

Bash Version: 3.1

Patch Level: 17

Release Status: release


Description:
The bash shell restricts the wait builtin to operating on child processes of
the current shell or script.  This is an excessive restriction as it should
be
restricted to processes owned by the same user as that of the current shell
or
script.

Crude but equivalent functionality can be achieved with (but shouldn't need
to
be worked around with using such a kludge):
while kill -CONT [pid] 1>/dev/null 2>&1; do sleep 1; done


Repeat-By:
To see the restriction in action:
1. Do a "ps -ef | grep $USER"
2. Select a pid from the list of processes
3. Do a "wait [pidnum]" on the chosen pid.

Actual Results:
The builtin fails with "bash: wait: pid [pid] is not a child of this shell"

Expected Results:
The shell should wait until the process exits as long as the process is
owned
by the same user.

This can be attempted with the script sample above and will not fail as long
as
user can send signals to (i.e. "owns") the process in question.


Fix:
This restriction should be more appropriate.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]