This file is indexed.

/usr/bin/tkaeca is in aegis-tk 4.24.3-3.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
#!/bin/sh
#-*-tcl-*-
#
#	aegis - project change supervisor
#	Copyright (C) 1999-2002, 2006-2008 Peter Miller
#
#	This program is free software; you can redistribute it and/or modify
#	it under the terms of the GNU General Public License as published by
#	the Free Software Foundation; either version 3 of the License, or
#	(at your option) any later version.
#
#	This program is distributed in the hope that it will be useful,
#	but WITHOUT ANY WARRANTY; without even the implied warranty of
#	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#	GNU General Public License for more details.
#
#	You should have received a copy of the GNU General Public License
#	along with this program. If not, see
#	<http://www.gnu.org/licenses/>.
#
#	script/tkaeca.  Generated from tkaeca.in by configure.
#
# comments wrap in Tcl, but not in sh \
exec wish $0 ${1+"$@"}

set bindir /usr/bin
set libdir /usr/share/aegis
set datadir /usr/share/aegis
set datarootdir /usr/share/aegis

wm title . Aeca
wm iconname . Aeca
wm iconbitmap . @$datadir/aegis.icon
wm iconmask . @$datadir/aegis.mask

proc inform { arg } {
    .info.blurb insert end $arg
    .info.blurb see end
    .info.blurb insert end "\n"
    update
}

proc read_pipe { command errok } {
    set data ""
    set fd [open $command r]
    if { $fd != "" } {
	set data [read $fd]
	set codevar ""
	catch { close $fd } codevar
	if { $codevar != "" && !$errok } {
	    inform [format "Command \"%s\"\nreturned \"%s\"" \
		$command $codevar]
	}
    }
    return [string trim $data]
}

proc command_option_menu { w varName cmd firstValue args } {
    upvar #0 $varName var

    if {![info exists var]} {
	set var $firstValue
    }
    menubutton $w \
	-textvariable $varName \
	-indicatoron 1 \
	-menu $w.menu \
	-relief raised \
	-bd 2 \
	-highlightthickness 2 \
	-anchor c \
	-direction flush
    menu $w.menu -tearoff 0
    $w.menu add radiobutton -label $firstValue -variable $varName
    foreach i $args {
	$w.menu add radiobutton -label $i -variable $varName \
    	    -command $cmd
    }
    return $w.menu
}

proc project_drop_list { } {
    global project_name
    global project_list
    set x [winfo rootx .id.project.button]
    set y [winfo rooty .id.project.button]
    catch { destroy .popup } errcode
    toplevel .popup
    wm overrideredirect .popup 1
    wm geometry .popup +$x+$y
    listbox .popup.list -height 12 -selectmode single \
	-yscrollcommand ".popup.scroll set"
    set pos -1
    foreach pn $project_list {
	if { $pn == $project_name } { set pos [.popup.list size] }
	.popup.list insert end $pn
    }
    if { $pos >= 0 } {
	.popup.list selection set $pos
	.popup.list see $pos
    }
    scrollbar .popup.scroll -command ".popup.list yview"
    pack .popup.scroll -side right -fill y
    pack .popup.list -side left
    bind .popup.list <Double-Button-1> {
	set item [.popup.list curselection]
	if { $item != "" } { set item [.popup.list get $item] }
	if { $item != "" } {
    	    set project_name $item
    	    project_name_changed
	}
	destroy .popup
    }
}

proc project_name_changed { } {
    global project_name
    global change_number
    global change_list
    global datadir

    #
    # Ask Aegis for the list of projects names.  We use a specialized
    # report script which emits TCL code to set the project_list
    # variable.  ASSUMES project_name is valid!
    #
    inform [format "Reading project %s change list..." $project_name]
    eval [read_pipe [format \
	"|aereport -f %s/wish/chan_list.rpt -unf -pw=1000 -project=%s" \
	$datadir $project_name] 0]

    #
    # Set the change_number variable.  We need to ask Aegis for this,
    # so that we get what *aegis* thinks is the default change number.
    #
    inform [format "Reading project %s default change number..." $project_name]
    set change_number [read_pipe [format \
	"|aegis -list default_change -project=%s" $project_name ] 1 ]
    if { $change_number == "" } {
	set change_number [lindex $change_list 0]
    }

    change_number_changed
    inform "   ...done"
}

