Re: rcs co stops processing files after an empty revision file is encountered
"Aaron S. Hawley" <[email protected]>
| Newsgroups | gmane.comp.version-control.rcs.bugs |
|---|---|
| Message-ID | <[email protected]> |
I can confirm this bug in RCS version 5.7 for GNU/Linux and AIX. Arthur's shell script likely gives ample /test coverage/ of the bug in RCS's `co' command. However, here is a "shorter" summary of the commands necessary to illicit the bug: $ touch file2 file3 $ rcs -i -t-file file1 RCS file: file1,v done $ ci -i -t-file file2 file3 file2,v <-- file2 initial revision: 1.1 done file3,v <-- file3 initial revision: 1.1 done $ co file1 file2 file3 ## This will work. file1,v --> file1 writable file1 exists; remove it? [ny](n): y no revisions present; generating empty revision 0.0 co: warning: no revisions, so nothing can be locked done file2,v --> file2 revision 1.1 (locked) writable file2 exists; remove it? [ny](n): y done file3,v --> file3 revision 1.1 (locked) writable file3 exists; remove it? [ny](n): y done $ co file2 file1 file3 ## This will *not* work. file2,v --> file2 revision 1.1 (locked) writable file2 exists; remove it? [ny](n): y done file1,v --> file1 no revisions present; generating empty revision 0.0 co: warning: no revisions, so nothing can be locked co: output error: Bad file number co aborted Quoting Arthur Gabe <[email protected]>: > # ----------------------- rcs co bug ------------------------ > # > # when the rcs "co" command is given a file list which contains an > # rcs file that has no revison, e.g., rcs -i file, it fails > # with the following "Bad file number" error after failing to process the > # empty rev file and does not check out any remaining files in the list. > # > # no revisions present; generating empty revision 0.0 > # co: output error: Bad file number > # co aborted > # > # This only happens if the empty rev file is *not* first in the list, > # > # In this test, only the first two runs will succeed > # because only those tests have the file with the empty revision first > in the list > > for test in "1 2 3" "1 3 2" "2 1 3" "2 3 1" "3 1 2" "3 2 1" > do > echo "--------------- test: $test ---------------" > echo "remove all test files" > rm -f co_bug.* > echo "use rcs -i to create co_bug.1,v file" > rcs -i -t-test co_bug.1 > echo "use ci to create empty co_bug.2,v and co_bug.3,v files" > touch co_bug.2 co_bug.3 > ci -t-test co_bug.2 co_bug.3 > rcsfiles="" > files="" > for ext in $test > do > rcsfiles="$rcsfiles co_bug.$ext,v" > files="$files co_bug.$ext" > done > echo "use co -f $rcsfiles to check out all files" > co -f $rcsfiles > exit_status=$? > echo "co -f exit status : \$? = $exit_status" > echo "use ls -l to list all checked out files" > ls -l $files > done >$0.out 2>&1