Assignment 4. Change management

Useful pointers

You’re helping to develop an operating system and command set that as part of its acceptance test is supposed to be used by a large government agency. The agency has lots of requirements, some sensible and some persnickety, and one of these requirements is that applications must use characters properly from the Unicode character set. In particular, applications must use the Unicode character “`” (grave accent, U+0060) only as a spacing accent character.

Unfortunately, one of your applications, GNU Diffutils, regularly uses “`” as a quoting character in diagnostics. For example, the command “diff . -” outputs the diagnostic “diff: cannot compare `-' to a directory”, and this misuse of “`” violates your customer’s requirements. You need to change Diffutils so that it outputs “diff: cannot compare '-' to a directory” instead, using an apostrophe (U+0027) for both opening and closing quote. You don’t want to use fancier quoting characters such as “” and “” (left and right single quotation marks, U+2018 and U+2019) because they are not ASCII characters and another customer requirement is that the programs must work in ASCII-only environments.

The good news is that the Diffutils maintainers have run into a similar problem, and have a patch called “maint: quote 'like this' or "like this", not `like this'” that does what you want. The bad news is that your customer has specified Diffutils version 3.0, and the patch that you want is not in version 3.0. Also, your customer is conservative and wants a minimal patch so that it’s easy to audit, whereas the Diffutils maintainers’ patch also affects commentary and documentation which your customer doesn’t need or want changed.

Laboratory: Managing a backported change

As usual, keep a log in the file lab4.txt of what you do in the lab so that you can reproduce the results later. This should not merely be a transcript of what you typed: it should be more like a true lab notebook, in which you briefly note down what you did and what happened.

  1. Get a copy of the Diffutils repository, in Git format, from its main Savannah repository.
  2. Get a log of changes to Diffutils’ master branch using the “git log” command, and put it into the file git-log.txt.
  3. Generate a list of tags used for diffutils using the “git tag” command, and put it into the file git-tags.txt
  4. Find the commit entitled “maint: quote 'like this' or "like this", not `like this'”, and generate a patch for that commit, putting it into the file quote-patch.txt.
  5. Check out version 3.0 of diffutils from your repository.
  6. Use the patch command to apply quote-patch.txt to version 3.0. In some cases it will not be able to figure out what file to patch; skip past those by typing RETURN. Record any problems you had in applying the patch.
  7. Use the git status command to get an overview of what happened. Revert all the changes to files other than .c files, since you want only changes to .c files. Also, undo all the changes to .c files other than changes to character string constants, as the character-string changes are the only changes that you want; this may require editing some files by hand. If you are using Emacs, you may find the commands C-x v = (vc-diff) and C-x v u (vc-revert-buffer) useful when editing a .c file, and the command C-u C-c C-a (inverse diff-apply-hunk) useful when viewing a *vc-diff* buffer.
  8. Examine the files src/*.c.rej carefully, and copy rejected patches into the corresponding .c files as needed.
  9. Remove all untracked files that git status warns you about, since you don’t plan on adding any files in your patch.
  10. When you’re done with the above, git status should report a half-dozen modified files, and git diff should output a patch that is three or four hundred lines long. Put that patch into a file quote-3.0-patch.txt.
  11. Build the resulting modified version of diffutils, using the commands described in the file README-hacking (skipping the part about CVS; CVS is obsolescent), and verify that it does the right thing with the “diff . -” scenario, as well as with “diff --help”.

Homework: Verifying and publishing a backported change

You’re happy with the code that you wrote in your lab, but now you’d like to publish this patch, in a form similar to that presented in the original patch, so that others can use it.

  1. Maintain a file hw4.txt that logs the actions you do in solving the homework. This is like your lab notebook lab4.txt, except it’s for the homework instead of the lab.
  2. Check out version 3.0 of diffutils from your repository, into a new branch named “quote”.
  3. Install your change into this new branch, by running the patch command with your patch quote-3.0-patch.txt as input.
  4. Create an appropriate entry in the ChangeLog file for your patch, by adapting the change log from the original patch.
  5. Commit your changes to the new branch.
  6. Use the command “git format-patch” to generate a file formatted-patch.txt. This patch should work without having to fix things by hand afterwards.
  7. Verify that this patch works, by checking out version 3.0 again into a new temporary branch tmp, applying the patch with the command “git am”, and building the resulting system, checking that it works with “make check”.

Submit

Submit a compressed tarball hw4.tgz containing the following files.

All .txt files should be ASCII text files, with no carriage returns. You can create the tarball with the command:

tar czf hw4.tgz lab4.txt git-log.txt git-tags.txt \
  quote-patch.txt quote-3.0-patch.txt hw4.txt formatted-patch.txt

© 2005, 2007–2012 Paul Eggert. See copying rules.
$Id: assign4.html,v 1.15 2012/04/30 16:43:07 eggert Exp $