bug-bash
[Top][All Lists]
Advanced

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

Bash: Issue with 'sleep' execution in bash loadable builtins


From: Thiruvadi Rajaraman
Subject: Bash: Issue with 'sleep' execution in bash loadable builtins
Date: Mon, 4 Dec 2017 17:30:08 +0530

Hi,

Found the issue with sleep execution with bash loadable builtins which
failed to sleep for specified amount of time. The rootcause for the sleep
execution failure found with select() function (in  lib/sh/ufunc.c) which
is interrupted by SIGCHLD signal.

Followings are host, reproduction steps, logs and fix patch.


Bash version:  4.2, 4.4 ( Found in latest bash version)

Host machine: Ubuntu-14.04,  x86_64

Reproduction steps:

# cd bash-4.4;
# ./configure; make; cd examples/loadables/; make;
# cd ../../
# ./bash
(bash shell)

# enable -f examples/loadables/sleep sleep
# date; sleep 1 & date; sleep 4; date

logs: (failure log)
------
bash-4.4-rc1/examples/loadables# date; sleep 1 & date; sleep 4; date
Mon Nov 27 17:00:01 IST 2017
[1] 5355
Mon Nov 27 17:00:01 IST 2017
Mon Nov 27 17:00:02 IST 2017    --------------> Took 1 Sec only instead of
4 Sec's.
[1]+  Done                    sleep 1


Fix patch:
========
An issue fixed by blocking the SIGCHLD signal during sleep process.

Attached the fix patch for your kind reference.


logs: ( with fix patch)
------

bash-4.2#
bash-4.2# date; sleep 1 & date; sleep 6 & date; sleep 4; date
Mon Dec  4 16:04:00 IST 2017
[1] 14674
Mon Dec  4 16:04:00 IST 2017
[2] 14676
Mon Dec  4 16:04:00 IST 2017
Mon Dec  4 16:04:04 IST 2017
[1]-  Done                    sleep 1

bash-4.2#
[2]+  Done                    sleep 6
bash-4.2#

bash-4.2# date; sleep 1 & date; sleep 4; date
Mon Dec  4 16:04:13 IST 2017
[1] 14680
Mon Dec  4 16:04:13 IST 2017
Mon Dec  4 16:04:17 IST 2017
[1]+  Done                    sleep 1
bash-4.2#


Please kindly review the patch and suggest comments.

Thanks,
Thiruvadi Rajaraman

Attachment: block_SIGCHLD_in_bash_sleep.patch
Description: Text Data


reply via email to

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