Path: csiph.com!xmission!news.glorb.com!usenet.stanford.edu!not-for-mail From: Oleg Popov Newsgroups: gnu.bash.bug Subject: Race condition in read -t Date: Sat, 29 Aug 2015 02:52:49 +0300 Lines: 25 Approved: bug-bash@gnu.org Message-ID: NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: usenet.stanford.edu 1440827499 18839 208.118.235.17 (29 Aug 2015 05:51:39 GMT) X-Complaints-To: action@cs.stanford.edu To: bug-bash@gnu.org Envelope-to: bug-bash@gnu.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru; s=mail2; h=Content-Type:MIME-Version:Message-ID:Subject:To:From:Date; bh=wlCUtOng8f/kWWVYV8f0IX3d+lcFwgp4v8KEh8zyipw=; b=jxqwnkw2fYNrbYgS/F894kRmcQsF5MBlChmnxN7yhdTEz9NBb99c+Zs77OFC7Aak5b1M67JrVnCPXI1VwTspAxGrvXho/yXe7ai70MzvJ8h9DT94FI6jtEn/Uvn6LTL9uGE23Cs23tf5zCCMtbiRczBwqGJMFtVaspu51mqP9fY=; Content-Disposition: inline X-Mras: Ok X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 94.100.181.92 X-Mailman-Approved-At: Sat, 29 Aug 2015 01:51:37 -0400 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:11444 Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: x86_64-pc-linux-gnu-gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I./include -I. -I./include -I./lib -DDEFAULT_PATH_VALUE='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' -DSTANDARD_UTILS_PATH='/bin:/usr/bin:/sbin:/usr/sbin' -DSYS_BASHRC='/etc/bash/bashrc' -DSYS_BASH_LOGOUT='/etc/bash/bash_logout' -DNON_INTERACTIVE_LOGIN_SHELLS -DSSH_SOURCE_BASHRC -O2 -pipe -march=native -mtune=native uname output: Linux thinkpad 4.1.6-hardened-r1 #1 SMP Wed Aug 26 04:44:35 MSK 2015 x86_64 AMD A6-3400M APU with Radeon(tm) HD Graphics AuthenticAMD GNU/Linux Machine Type: x86_64-pc-linux-gnu Bash Version: 4.3 Patch Level: 42 Release Status: release Description: Function reset_alarm() in read.def first resets SIGALRM handler and then cancels alarm. Sometimes, SIGALRM comes between those 2 calls and crashes (sub)shell. Repeat-By: while sleep 0.00$RANDOM; do echo test; done | while true; do read -t 0.00$RANDOM; echo $REPLY; done (usually takes a few seconds to crash, sometimes minutes) Fix: Swap the lines in reset_alarm().