Subject: bug#20062: [bug-diffutils] bug#20062: bug#20062: [PATCH] diff: add support for --color

From: Paul Eggert <[email-masked]>
Date: Thu, 12 Mar 2015 07:44:56 -0700

Giuseppe Scrivano wrote:
> is it ok for now to keep these calls to sigprocmask and fix all the
> other issues you reported (until the ls.c code is Gnulib-ized)?

Sure, if removing sigprocmask calls is merely an efficiency thing.  (It may be 
that the cost of the sigprocmask calls is not significant, so we can leave them 
in.)  Correctness is the bigger problem here.

Another possibility is to refuse to output colors to a terminal.  That would 
simplify a lot of things; we wouldn't need to worry about signals at all.

A third possibility is to have a signal handler that resets the terminal (using 
'write' not 'fwrite', to make it async-signal-safe).  That should remove the 
need for sigprocmask.