[Top][All Lists]

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

read builtin disregards IFS when interrupted by trapped signal

From: Andriy Martynets
Subject: read builtin disregards IFS when interrupted by trapped signal
Date: Wed, 20 Jul 2016 16:01:31 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.7.0

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: 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../. -I.././include -I.././lib -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wall uname output: Linux admin-laptop-debian 4.4.0 #4 SMP Sat May 14 22:23:09 EEST 2016 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Bash Version: 4.3
Patch Level: 42
Release Status: release

The read builtin disregards (or sporadically uses unpredictable value of)
the IFS variable when is interrupted by a trapped signal.

- install a trap for a signal, say SIGALRM or SIGUSR1
- cycle read from a process with a custom IFS to split read string into variables
- each interrupted read will return the string splitted in wrong way

Attached script demonstrates the bug.

Thank you in advance.

With best regards,
Andriy Martynets

Attachment: read-test
Description: Text document

reply via email to

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