[Top][All Lists]

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

Builtin echo interrupted by WINCH

From: Egmont Koblinger
Subject: Builtin echo interrupted by WINCH
Date: Sat, 23 Sep 2017 22:55:30 +0200

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
-Wdate-time -D_FORTIFY_SOURCE=2 -g -O2
-fstack-protector-strong -Wformat -Werror=format-security -Wall
-no-pie -Wno-parentheses -Wno-format-security
uname output: Linux blacky 4.13.0-11-generic #12-Ubuntu SMP Tue Sep 12
16:03:57 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Bash Version: 4.4
Patch Level: 12
Release Status: release


Problem 1.

For performance testing, I wanted to create a directory with 2M files.
I typed these commands in an interactive shell:

    mkdir /tmp/huge
    cd /tmp/huge
    for i in {1..2000000}; do echo $i; done | xargs touch

While I waited unpatiently for the command to complete, I began
resizing my terminal emulator window. As in most graphical environment
nowadays, I have "opaque" resize, the app (terminal emulator in this
case) gets resized multiple times as I move my mouse around.

In approx 50% of the cases where the terminal emulator actually
changed its size (measured in characters), bash printed this:

bash: echo: write error: Interrupted system call

Correspondingly, some of the files (exactly as many as the number of
error messages) were not created.

Problem 2.

I realized involving a "for" loop was too complicated, I should've
gone with a simpler command:

    echo {1..2000000} | xargs touch

So I tried this as well.

This time the error was only printed once when the command completed,
but a good 10.000-ish files were not created.

Plus, a few files named like "156562156707" or "232886233609" were
created erroneously. These are two relatively closeby (a few hundreds
apart) numbers concatenated without a space.

Is there anything bash could do to prevent incorrect behavior of its
built-in commands when a SIGWINCH is encountered? And of course I
don't mean the "echo" command only.

Thanks a lot,

reply via email to

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