View Issue Details

IDProjectCategoryView StatusLast Update
00009461003.1(2008)/Issue 7Shell and Utilitiespublic2015-07-09 16:02
Reporterjoerg Assigned Toajosey  
PrioritynormalSeverityObjectionTypeOmission
Status ClosedResolutionWithdrawn 
NameJörg Schilling
Organization
User Reference
Sectiondiff
Page Number2626-2628
Line Number85265-85318
Interp Status---
Final Accepted Text
Summary0000946: diff description of line numbers for -C/-U is not correct
DescriptionBoth, the descritions for the beginning line number with the -C and -U options
are missing/wrong.

diff is oriented on the ed behavior and thus line numbers must follow ed rules.

For a search, delete or modify operatoion, the line number to junp to, is the
line number where the operation takes place.

For an insert operation, the line number is the line number of the line just
before the insert takes place (0 if the insert should happen at the beginning
of the file).

Context diffs and unified context diffs usually start with unaffected lines
and the related ed operation is a search operation that expects the line
number of the first matching line. The diff description however explicitely
permits context diffs with a context of 0.

Context diffs and unified context diffs with a context of 0 are different
as they do not start with unaffected lines but with the first affected
line. An insert operation thus needs a line number that differs from
other operations.

The current text for -C is correct only for -Cn with n > 0 as the term
"line-numer" is not explained.

The current text for -U is extremely ambiguous and may have caused the
incorrect behavior implemented with the Solaris diff command.

We need a useful description of what the "beginning line" number is.
Desired ActionIt may be wise to change line 85267 to contain "beginning line number"
instead of ending line number as only one line is affected.

Add the following text after line 85267:

The beginning line number is the line number for the first line in the
following context block, except when there is no unaffected line in
the block and the first affected line is an inserted line.

On line 85317 after "otherwise." insert:

The beginning line number is the line number for the first line in the
following context block, except when there is no unaffected line in
the block and the first affected line is an inserted line.


It may be wise to add a rationale for this problem...
TagsNo tags attached.

Activities

joerg

2015-05-06 15:00

reporter   bugnote:0002654

It seems that I forgot to mention the special case, so the correct text should
be:

The beginning line number is the line number for the first line in the
following context block, except when there is no unaffected line in
the block and the first affected line is an inserted line. In the latter
case, the beginning line number is the number of the line before the
inserted line.

Issue History

Date Modified Username Field Change
2015-05-06 09:37 joerg New Issue
2015-05-06 09:37 joerg Status New => Under Review
2015-05-06 09:37 joerg Assigned To => ajosey
2015-05-06 09:37 joerg Name => Jörg Schilling
2015-05-06 09:37 joerg Section => diff
2015-05-06 09:37 joerg Page Number => 2626-2628
2015-05-06 09:37 joerg Line Number => 85265-85318
2015-05-06 15:00 joerg Note Added: 0002654
2015-07-09 16:02 Don Cragun Interp Status => ---
2015-07-09 16:02 Don Cragun Status Under Review => Closed
2015-07-09 16:02 Don Cragun Resolution Open => Withdrawn