proc change_drop_list { } {
    global change_number
    global change_list
    set x [winfo rootx .id.change.button]
    set y [winfo rooty .id.change.button]
    catch { destroy .popup } errcode
    toplevel .popup
    wm overrideredirect .popup 1
    wm geometry .popup +$x+$y
    listbox .popup.list -height 12 -selectmode single \
	-yscrollcommand ".popup.scroll set"
    set pos -1
    foreach cn $change_list {
	if { $cn == $change_number } { set pos [.popup.list size] }
	.popup.list insert end $cn
    }
    if { $pos >= 0 } {
	.popup.list selection set $pos
	.popup.list see $pos
    }
    scrollbar .popup.scroll -command ".popup.list yview"
    pack .popup.scroll -side right -fill y
    pack .popup.list -side left
    bind .popup.list <Double-Button-1> {
	set item [.popup.list curselection]
	if { $item != "" } { set item [.popup.list get $item] }
	if { $item != "" } {
    	    set change_number $item
    	    change_number_changed
	}
	destroy .popup
    }
}

proc change_number_changed { } {
    global project_name
    global change_number
    global test_nor test_bas test_reg cause state
    global datadir

    #
    # Ask Aegis for the change attributes
    #
    inform [format "Reading project %s change %s attributes..." \
	$project_name $change_number]
    eval [read_pipe [format "|aereport -f %s/wish/chan_attr.rpt -unf -pw=1000 \
-project=%s -change=%s" $datadir $project_name $change_number] 0]
    #
    # Set the values of the text widgets explicitly,
    # they don't take -textvariable options.
    #
    .bdesc.text delete 1.0 end
    .bdesc.text insert end $brief_description
    .desc.text delete 1.0 end
    .desc.text insert end $description
}

#
# Create the widget heirarchy first
#	so the user has somethign to look at while we fetch
#	the necessary information.
#
frame .id
frame .id.project
label .id.project.label -text "Project:"
pack .id.project.label -side left
button .id.project.button -textvariable project_name -command project_drop_list
pack .id.project.button -side left
pack .id.project -side left
frame .id.change
label .id.change.label -text "Change:"
pack .id.change.label -side left
button .id.change.button -textvariable change_number -command change_drop_list
pack .id.change.button -side left
pack .id.change -side left -padx 20
frame .id.state
label .id.state.label -text "State:"
pack .id.state.label -side left
label .id.state.value -textvariable state
pack .id.state.value -side left
pack .id.state -side left
pack .id -side top -anchor w -pady 5

frame .bdesc
label .bdesc.label -text "Brief Description:"
pack .bdesc.label -side top -anchor w
text .bdesc.text -height 1
pack .bdesc.text -side bottom -fill x
pack .bdesc -fill x

frame .desc
label .desc.label -text "Description:"
pack .desc.label -side top -anchor w
text .desc.text -height 8 -yscrollcommand ".desc.scroll set" -wrap word \
    -spacing3 5
scrollbar .desc.scroll -command ".desc.text yview"
pack .desc.scroll -side right -fill y
pack .desc.text -side bottom -fill both -expand 1
pack .desc -fill both -expand 1

frame .bottom

set test_nor 1
set test_bas 1
set test_reg 1

frame .bottom.tests -relief ridge -width 100 -borderwidth 2
label .bottom.tests.label -text "Testing Required:"
pack .bottom.tests.label -side top -anchor w
checkbutton .bottom.tests.normal -text "Normal (Positive)" \
    -variable test_nor -onvalue 1 -offvalue 0
pack .bottom.tests.normal -side top -anchor w
checkbutton .bottom.tests.baseline -text "Baseline (Negative)" \
    -variable test_bas -onvalue 1 -offvalue 0
pack .bottom.tests.baseline -side top -anchor w
checkbutton .bottom.tests.regression -text "Regression" -variable test_reg \
    -onvalue 1 -offvalue 0
pack .bottom.tests.regression -side top -anchor w
pack .bottom.tests -side left -padx 5 -pady 5 -anchor nw

frame .bottom.control
button .bottom.control.ok -text "OK" -bg "#BFD0BF" -command "do_it"
pack .bottom.control.ok -fill x -pady 5
button .bottom.control.apply -text "Apply" -bg "#BFD0BF" -command "apply_it"
pack .bottom.control.apply -fill x
button .bottom.control.cancel -text "Cancel" -command { exit 1 } -bg "#D0BFBF"
pack .bottom.control.cancel -fill x -pady 5
pack .bottom.control
pack .bottom.control -side right -padx 5

