I'm comparing two different kernel versions (one official, one from a manufacturer); there are thousands of file whose only difference is in metadata in the files. The metadata looks like '$:Key: value$'. Is there a set of tools that modify this stuff? What generates this data? Is there any way to do a diff without this polluting it without running the entire source through sed?

An example:

    --- ./drivers/atm/idt77252.h  2010-10-05 14:53:01.787778390 -0400
+++ ../linux-2.6.21.x/drivers/atm/idt77252.h 2010-03-26 03:08:26.000000000 -0400
@@ -1,8 +1,8 @@
- * ident "$Id: idt77252.h,v 1.2 2001/11/11 08:13:54 ecd Exp $"
+ * ident "$Id: idt77252.h,v 2007-05-25 06:50:05 bruce Exp $"
- * $Author: ecd $
- * $Date: 2001/11/11 08:13:54 $
+ * $Author: bruce $
+ * $Date: 2007-05-25 06:50:05 $
  * Copyright (c) 2000 ATecoM GmbH

As Tante says, those $Word: ...$ are inserted and updated by some version control systems (CVS and SubVersion, tipically).

GNU diff has an option --ignore-lines-matching-re that can exclude lines that match a certain regular expression. This one should do the trick:

diff -wu --ignore-matching-lines='\$[A-Z][a-z]*:.*\$' -r sourceA/ sourceB/

(Note the \ before $ to prevent it being interpreted as an end-of-line marker in the regexp.)


CVS (a Versioning System) is able to replace certain "Placeholders" with their values upon checkout (so you have for example the version of the checkout or the author in the file).


I seem to remember bitkeeper also did this "expand keywords on checkout" dance, by the dates cited this might explain the differences (but only if it is for truly ancient kernel sources). After the bitkeeper fiasco, the sources whene checked into git, which doesn't believe in keyword expansion, so they would get frozen at that point in time.

Can we know what kernel sources you are comparing? Just curious.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.