- publishing free software manuals

Articles > GNU Diff and Patch Quiz

Test your knowledge of the GNU Diffutils with this quiz!

All answers can be found in the book "Comparing and Merging Files with GNU diff and patch" (ISBN 0-9541617-5-0) by David MacKenzie, Paul Eggert, and Richard Stallman, in electronic or paperback format.

  1. What diff option ignores differences between tabs and spaces? (Easy, p 6)
  2. GNU diff can produce output in context, unified and normal formats. Which of these is specific to GNU? (p 16)
  3. How do you create diffs which are annotated with the name of each modified function? (p 19)
  4. Diff can create files with #ifdef ... #else ... #endif conditionals. How? (p 24)
  5. For recursive directory diffs such as diff -r OLD/ NEW/ what happens if (a) a file is present in OLD but not NEW, (b) in NEW but not OLD? (Think carefully, p 35)
  6. What recursive diff option ignores version control files such as CVS/ directories? (p 35)
  7. Two people are working on separate copies X,Y of a master file, ORIG, without using CVS. What single diff command will show any conflicting changes between X, Y and ORIG? (p 45)
  8. How can the two sets of changes above be merged together with a single command? (p 48)
  9. What single command will merge two files interactively on the command-line? (p 51)
  10. What is the safest way to run the patch command? (p 57)

The page number of the answer is given in parentheses.