frame .bottom.cause -relief ridge -borderwidth 2
label .bottom.cause.label -text "Cause:"
pack .bottom.cause.label -side top -anchor w
radiobutton .bottom.cause.intbug -text "Internal Bug" -value "internal_bug" \
    -variable cause -anchor w
pack .bottom.cause.intbug -side top -anchor w
radiobutton .bottom.cause.intenh -text "Internal Enhancement" \
    -value "internal_enhancement" -variable cause -anchor w
pack .bottom.cause.intenh -side top -anchor w
radiobutton .bottom.cause.intimp -text "Internal Improvement" \
    -value "internal_improvement" -variable cause -anchor w
pack .bottom.cause.intimp -side top -anchor w
radiobutton .bottom.cause.extbug -text "External Bug" -value "external_bug" \
    -variable cause -anchor w
pack .bottom.cause.extbug -side top -anchor w
radiobutton .bottom.cause.extenh -text "External Enhancement" \
    -value "external_enhancement" -variable cause -anchor w
pack .bottom.cause.extenh -side top -anchor w
radiobutton .bottom.cause.extimp -text "External Improvement" \
    -value "external_improvement" -variable cause -anchor w
pack .bottom.cause.extimp -side top -anchor w
radiobutton .bottom.cause.chain -text "Chain Defect" -value "chain" \
    -variable cause -anchor w
pack .bottom.cause.chain -side top -anchor w
pack .bottom.cause -side left -anchor nw -pady 5

pack .bottom -fill x

frame .info
text .info.blurb -height 3 -yscrollcommand ".info.scroll set" \
    -wrap word -borderwidth 1
scrollbar .info.scroll -command ".info.blurb yview" -borderwidth 1
pack .info.scroll -side right -fill y
pack .info.blurb -side left -fill both -expand 1
pack .info -side bottom -fill both -expand 1

#
# Ask Aegis for the list of projects names.  We use a specialized report
# script which emits TCL code to set the project_list variable.
#
inform "Reading list of projects..."
eval [read_pipe [format "|aereport -f %s/wish/proj_list.rpt -unf\
-pw=1000" $datadir] 0]

#
# Set the project_name variable.  We need to ask Aegis for this, so that
# we get what *aegis* thinks is the default project name.
#
inform "Reading default project..."
set project_name [read_pipe "|aegis -list default_project" 1]
if { $project_name == "" } { set project_name [lindex $project_list 0] }

project_name_changed

set errorCode 0

proc apply { } {
    global brief_description description cause
    global test_nor test_bas test_reg
    global project_name change_number
    global errorCode

    set filename [format "/tmp/tkaeca-%d" [pid]]
    set errcode ""
    catch { set fd [open $filename w 0600] } errcode
    if { $fd == "" } {
	    inform [format "Open %s: %s" $filename $errcode]
	    set errorCode 1
	    return
    }

    set brief_description [.bdesc.text get 1.0 end]
    set description [.desc.text get 1.0 end]
    set tmp $brief_description
    regsub -all {[\\"]} $tmp {\\&} tmp
    regsub -all \n $tmp \\n\\\n tmp
    puts $fd [format "brief_description = \"%s\";" $tmp]
    set tmp $description
    regsub -all {[\\"]} $tmp {\\&} tmp
    regsub -all \n $tmp \\n\\\n tmp
    puts $fd [format "description = \"%s\";" $tmp]
    puts $fd [format "cause = %s;" $cause]
    if { $test_nor } \
    then { puts $fd "test_exempt = false;" } \
    else { puts $fd "test_exempt = true;" }
    if { $test_bas } \
    then { puts $fd "test_baseline_exempt = false;" } \
    else { puts $fd "test_baseline_exempt = true;" }
    if { $test_reg } \
    then { puts $fd "regression_test_exempt = false;" } \
    else { puts $fd "regression_test_exempt = true;" }
    close $fd

    inform [format "Setting project %s change %s attributes..." \
	$project_name $change_number]
    set command [list aegis -ca -f $filename -p $project_name -c $change_number]
    inform [format "Command = \"%s\"" $command]
    set errcode ""
    set errorCode 0
    catch { eval exec $command } errcode
    set errorCode2 $errorCode
    catch { exec rm -f $filename } errcode2
    if { $errorCode != 0 } {
	    inform $errcode
    } {
	    inform "   ...done"
    }
    set errorCode $errorCode2
}

proc do_it { } {
	global errorCode
	apply
	if { $errorCode == 0 } {
		exit 0
	}
}

proc apply_it { } {
	apply
}