bug-bash
[Top][All Lists]
Advanced

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

Re: Bash: sleep execution issue with bash loadable builtins


From: Thiruvadi Rajaraman
Subject: Re: Bash: sleep execution issue with bash loadable builtins
Date: Tue, 28 Nov 2017 13:47:43 +0530

Hi,

Thanks a lot for your review comments.

I have reworked on the bash sleep fix based on your suggestion about signal
and trap handling in fsleep( ).

I have attached the fix patch for your kind reference.

Test logs with fix patch:
==================

root@x86-generic-64:~/bash-4.2# ./bash
root@x86-generic-64:~/bash-4.2# cd examples/loadables/

root@x86-generic-64:~/bash-4.2/examples/loadables# enable -n ./sleep sleep
bash: enable: ./sleep: not a shell builtin
bash: enable: sleep: not a shell builtin
root@x86-generic-64:~/bash-4.2/examples/loadables# enable -f ./sleep sleep

root@x86-generic-64:~/bash-4.2/examples/loadables# date; sleep 1 & date; sleep
10; date
Tue Nov 28 07:18:03 UTC 2017
[1]+  Done                    sleep 1
[1] 19524
Tue Nov 28 07:18:03 UTC 2017
Tue Nov 28 07:18:13 UTC 2017
[1]+  Done                    sleep 1
root@x86-generic-64:~/bash-4.2/examples/loadables#
root@x86-generic-64:~/bash-4.2/examples/loadables#

root@x86-generic-64:~/bash-4.2/examples/loadables# date; sleep 10 & date; sleep
4; date
Tue Nov 28 07:18:25 UTC 2017
[1] 19528
Tue Nov 28 07:18:25 UTC 2017
Tue Nov 28 07:18:29 UTC 2017
root@x86-generic-64:~/bash-4.2/examples/loadables#

<--------->



Please kindly review and suggest your comments. you suggestions and
comments helps to enhance the fix
and submit the same to bash gnu mainline.

Thanks,
Thiruvadi Rajaraman


On Tue, Nov 28, 2017 at 2:09 AM, Chet Ramey <chet.ramey@case.edu> wrote:

> On 11/27/17 4:17 AM, Thiruvadi Rajaraman wrote:
> > Hi,
> >
> > Found a 'sleep' execution issue with bash loadable builtins and has
> > performed
> > the below sleep test on bash-4.4-rc1.
>
> That's an interesting one. It looks like the SIGCHLD interrupts the select
> loop, even though bash supplies SA_RESTART when installing its SIGCHLD
> handler.  It's probably too hard to restart it in general, since select
> doesn't necessarily modify its timeval argument when it returns early
> (Linux does; many other OSs do not).
>
> There is a problem with your fix in that, in most cases, you've just made
> everything that uses this function non-interruptible, especially in an
> interactive shell. I think a better fix would be to change fsleep() to cope
> with select(2) being interrupted using the bash primitives that deal with
> signal and trap handling.
>
> Chet
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>                  ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, UTech, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~
> chet/
>

Attachment: Fix_for_bash_loadable_builtins_sleep_issue.patch
Description: Text Data


reply via email to

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