When researching for my previous 2 reports, I thought it would be useful to see the shell command that runcmd
was called to do. So I patched in a Dbg
:
@@ -1053,6 +1053,7 @@
###############################################################################
proc run-command {cmd {out {}}} {
global ASYNc errorCode
+ Dbg "runcmd cmd=$cmd; out=$out"
# Arrange for requested output format (given execution constraints)
# N.B> 'fout' will become one of: a channel, a cmd indirection, or empty.
But this made tkiff crash:
13:51:10$ tkdiff -d -v184
Dbg: Running TkDiff 5.5.2
Dbg: 0 filespecs, 1-0 revisions
Dbg: Recovered 0 filespecs, 1 revisions
Dbg: PAIRing SCM(/) Fspec(0) Rev(1) Tchk()
Dbg: Posted ASYNc(trigger)(after#0)
Dbg: runcmd cmd=svn diff --summarize -r 184; out=
Dbg: temp file /usr/tmp/23991-cmderr-1
Dbg: Cmd running in ASYNC mode
Dbg: Back from ASYNC cmd: rc(0)
Dbg: temp file /usr/tmp/23991-scm1-2
Dbg: scm-chkget (1) -> 'svn cat -r 184 "CHANGELOG.txt"': /usr/tmp/23991-scm1-2
Error in startup script: extra characters after close-quote
while executing
"set na "runcmd cmd=svn cat -r 184 "C"
("uplevel" body line 1)
invoked from within
"uplevel 1 set na "\"$message\"""
(procedure "Dbg" line 5)
invoked from within
"Dbg "runcmd cmd=$cmd; out=$out""
(procedure "run-command" line 3)
invoked from within
"run-command "$finfo(${A}tmp,$ndx)" "$finfo(${A}pth,$ndx)""
(procedure "scm-chkget" line 14)
invoked from within
"scm-chkget ${A}$ndx"
(procedure "get-file-rev" line 206)
invoked from within
"get-file-rev $file $cnt $rev($i) SVN"
(procedure "inquire-svn" line 84)
invoked from within
"inquire-svn $revs"
(procedure "assemble-args" line 153)
invoked from within
"assemble-args"
(procedure "main" line 72)
invoked from within
"main"
When I looked int Dbg {}
itself, I found it was doing an uplevel
with the debug data in double-quotes. I changed these to braces:
@@ -65,7 +65,7 @@
global g
if {$force >= 0 && ($g(debug) || $force)} {
- puts $where "$hdr[uplevel 1 set na "\"$message\""]"
+ puts $where "$hdr[uplevel 1 set na "\{$message\}"]"
}
}
This cleared the crash:
14:00:56$ tkdiff -d -v184
Dbg: Running TkDiff 5.5.2
Dbg: 0 filespecs, 1-0 revisions
Dbg: Recovered 0 filespecs, 1 revisions
Dbg: PAIRing SCM(/) Fspec(0) Rev(1) Tchk()
Dbg: Posted ASYNc(trigger)(after#0)
Dbg: runcmd cmd=svn diff --summarize -r 184; out=
Dbg: temp file $fnam
Dbg: Cmd running in ASYNC mode
Dbg: Back from ASYNC cmd: rc(0)
Dbg: temp file $fnam
Dbg: scm-chkget ($ndx) -> '$finfo(${A}tmp,$ndx)': $finfo(${A}pth,$ndx)
Dbg: runcmd cmd=svn cat -r 184 "CHANGELOG.txt"; out=/usr/tmp/24912-scm1-2
Dbg: temp file $fnam
Dbg: Cmd running in ASYNC mode
Dbg: Back from ASYNC cmd: rc(0)
Dbg: Final: 1 revs 0 filespecs -> 6/2 pairings 0 Err
Dbg: ASYNC mode has been dropped
Dbg: Assigning labels to headers
Dbg: PROPOSED wm grid is WxH($GW(1)x$GH(1)) of WxH($GcW(1)x$GcH(1))pxls\n \twhile PREVsz was WxH($GW(0)x$GH(0)) ($GcW(0)x$GcH(0))
Dbg: Trim BOTH L/R to NEW computed width($GW(1)) - and detach gridding
Dbg: NEW wm grid is ($GW($i) X $GH($i)) ($GcW(1) x $GcH(1))
Dbg: centering(${wWidth}x$wHeight) onto parent(${pWidth}x$pHeight)
Dbg: Centering has targeted at $ctr above parent @($pX,$pY)
Dbg: Custom code IS in use...beware
Dbg: is3way(0)
Dbg: MergeFileSet(0): /usr/src/tkdiff/CHANGELOG-merge.txt
Dbg: runcmd cmd=diff /usr/tmp/24912-scm1-2 CHANGELOG.txt; out=
Dbg: temp file $fnam
Dbg: DIFF([llength $g(DIFF)]) .vs. diff([llength $g(diff)])
Dbg: Left ancestral datums: [llength $g(d3Left)]
I then noticed lots of Dbg calls with the argument in braces, leading to output like temp file $fnam
above. So I patched all such Dbg calls to use double quotes giving:
14:09:47$ tkdiff -d -v184
Dbg: Running TkDiff 5.5.2
Dbg: 0 filespecs, 1-0 revisions
Dbg: Recovered 0 filespecs, 1 revisions
Dbg: PAIRing SCM(/) Fspec(0) Rev(1) Tchk()
Dbg: Posted ASYNc(trigger)(after#0)
Dbg: runcmd cmd=svn diff --summarize -r 184; out=
Dbg: temp file /usr/tmp/25721-cmderr-1
Dbg: Cmd running in ASYNC mode
Dbg: Back from ASYNC cmd: rc(0)
Dbg: temp file /usr/tmp/25721-scm1-2
Dbg: scm-chkget (1) -> 'svn cat -r 184 "CHANGELOG.txt"': /usr/tmp/25721-scm1-2
Dbg: runcmd cmd=svn cat -r 184 "CHANGELOG.txt"; out=/usr/tmp/25721-scm1-2
Dbg: temp file /usr/tmp/25721-cmderr-3
Dbg: Cmd running in ASYNC mode
Dbg: Back from ASYNC cmd: rc(0)
Dbg: Final: 1 revs 0 filespecs -> 6/2 pairings 0 Err
Dbg: ASYNC mode has been dropped
Dbg: Assigning labels to headers
Dbg: PROPOSED wm grid is WxH(80x30) of WxH(8x15)pxls
while PREVsz was WxH(x) (x)
Dbg: Trim BOTH L/R to NEW computed width(80) - and detach gridding
Dbg: NEW wm grid is (160 X 30) (8 x 15)
Dbg: centering(724x442) onto parent(1628x588)
Dbg: Centering has targeted at =+1102+920 above parent @(650,847)
Dbg: Custom code IS in use...beware
Dbg: is3way(0)
Dbg: MergeFileSet(0): /usr/src/tkdiff/CHANGELOG-merge.txt
Dbg: runcmd cmd=diff /usr/tmp/25721-scm1-2 CHANGELOG.txt; out=
Dbg: temp file /usr/tmp/25721-cmderr-4
Dbg: DIFF(1) .vs. diff(1)
Dbg: Left ancestral datums: 0
Dbg: Right ancestral datums: 0
The 2 patches are attached. I hope you see fit to apply them.
BTW, there isn't any custom code
Scrub this: I should have used braces:
A bit counter-intuitive perhaps, but it works.
Also @vampm emailed me this:
@vampm also explained that by having Dbg take an arg in braces, the interpreter doesn't need to expand the arg when debugging is off. Neat.
Last edit: Duncan Roe 2022-09-04
Unneeded. Ability exists via alternate methods.