massive amounts of bogus whitespace

Thorsten Glaser t.glaser at tarent.de
Thu Jun 29 21:31:48 UTC 2023


Hi,

reviewing the diff from 8u362-ga to 8u382~b04 (which is something
I always do anyway, to update debian/copyright), I found way too
many of the added lines having bogus whitespace at EOL/EOF, DOS
line endings, or both.

If you add…

[mbsd]
	binfiles = \\.(png|jpe?g|gif|[ct]?[glx]z)$
[alias]
	check-emptylines = "!cd \"${GIT_PREFIX:-.}\" || exit 255; git find -gitfiles -print0 | grep -Ezvie \"$(git config mbsd.binfiles)\" | xargs -0r mksh -c 'pcregrep -l -M $'\\''\\n\\n\\n'\\'' \"$@\"; test $? -eq 1' git-check-emptylines-helper #"
	check3emptylines = "!cd \"${GIT_PREFIX:-.}\" || exit 255; git find -gitfiles -print0 | grep -Ezvie \"$(git config mbsd.binfiles)\" | xargs -0r mksh -c 'pcregrep -l -M $'\\''\\n\\n\\n\\n'\\'' \"$@\"; test $? -eq 1' git-check-emptylines-helper #"
	check-whitespace = "!cd \"${GIT_PREFIX:-.}\" || exit 255; git -c diff.relative=true diff --check \"$(git hash-object -t tree /dev/null)\" -- | grep -v '^[+]'; rv=$?; git find -gitfiles -print0 | grep -Ezvie \"$(git config mbsd.binfiles)\" | (test $rv = 1; rv=$?; while IFS= read -r -d '' name; do test -n \"$(tail -c -1 \"$name\")\" || continue; printf '%s:: no newline at EOF\\n' \"$name\"; rv=1; done; exit $rv) #"

… to your ~/.gitconfig, you can then use the command…

	$ git check-whitespace

… to check for where such things are (adjust the mbsd.binfiles
exclusion list suitably in .git/config in your jdk working copy).

This is somewhat reliant on GNU coreutils’ features, pcregrep and mksh.
These should be packaged for most distros.

You can also use 'git check3emptylines' to show files where more
than two empty lines separate paragraphs, to fix that. (There’s
git check-emptylines, which ensures a maximum of one blank line,
as well, but your coding style probably has two in some places.)

To fix them up, either press ^K] in the jupp text editor, which
normalises whitespace at EOL and EOF, or do something like…

	$ perl -pi -e 's![\t\cK\cL\cM ]+$!!' file …

… for whitespace at EOL and to fix whitespace at EOF, ensure
that there’s exactly one linefeed (\n) at the end of the file.

Unless you’re in DOS line endings mode, these will fix that, too.

For “space before tab in indent”, remove the extra spaces.
(In jupp, use ^K.^K, to indent the marked block first one
level more then one level less, which will convert everything
leading to the proper amount of tabs.)

bye,
//mirabilos
-- 
Infrastrukturexperte • tarent solutions GmbH
Am Dickobskreuz 10, D-53121 Bonn • http://www.tarent.de/
Telephon +49 228 54881-393 • Fax: +49 228 54881-235
HRB AG Bonn 5168 • USt-ID (VAT): DE122264941
Geschäftsführer: Dr. Stefan Barth, Kai Ebenrett, Boris Esser, Alexander Steeg

                        ****************************************************
/⁀\ The UTF-8 Ribbon
╲ ╱ Campaign against      Mit dem tarent-Newsletter nichts mehr verpassen:
 ╳  HTML eMail! Also,     https://www.tarent.de/newsletter
╱ ╲ header encryption!
                        ****************************************************


More information about the jdk8u-dev mailing list