Answering questions that may arise related to the meaning of portions of an IEEE standard concerning specific applications.

IEEE Standards Interpretations for IEEE Std 1003.2™-1992 IEEE Standard for Information Technology--Portable Operating System Interfaces (POSIX®)--Part 2: Shell and Utilities

Copyright © 1996 by the Institute of Electrical and Electronics Engineers, Inc. 3 Park Avenue New York, New York 10016-5997 USA All Rights Reserved.

Interpretations are issued to explain and clarify the intent of a standard and do not constitute an alteration to the original standard. In addition, interpretations are not intended to supply consulting information. Permission is hereby granted to download and print one copy of this document. Individuals seeking permission to reproduce and/or distribute this document in its entirety or portions of this document must contact the IEEE Standards Department for the appropriate license. Use of the information contained in this document is at your own risk.

IEEE Standards Department, Copyrights and Permissions, 445 Hoes Lane, Piscataway, New Jersey 08855-1331, USA

Interpretation Request #132
Topic: patch Relevant Sections: 5.22.3

1003.2-1992, 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 for Interpretation