ls: be responsive to interrupts when color-listing large directories
commitc592a00f8f8c7e6baeff575a3762459173153635
authorJim Meyering <meyering@redhat.com>
Thu, 8 Dec 2011 09:49:03 +0000 (8 10:49 +0100)
committerJim Meyering <meyering@redhat.com>
Thu, 8 Dec 2011 11:17:54 +0000 (8 12:17 +0100)
tree816826369d86abf2dda38529803bd12403cf29b9
parent6eb3cf234fef5522c0a206222e77f170c2ad6959
ls: be responsive to interrupts when color-listing large directories

Starting with commit adc30a83, when using --color, ls inhibited
interrupts to avoid corrupting the state of an output terminal.
However, for very large directories, that inhibition rendered ls
uninterruptible for too long, including a potentially long period
even before any output is generated.
* src/ls.c: Two phases of processing are time-consuming enough that
they can provoke this: the readdir loop and the printing loop.  The
printing was supposed to be covered by a call to process_signals in
(print_name_with_quoting): ... but that call was mistakenly guarded
by a condition that might be false for many or even all files being
processed.  Call process_signals unconditionally.
(print_dir): Also call process_signals in the readdir loop.
* NEWS (Bug fixes): Mention it.
Reported by Arkadiusz Miƛkiewicz in http://bugs.gnu.org/10243
Co-authored-by: Eric Blake <eblake@redhat.com>
NEWS
THANKS.in
src/ls.c