[Asterisk-Dev] Whitespace damage? (was: Re: [Asterisk-cvs] asterisk-addons res_config_mysql.c, 1.7, 1.8)

Edwin Groothuis edwin at mavetju.org
Thu Apr 21 21:30:09 MST 2005


On Thu, Apr 21, 2005 at 11:10:38PM -0500, Matthew Boehm wrote:
> In you comments on bug #4066 you said my patches where "whitespace damaged".
> What exactly does that mean? (for future reference..)

If this is the output of diff:
	-	foo();
	+        bar();

Looks like it's a simple replace of "foo" by " bar". But what you
don't see is that the character in front of foo is actually a tab,
and not 7 spaces.

Now if you copy+paste this diff, there is a big chance that the tab
gets replaced by 7 spaces, so your patch then becomes:
	-       foo();
	+        bar();

If you try to apply this patch to the original code, patch will
complain that it can't find "       foo" and it will reject the
chunk.

The magical conversion of tabs into spaces is "whitespace damage".

It's even more fun if you have your tabstop in your editor set at
four spaces. The output of diff could have been then:
	-	foo();
	+    bar();

It's all about style(9) and perlstyle(1) :-)

Edwin

-- 
Edwin Groothuis      |            Personal website: http://www.mavetju.org
edwin at mavetju.org    |          Weblog: http://weblog.barnet.com.au/edwin/



More information about the asterisk-dev mailing list