GNU bug report logs -
#41914
[PATCH] Propagate return value of auto-loaded command
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your message dated Wed, 17 Jun 2020 18:19:03 -0500
with message-id <5EEAA4E7.30001 <at> gmail.com>
and subject line Re: bug#41914: [PATCH] Propagate return value of auto-loaded command
has caused the debbugs.gnu.org bug report #41914,
regarding [PATCH] Propagate return value of auto-loaded command
to be marked as done.
(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)
--
41914: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=41914
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
[Message part 3 (text/plain, inline)]
Hi,
I think I found a bug in proc unknown in lib/framework.exp.
Patch describing the problem and fixing it attached below.
Thanks,
- Tom
[0001-Propagate-return-value-of-auto-loaded-command.patch (text/x-patch, inline)]
Propagate return value of auto-loaded command
Consider a library file foo.tcl:
...
$ cat lib/foo.tcl
proc foo { } {
return "foo-return"
}
...
and a test-case test.tcl:
...
$ cat test.tcl
\#!/usr/bin/tclsh
auto_mkindex lib *.tcl
lappend auto_path [pwd]/lib
set res [foo]
puts "RES: $res"
...
which gives us:
...
$ ./test.tcl
RES: foo-return
...
When overriding the ::unknown command using:
...
rename ::unknown ::tcl_unknown
proc unknown args {
if {[catch {uplevel 1 ::tcl_unknown $args} msg]} {
puts "ERROR: proc \"$args\" does not exist."
exit
}
}
...
we have instead:
...
$ ./test.tcl
RES:
...
What is missing, is the propagation of the return value of foo, like this:
...
puts "ERROR: proc \"$args\" does not exist."
exit
}
-}
+} else {
+ return $msg
+}
...
Fix unknown in lib/framework.exp accordingly.
ChangeLog:
2020-06-17 Tom de Vries <tdevries <at> suse.de>
* lib/framework.exp (unknown): Propagate return value of auto-loaded
command.
---
lib/framework.exp | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lib/framework.exp b/lib/framework.exp
index e6ce197..c9875d2 100644
--- a/lib/framework.exp
+++ b/lib/framework.exp
@@ -272,6 +272,9 @@ proc unknown args {
}
set exit_status 2
log_and_exit
+ } else {
+ # Propagate return value.
+ return $msg
}
}
[Message part 5 (message/rfc822, inline)]
Tom de Vries wrote:
> I think I found a bug in proc unknown in lib/framework.exp.
>
> Patch describing the problem and fixing it attached below.
>
I found and fixed the same bug while working on the patch for bug #41824.
-- Jacob
This bug report was last modified 5 years and 44 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.