help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] Mixing background tasks with input redirection somehow u


From: João Eiras
Subject: Re: [Help-bash] Mixing background tasks with input redirection somehow unsets stty's icanon and echo
Date: Thu, 22 Dec 2016 22:43:58 +0100

Howdy !

Yes, I was thinking about it.

A simple "strace -f stty -echo" shows this interesting line:
ioctl(0, SNDCTL_TMR_STOP or TCSETSW, {B38400 opost isig icanon -echo ...}) = 0

I traced the program with "strace -f <testcase>", and then I grepped the result.

$ grep -e SNDCTL -e TCSET <log>
[pid 24551] ioctl(3, SNDCTL_TMR_START or TCSETS, {B38400 opost isig
-icanon -echo ...} <unfinished ...>
[pid 24554] ioctl(3, SNDCTL_TMR_START or TCSETS, {B38400 opost isig
-icanon -echo ...} <unfinished ...>
[pid 24551] ioctl(3, SNDCTL_TMR_START or TCSETS, {B38400 opost isig
icanon echo ...} <unfinished ...>
[pid 24554] ioctl(3, SNDCTL_TMR_START or TCSETS, {B38400 opost isig
-icanon -echo ...} <unfinished ...>

$ grep -n -e clone -e getpid -e '= 2455' <log>
100:getpid()                                = 24550
177:clone(child_stack=0,
flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD,
child_tidptr=0x7f3c7129de10) = 24551
217:[pid 24550] clone(strace: Process 24552 attached
218:child_stack=0,
flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD,
child_tidptr=0x7f3c7129de10) = 24552
429:[pid 24552] clone( <unfinished ...>
432:[pid 24552] <... clone resumed> child_stack=0,
flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD,
child_tidptr=0x7f3c7129de10) = 24553
723:[pid 24553] clone( <unfinished ...>
727:[pid 24553] <... clone resumed> child_stack=0,
flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD,
child_tidptr=0x7f3c7129de10) = 24554
1268:[pid 24551] set_tid_address(0x7f47c7981210) = 24551
1355:[pid 24554] <... set_tid_address resumed> ) = 24554
2682:[pid 24550] <... wait4 resumed> [{WIFEXITED(s) && WEXITSTATUS(s)
== 0}], 0, NULL) = 24551
2689:[pid 24553] <... wait4 resumed> [{WIFEXITED(s) && WEXITSTATUS(s)
== 0}], 0, NULL) = 24554
2722:<... wait4 resumed> [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0,
NULL) = 24552

We can see both background processes setting the flags, and the second
one (24554) does not restore the original values but sets again the
altered values. The second grep shows they are all bash processes.

So, bash bug ?



reply via email to

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