File: locks.sh

package info (click to toggle)
cssc 1.0.1-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 3,612 kB
  • ctags: 1,424
  • sloc: cpp: 13,502; sh: 4,759; ansic: 2,971; perl: 342; makefile: 339; awk: 11
file content (125 lines) | stat: -rw-r--r-- 3,027 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#! /bin/sh

# flags.sh:  Testing for setting /unsetting flags.

# Import common functions & definitions.
. ../common/test-common

g=new.txt
s=s.$g
p=p.$g
remove foo $s $g $p [zx].$g

# Create SCCS file with a substituted keyword.
echo '%M%' >foo
docommand k1 "${admin} -ifoo $s" 0 "" ""



## Sourceforge bug number 121599: "admin -dla" causes crash.
## Project: CSSC
## Category: SCCS incompatibility
## Status: Open
## Resolution: None
## Bug Group: defect
## Priority: 5
## Summary: "admin -dla" crashs
## 
## Details: if you do:
## 
## 	   admin -dla /usr/local/sccs/tmp/Xmt
## 
## to unlock all versions, admin will crash.
## 
## "-d" ends up invoking sf-admin.cc : sccs_file::admin, and the loop
## associated with unset_flags. (I believe that the loop associated
## with set_flags also has the same problem). A check is made to
## distingish "-da" from "-d#", and for the case of "-da", the code
## will do:
## 
## 		 flags.all_locked = 0;
## 		 flags.locked = NULL;
## 
## Note that flags.locked is a release_list, so this will invoke
## 
## 	   release_list::release_list(0)
## 
## The constructor in rel_list.cc reads:
## 
## 	   release_list::release_list(const char *s)
## 	   {
## 	     ASSERT(NULL != s);
## 
## I believe that the null case should be treated as a
## 
## 	   release_list::release_list()
## 
## so I made the following change:
## 
## 	   release_list::release_list(const char *s)
## 	   {
## 	     if (NULL == s) {
## 		return;
## 	     }
## 
## which emulates a class creation with no arguements.
## 

docommand k2 "${admin} -dla $s" 0 IGNORE IGNORE


docommand k3 "${admin} -fla $s" 0 IGNORE IGNORE

# Now, all revisions are locked.   A 'get' must fail.
docommand k4 "${get} -e $s" 1 IGNORE IGNORE

# Remove the locks and try again. (This test is a repeat of 
# test k2, but is required for the next test to work).
docommand k5 "${admin} -dla $s" 0 IGNORE IGNORE
docommand k6 "${get} -e $s" 0 IGNORE IGNORE
remove  $p $g

# Lock just release 2; a get should work, since we are getting release 1.
docommand k7 "${admin} -fl2 $s" 0 IGNORE IGNORE
docommand k8 "${get} -e $s" 0 IGNORE IGNORE

# we may not have "prt".
# docommand k8a "${prt} -f $s | 
# 	sed -n -e 's/.*releases//p'" 0 "\t2\n" IGNORE
docommand k8a "${prs} -d:LK: $s" 0 "2\n" IGNORE

remove $p $g

# Lock release 1 as well; a get should fail.
docommand k9 "${admin} -fl1 $s" 0 IGNORE IGNORE

# CSSC and SCCS differ in terms of the order they list the locked
# releases in.
# Locking release 1 should implicitly unlock release 2
# (Solaris 2.6 does this).
docommand k9a "${prs} -d:LK: $s" 0 "1\n" IGNORE

docommand k10 "${get} -e $s" 1 IGNORE IGNORE
remove $p $g


# Remove lock on release 1; things should work now.
docommand k13 "${admin} -dl1 $s" 0 IGNORE IGNORE
docommand k14 "${get} -e $s" 0 IGNORE IGNORE
remove $p $g



docommand k15 "${admin} -fla $s" 0 IGNORE IGNORE
docommand k16 "${prs} -d:LK: $s" 0 "a\n" IGNORE

remove $s $g $p

###
### Cleanup and exit.
###
rm -rf test 
remove foo $s $g $p [zx].$g command.log

success