CVS [email protected]: linux
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi Ralf and or others,
Do you detect and fix these trailing whitespaces with a script ? If so can you tell me where I can find it (or send it)?
Thanks in advance,
Niels Sterrenburg
Quoted 21 lines
CVSROOT:
/home/cvs
Module name: linux
Changes by: [email protected] 05/07/25 22:36:00Modified files:
include/asm-mips/mach-generic:kernel-entry-init.hinclude/asm-mips/mach-ip27:kernel-entry-init.hinclude/asm-mips/mach-pnx8550:glb.hkernel-entry-init.hnand.h
pci.husb.h
arch/mips/au1000/common:irq.c
arch/mips/pci:ops-pnx8550.carch/mips/philips/pnx8550/common:gdb_hook.cint.cpci.cproc.c
prom.csetup.c
arch/mips/philips/pnx8550/jbs:board_setup.cinit.cLog message:
Fixup the trailing whitespace mess.
Quoted 1 line · Niels Sterrenburg
Do you detect and fix these trailing whitespaces with a script ?
For detection, if you use vim, you want to add
let c_space_errors=1
to your .vimrc and make the superfluous spacing hurt your eyes.
Quoted 1 line
If so can you tell me where I can find it (or send it)?
sed(1) is your friend ;-)
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Quoted 3 lines · Geert Uytterhoeven
Quoted 1 line
If so can you tell me where I can find it (or send it)?
sed(1) is your friend ;-)
And s/// works from vi, too.
Maciej
Quoted 2 lines · Niels Sterrenburg
Do you detect and fix these trailing whitespaces with a script ? If so can you tell me where I can find it (or send it)?
Well, here's my nuke-trailing-whitespace skript. Pretty small - 80% of it is the legalese and a brief comment. In case you're using quilt you can do something like
nuke-trailing-whitespace `quilt files` quilt refresh --diffstat
to clean a particular patch
Ralf
#! /bin/bash
#
# Copyright (C) 2002 by Ralf Baechle ([email protected]) #
# This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 2 of the License, or (at your # option) any later version. # # THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN # NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF # USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 675 Mass Ave, Cambridge, MA 02139, USA. # # nuke-trailing-whitespace - Nuke trailing whitespace in sourcecode # # Usage: nuke-trailing-whitespace [file]... #
find $* -name CVS -prune -o -type f -print | \ fgrep -v defconfig | xargs --no-run-if-empty -- perl -pi -e 's/[ \t]+$//'
Quoted 8 lines · Ralf Baechle
Well, here's my nuke-trailing-whitespace skript. Pretty small - 80% of it is the legalese and a brief comment. In case you're using quilt you can do something like
nuke-trailing-whitespace `quilt files` quilt refresh --diffstatto clean a particular patch
It doesn't wipe other rubbish like spaces followed by tabs, though --
e.g. ones that would match "^ \t". Perhaps `indent' could help with them, but I trust my fingers and eyes instead. ;-)
Maciej
Quoted 3 lines · Maciej W. Rozycki
It doesn't wipe other rubbish like spaces followed by tabs, though --
e.g. ones that would match "^ \t". Perhaps `indent' could help with them, but I trust my fingers and eyes instead. ;-)
Of course it does:
[ralf@box ~]$ echo -ne ' \t\t' | perl -pi -e 's/[ \t]+$//' | od -x 0000000
[ralf@box ~]$
Ralf
Quoted 10 lines · Ralf Baechle
Quoted 3 lines · Maciej W. Rozycki
It doesn't wipe other rubbish like spaces followed by tabs, though --
e.g. ones that would match "^ \t". Perhaps `indent' could help with them, but I trust my fingers and eyes instead. ;-)Of course it does:
[ralf@box ~]$ echo -ne ' \t\t' | perl -pi -e 's/[ \t]+$//' | od -x 0000000
[ralf@box ~]$
Maciej meant spaces followed by tabs that do not end a line, e.g.
| tux$ echo -ne ' \t\tx' | perl -pi -e 's/[ \t]+$//' | od -x | 0000000 2020 0909 0078 | 0000005
These are a bit more difficult to auto-remove, since simply removing them may change indentation (modulo 8).
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Quoted 1 line · Geert Uytterhoeven
Maciej meant spaces followed by tabs that do not end a line, e.g.
Indeed.
Quoted 2 lines
These are a bit more difficult to auto-remove, since simply removing them may change indentation (modulo 8).
I've found it quite efficient to do it with `vim' and conditional regexp
substitution. This way you can see what gets changed and if indentation needs to be fixed up afterwards, you can do this immediately.
Maciej
Quoted 3 lines · Maciej W. Rozycki
Quoted 1 line
Maciej meant spaces followed by tabs that do not end a line, e.g.
Indeed.
Oh, I quite intensionally left those alone for now. And if needed there's always unexpand(1).
Ralf
Hi all,
Quite a big threat this question generated (and that for some spaces) :-)
I've adapted my vimrc and check ralfs script when creating patches.
Thanks for all the feedback,
Niels Sterrenburg
Quoted 38 lines · Ralf Baechle
Quoted 11 lines · Maciej W. Rozycki
Quoted 2 lines
It doesn't wipe other rubbish like spaces followed by tabs, though --
e.g. ones that would match "^ \t". Perhaps `indent' could help withthem,
Quoted 1 line
but I trust my fingers and eyes instead. ;-)
Of course it does:
[ralf@box ~]$ echo -ne ' \t\t' | perl -pi -e 's/[ \t]+$//' | od -x 0000000
[ralf@box ~]$Maciej meant spaces followed by tabs that do not end a line, e.g.
| tux$ echo -ne ' \t\tx' | perl -pi -e 's/[ \t]+$//' | od -x | 0000000 2020 0909 0078 | 0000005These are a bit more difficult to auto-remove, since simply removing them may
change indentation (modulo 8).Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds