Hello,

I believe I have found a bug in OpenRCS (base system) related to
revision retrieval after changing the release number using `ci -r`.

Environment:
------------
OpenBSD:   OpenBSD srv-public.my.domain 7.8 GENERIC.MP#1 amd64
OpenRCS:   OpenRCS 4.5
Program:   co / rcsdiff

Summary:
--------
After creating a new release using `ci -r2.1`, older revisions on the
trunk become unretrievable. Specifically, `rcsdiff` and `co -r` fail
to retrieve revision 1.3, even though the revision exists, rlog shows
a correct revision tree, and the deltatext is logically valid.

This does not occur if the trunk continues normally (1.4, 1.5, ...);
it only occurs after an explicit release-number jump using `ci -r2.1`.

Minimal reproduction:
---------------------

The following script reliably reproduces the problem:


printf "a\n" >> z.txt
ci -q -i -t-"test" -m"1.1" z.txt
co -q -l z.txt
printf "b\n" >> z.txt
ci -q -u -m"1.2" z.txt
co -q -l z.txt
printf "c\n" >> z.txt
ci -q -u -m"1.3" z.txt
co -q -l z.txt
printf "\nd\n" >> z.txt
ci -q -r2.1 -m"2.1" z.txt
co -q -l z.txt
printf "e\n" >> z.txt
ci -q -u -m"2.2" z.txt
rcsdiff -r1.2 -r1.3 z.txt

Observed result:
----------------

rcsdiff: failed to retrieve revision 1.3

Additional observations:
------------------------
- `rlog z.txt,v` shows a correct revision tree:
  1.1 -> 1.2 -> 1.3 -> 2.1 -> 2.2
- The `next` chain in the RCS file is correct.
- `co -p -r2.1` and `co -p -r2.2` work.
- The deltatext for revision 1.3 is valid diff -n output.
- The failure appears to be in revision reconstruction, not metadata.

Control case (works as expected):
---------------------------------
If the same history continues on the trunk without changing the
release number, the problem does not occur:


printf "\nd\n" >> z.txt
ci -q -u -m"1.4" z.txt
printf "e\n" >> z.txt
ci -q -u -m"1.5" z.txt
rcsdiff -r1.2 -r1.3 z.txt

This correctly produces:

diff -r1.2 -r1.3
2a3
c

Conclusion:
-----------
It appears that after `ci -r2.1`, OpenRCS applies or selects deltas
incorrectly when retrieving older trunk revisions, causing
`rcsdiff` / `co` to fail even though the revision exists and its
deltatext is consistent.

Please let me know if you would like the generated `z.txt,v` file
attached.

Best regards,
Tom


Reply via email to