Report 0705 Actions
Problem Report Number |
0705 |
Submitter's Classification |
Specification problem |
State |
Resolved |
Resolution |
Permanent Interpretation (PIN) |
Problem Resolution ID |
PIN.X.0098 |
Raised |
1970-01-01 08:00 |
Updated |
2003-03-13 08:00 |
Published |
1997-02-24 08:00 |
Product Standard |
Commands and Utilities V2 (UNIX 95) |
Certification Program |
The Open Brand certification program |
Test Suite |
VSC version 4.1.5 |
Test Identification |
POSIX.upe/ex 1013-1014 |
Specification |
Commands and Utilities Issue 4 Version 2 |
Location in Spec |
See Problem Text |
Problem Summary |
PIN4C.00016 This test may fail on implementations that implement historical ed compatible behavior. |
Problem Text |
Commands and Utilities, Issue 4, Version 2, p. 318, defines edcompatible as follows: edcompatible, ed [Default off] Causes the presence of g and c suffixes on substitute commands to be remembered, and toggled by repeating suffixes. Precise definitions of "remembered" and "toggled" are omitted, and no rules are supplied to govern their operation. VSC tests 1013 and 1014 test edcompatible and, perhaps not surprisingly given the loose definition, verify a different interpretation of the definitions than ours. We assert the historical behavior of the "remembered" function of edcompatible, which matches the behavior of our implementation, is summarized as follows: If edcompatible is set, and a substitute command is executed without a search pattern or options, then the search pattern and options specified in the pre- vious substitute command are used. In the case where no previous substitute command was issued, an error condition results. For example: Given a file with the contents: 1 foo foo foo 2 foo foo foo 3 foo foo foo 4 foo foo foo historically, the following behavior would be exhibited with edcompatible set: :set edcompatible :1s/foo/BAR/g # Replace all occurences of "foo" on line 1 with "BAR" BAR BAR BAR :2 foo foo foo :s # Substitute, applying /foo/BAR/g from the previous cmd BAR BAR BAR # Replace all occurences of "foo" on line 2 with "BAR" :1,$ BAR BAR BAR BAR BAR BAR foo foo foo foo foo foo :4s/foo/baz/ # Execute a new search command, with a new pattern and baz foo foo # a null option. The new remembered pattern and option # will be set to /foo/baz/ We believe the historical behavior and our understanding of "toggled" is summarized by the following: If a single option on the substitute command is repeated, each additional specification of that option toggles it, turning it on or off. Option tog- gling applies only to a single command line; each command line is treated independently with respect to toggling. Historically, toggling occurs independently of the edcompatible setting. For example: For the line: 1 foo foo foo a table of commands and their effect on that line follows: command result toggled state of global option --------------- ------------- ------------------------------ :s/foo/BAR/g 1 BAR BAR BAR global scope on :s/foo/BAR/gg 1 BAR foo foo global scope off :s/foo/BAR/ggg 1 BAR BAR BAR global scope on :s/foo/BAR/gggg 1 BAR foo foo global scope off In VSC Test 1013, the original contents of the target file is: here is a file and another line The following commands are applied with edcompatible set: 1,$s/e/X/g 1,$s/i/Y/ Given the historical behavior, one would expect the following result: Command 1: hXrX is a filX and anothXr linX Command 2: HXrX Ys a filX and anothXr lYnX Instead, the result expected by VSC is: hXrX Ys a fYlX and anothXr lYnX In other words, VSC expects the /g option to be remembered and applied during the execution of the second command, causing the 'i' in filX to be replaced with a 'Y'. This differs with the historical implementation of ex, which does carry over the g option when a search pattern is specified. In VSC Test 1014, the original contents of the target file is: here is a file and another line The substitute commands, also applied with edcompatible set, are: 1,$s/e/X/g 1,$s/a/Z/g Historically, this would produce: Command 1: hXrX is a filX and anothXr linX Command 2: hXrX is Z filX Znd ZnothXr linX Instead, the test expects: hXrX is Z filX Znd anothXr linX >From this behavior, one assumes the test expects the global option in the second command, which remembers the global option as having been set and remembered as a result of the first substitution command, to be toggled off. This would cause the second 'a' in the second line to not be replaced. In other words, it ex- pects option toggling to be applied over two commands, instead of being restric- ted to a single command. Given the specification is non-specific and the expected results diverge from historical practice, we feel the specification should be clarified, and the tests altered to verify the new definition. In the meantime, we feel a TSD should be issued to grandfather those implementations which conform to histori- cal practice.
|
Test Output |
520|1 1 15471 1 1|Assertion #1013 (C): Test edcompatible set option with c/g 520|1 1 15471 1 11|Standard output isn't the same as file 'ex_exp_1' 520|1 1 15471 1 12|diff of "out.stdout" and "ex_exp_1": 520|1 1 15471 1 13|*** out.stdout Fri Jan 10 14:42:22 1997 520|1 1 15471 1 14|--- ex_exp_1 Fri Jan 10 14:41:49 1997 520|1 1 15471 1 15|*************** 520|1 1 15471 1 16|*** 1,2 **** 520|1 1 15471 1 17|! hXrX Ys a filX 520|1 1 15471 1 18| and anothXr lYnX 520|1 1 15471 1 19|--- 1,2 ---- 520|1 1 15471 1 20|! hXrX Ys a fYlX 520|1 1 15471 1 21| and anothXr lYnX 220|1 1 1 14:42:25|FAIL 520|1 1 15739 1 1|Assertion #1014 (C): Test edcompatible set option without c/g 520|1 1 15739 1 11|Standard output isn't the same as file 'ex_exp_1' 520|1 1 15739 1 12|diff of "out.stdout" and "ex_exp_1": 520|1 1 15739 1 13|*** out.stdout Fri Jan 10 14:43:23 1997 520|1 1 15739 1 14|--- ex_exp_1 Fri Jan 10 14:42:51 1997 520|1 1 15739 1 15|*************** 520|1 1 15739 1 16|*** 1,2 **** 520|1 1 15739 1 17| hXrX is Z filX 520|1 1 15739 1 18|! Znd ZnothXr linX 520|1 1 15739 1 19|--- 1,2 ---- 520|1 1 15739 1 20| hXrX is Z filX 520|1 1 15739 1 21|! Znd anothXr linX 220|1 1 1 14:43:26|FAIL
|
Review Information
Review Type |
TSMA Review |
Start Date |
null |
Completed |
null |
Status |
Complete |
Review Recommendation |
No Resolution Given |
Review Response |
A permanent interpretation is recommended after review. The issue here is the definition of edcompatible: edcompatible, ed [Default off] Causes the presence of g and c suffixes on substitute commands to be remembered, and toggled by repeating suffixes. The test interprets "toggled by repeating suffixes" as a single occurance of the g suffix repeated on different substitution commands such as s/foo/bar/g s/me/you/g so that the g option becomes implicit on future substitution commands until the g suffix is specified again to toggle the behavior. For example, s/a/A/g explicit global substitution s/b/B/ implicit global subsitution s/c/C/g toggle g switch, no global substitution s/d/D/ no global substitution The submitter contrasts the current test to historial practice. While historical practice is not normative, we believe this claim is correct. Since it is possible to interpret the spec as mandating either behavior we think it likely that the historical behavior was intended and that the test is wrong. However, the spec is not clear and many implementations have branded after changing thier behavior to pass the current test. To fix the test then force these implementations to change once again seems unreasonable to us. Especially since we believe this issue to have little, if any noticable effect to anyone.
|
Review Type |
Expert Group Review |
Start Date |
null |
Completed |
null |
Status |
Complete |
Review Resolution |
No Resolution Given |
Review Conclusion |
The specification is not clear on the definition of edcompatible. A Permanent Interpretation should be granted.
|
Review Type |
SA Review |
Start Date |
null |
Completed |
null |
Status |
Complete |
Review Resolution |
Permanent Interpretation (PIN) |
Review Conclusion |
A Permanent Interpretation is granted.
|
Problem Reporting System Options:
|