GNU bug report logs - #17012
[3 PATCHES] Whitespace cleanup : Replace code-alignment tabs with spaces.

Previous Next

Package: grep;

Reported by: behoffski <behoffski <at> grouse.com.au>

Date: Fri, 14 Mar 2014 10:04:01 UTC

Severity: normal

Tags: notabug, patch

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: behoffski <behoffski <at> grouse.com.au>
Subject: bug#17012: closed (Re: [3 PATCHES] Whitespace cleanup : Replace
 code-alignment tabs with spaces.)
Date: Sun, 06 Apr 2014 05:35:03 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#17012: [3 PATCHES] Whitespace cleanup : Replace code-alignment tabs with spaces.

which was filed against the grep package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 17012 <at> debbugs.gnu.org.

-- 
17012: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=17012
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Paul Eggert <eggert <at> cs.ucla.edu>
To: 17012-done <at> debbugs.gnu.org
Subject: Re: [3 PATCHES] Whitespace cleanup : Replace code-alignment tabs
 with spaces.
Date: Sat, 05 Apr 2014 22:34:16 -0700
As the original issue here seems to have been resolved with a "that's 
not a bug", I'm closing the report.

[Message part 3 (message/rfc822, inline)]
From: behoffski <behoffski <at> grouse.com.au>
To: bug-grep <at> gnu.org
Subject: [3 PATCHES] Whitespace cleanup : Replace code-alignment tabs with
 spaces.
Date: Fri, 14 Mar 2014 20:33:28 +1030
[Message part 4 (text/plain, inline)]
G'day,

I've been looking at the grep sources with various tools, and have found on a
couple of occasions that tab characters (ASCII code 09, ^I) confused me where
they occurred in the code.  For example, in commit ...c73ca06859c0820d9d,
Paul Eggert had to pacify "make dist", which calls "make syntax-check", as a
line had leading tabs:

         * src/dfa.c (parse_bracket_exp): Reindent with spaces.

I've worked on other projects where consistent and concise code formatting is
stringently applied (usually as code commit hooks that run Perl scripts), and
have found this environment useful, as there is a "canonical" representation
of the source to refer to.  GNU grep has made several steps in this direction
(e.g. no leading tabs, no trailing whitespace), but the translation isn't
complete:  Tabs still appear in a few selected places in the code.

One easy way to spot tab characters in C sources (merely .c and .h files here)
is to use "cat -T", which replaces the horizontal tab character with "^I":

        for f in *.[ch] ; do
                TMPFILE =`mktemp`
                echo "$f" ; cat -T "$f" >"$TMPFILE" ;        \
                       diff "$f" "$TMPFILE" ; rm -f "$TMPFILE"
        done

Another way (ASCII) is to look for hex code "09" in an octal dump of a source:

        for f in *.[ch] ; do
                echo "$f" ; od -txC "$f" | grep " 09"
        done

Attached are three small, concise patches, each changing one file in the
grep/src directory (I'm not daring to tackle gnulib at present).  These are
small, self-contained and should be fairly easy to review.  The files
modified are grep.h, kwset.h and dosbuf.c.

Please let me know if these changes are considered to be worthwhile, and,
if so, I'll submit larger patches for kwset.c, main.c and dfa.c.

cheers,

behoffski (Brenton Hoff)
Programmer, Grouse Software
[maint-dosbuf.c-tabs-spaces.patch (text/x-patch, attachment)]
[maint-grep.h-tabs-spaces.patch (text/x-patch, attachment)]
[maint-kwset.h-tabs-spaces.patch (text/x-patch, attachment)]

This bug report was last modified 11 years and 53 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.