WG15 Defect Report Ref: 9945-2-132
Topic: patch


This is an approved interpretation of 9945-2:1993.

.

Last update: 1997-05-20


								9945-2-132

 _____________________________________________________________________________

	Topic:                  patch
	Relevant Sections:      5.22.3

Defect Report:
-----------------------
	From: [email protected] (Andrew Josey)
	Date: Wed, 19 Jul 1995 16:50:34 +0100


This is a request for interpretation of ISO/IEC 9945-2-92.

9945-2:1993, section 5.22.3 (patch), page 585, lines 3483-3489 says

"-o outfile  Instead of modifying the files (specified by the file operand or
the diff listings) directly, write a copy of the file referenced by each
patch, with the appropriate differences applied, to outfile.  Multiple
patches for a single file shall be applied to the intermediate versions of
the file created by any previous patches and shall result in multiple,
concatenated versions of the file being written to outfile."

This does not describe historical practice.  Historical practice has been to
override just the first occurance of the first file in the patch file.

The rationale for patch contains a number of changes that were made from
historical practice but this is not mentioned.
Moreover, the change is significant, unintuative and likely to cause
problems for people expecting the historical behaviour.

Was this change from historical practice intentional?


Interpretation response
------------------------
The standard clearly states the requirements for patch -o
and conforming implementations must conform to this. 

It is true that historical versions of patch only wrote the
changes that would be made by the first chunk of a patch file
to the file specified by the -o outfile option. The working
group believed that you could have a security issue of overwriting
files unintentionally when a patch file contained multiple chunks,
and the historic documentation never indicated that  this
only applied to the first chunk.
This was thus an intentional change.

Issues concerning the wording of the rationale have been
forwarded to the sponsor, but these would not result in a normative change.
Rationale
-------------
None.
Forwarded to Interpretations group: Jul 20 1995
Recirculated for 30 day review: Oct 19 1995
Finalised: Nov 20 1995