GSoC/GCI Archive
Google Code-in 2012 The NetBSD Project

Fix bug bin/47367: patch(1) mishandles Oops.rej

completed by: Puck Meerburg

mentors: Julian Coleman

From the bug report:

the patch program fails when the file to be patched does not exist.

Note, that there are two problems:

  1) the reject filename is always ./Oops.rej, and new reject files overwrite the original/previous

  2) the reject file does not contain the patch header (i.e. the name of the missing file)

For this task, both these problems should be solved.  For the first, it would be possible to create the reject filename in the correct directory, if it exists, or maybe create several OopsN,rej files (this second might be more consistent)..  In any case, if the file (e.g. Oops7 or Oops7.rej) exists, then that name should not be used (e.g. use Oops8.rej).  The screen output should display the name of the created file.

The sources for the patch program are in .../src/usr.bin/patch, or:

The submission should be in the form of a patch file that can be applied to the patch sources.