[Swan-dev] diff -w et.al. are very very blunt tools

D. Hugh Redelmeier hugh at mimosa.com
Thu Jun 21 17:49:06 UTC 2018


| From: Andrew Cagney <andrew.cagney at gmail.com>

I like it that we don't accept crappy whitespace by default.  On the
other hand, this GNU diff flag is mostly harmless:

       -Z, --ignore-trailing-space
              ignore white space at line end

Don't get me wrong: I would like to consider trailing whitespace to be
a (very minor) bug when we are responsible.  A diff flag does not
distinguish between things we should fix and those we cannot.

| My hunch is that for these tools we should be using narrow tool
| specific sanitizers like:
| 
| '/^ TOOL .../,/^[a-z]* #/ {
|   ... tool specific substitutions ...
| }
| 
| so that only that tools output is mangled.

Sure.

Or we could wrap the tool so that it doesn't screw up whitespace in
the log.  That way we don't have to assume that we can pattern match
reliably the invocation of a specific tool.

Either approach should work. For each tool, one approach may be easier
or more robust than the other.

What tools currently cause problems?  If I remember correctly, some
versions of the ip command, but not all, can put trailing whitespace
at the end of a line or lines.


More information about the Swan-dev mailing list