>Synopsis: RCS file gets corrupted, when a locked version is deleted
>Category: user
>Environment:
System : OpenBSD 6.7
Details : OpenBSD 6.7 (GENERIC.MP) #2: Thu Jun 4 09:55:08 MDT 2020
[email protected]:/usr/src/sys/arch/amd64/compile/GENERIC.MP
Architecture: OpenBSD.amd64
Machine : amd64
>Description:
Program rcs with option -o (Delete one or more revisions)
does not handle locks. If a locked out version is deleted,
the RCS file gets corrupted. Deleting a locked out version
should be handled as user error, but should not lead to
a corrupted RCS file.
>How-To-Repeat:
# start script #
# make a testfile and check in
echo test >testfile
ci -l -t-rcs-test testfile
# make a first change and check in
echo wrongline2 >>testfile
ci -l -mchange_try1 testfile
# realize the wrong change, try to delete the wrong version
rcs -o1.2 testfile
# get the initial version, make the right change
co -l testfile
# there is no error message, but the usual notice
# about the checked out revision number is missing.
# What happened?
cat testfile
# The check out did not work, an error occured!
# Why?
cat testfile,v
# Version 1.2 is deleted, but its lock is still there!
# The RCS file is corrupted, normal work not more possible!
# end script #
>Fix:
Refuse to delete a locked version with error message
or ask to unlock before deleting.