[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Are my RCS files actually malformed?

From: Peter Budny
Subject: RE: Are my RCS files actually malformed?
Date: Tue, 2 Apr 2013 12:47:03 -0400

-----Original Message-----
From: Thien-Thi Nguyen [mailto:address@hidden 
Sent: Tuesday, April 02, 2013 11:49 AM

> FWIW, the manual for the upcoming 5.8.2 release includes the grammar From
the manpage:

Good that this is making it into the manual.

But what I was really looking for is documentation of the edit scripts,
which I haven't found anywhere. The RCS format just says a delta just
specifies "'text' <string>", but that's useless when you're looking at an
edit script and need to understand how to interpret it.
* Neither RCS's manual nor manpages even mention edit scripts at all.
* Diff's manpage just says "-n generates RCS format diffs".
* Diff's manual gives a brief description of the format, but it's not
detailed enough for what I needed.
** It doesn't clearly explain how line numbers are referenced (you have to
go back and read the section on ed scripts... and even then, it's not clear
that all references to the original file are non-relative, that is, they
pretend that the input file is unmodified even if you add or delete large
blocks from it).
** It says it addresses the problem with incomplete lines (last line of file
doesn't end in newline), but doesn't explicitly say how this would be
represented or counted in number of lines.

When fixing the broken RCS files in my repository, I found all of the
* Edit scripts that specified "a" or "d" with a line number past the end of
the input file (e.g., "d30 1" or "a30 1", when the original file only had 20
* Edit scripts that specified "a" or "d" to operate on more lines than were
present (e.g., "d1 30" when the original only had 20 lines, or "a1 30" when
only 20 lines were then provided to add).
* Edit scripts for files not ending in a newline, which I didn't know how to
interpret. (If you create a file with a single line but no newline, would it
be "a1 0" (because a line without a newline isn't actually a line (as the
"wc" command will show)) or "a1 1" (and it knows to leave off the newline
because the "@" signals end of input)? Similarly, how do you delete the last
* Edit scripts which delete to the end of the file, then add using the line
number of the nonextant last line. (This is 100% valid, it's just really
confusing if you don't know the format. It looks like you're deleting lines
60-100 and then adding at line 100, even though the file now only has 60

Through trial and error I was able to decipher the format and figured out
how to resolve each of those problems... but considering RCS is clearly
quite strict as to what it accepts as a valid edit script, it ought to be
documented somewhere.

~ Peter
Peter Budny
Unicoi Systems

reply via email to

[Prev in Thread] Current Thread [Next in Thread]