msteveb / jimtcl Goto Github PK
View Code? Open in Web Editor NEWOfficial repository of Jim Tcl, an open-source, small footprint implementation of Tcl
Home Page: http://jim.tcl.tk/
License: Other
Official repository of Jim Tcl, an open-source, small footprint implementation of Tcl
Home Page: http://jim.tcl.tk/
License: Other
Jim Tcl's built-in support for Unicode is a very useful feature and sets it apart from other embedded interpreters like pre-5.3 Lua. However, enabling UTF-8 means that commands like string index
will operate on characters and not bytes, so the user has to choose between UTF-8 and being able to handle byte strings as easily as in "big" Tcl. I don't know how much this limitation affects other users of Jim Tcl, but it has caused me some problems, most noticeably when I was writing a JPEG decoder. I am opening this issue as a place to aggregate and discuss the possible ways to improve Jim's ability to handle both byte and UTF-8 strings in the same build.
I see three major ways to do it, each with its own drawbacks:
string byteindex
and string byterange
like string bytelength
(downside: different from Tcl 8.x and feels ad hoc).What do you think?
I also use some the 'hidden' options. I copied your fix from auto.def
patch-autosetup_system_tcl.txt
.
How would I use this with Tk? I am looking to create Tcl/Tk builds for people to download. Would I still need to compile Tk from http://sourceforge.net/projects/tcl ?
This can be tested by building sqlite3 as a module; libsqlite3 will be linked into jimsh and libjim, which I don't think is needed or desired.
Hello,
I was using American Fuzzy Lop (afl-fuzz) to fuzz input and found a few inputs that cause crashes. Is fixing these crashes something you're interested in? The input files can be found here: https://github.com/rwhitworth/jimtcl-fuzz/ and they have been trimmed down to the smallest possible set of test cases using afl-cmin.
The files are inputs that can be executed as jimsh id:00:xx
to cause seg faults
Let me know if I can provide any more information to help narrow down this issue.
According to the docs, the Jim version of package require
is supposed to support an optional version number, but it fails with
Error: wrong # args: should be "package cmd pkg"
I got as far as seeing that this has something to do with proc package
not declaring its optional arity correctly, but my Tcl fu is not strong enough to provide a patch.
My immediate need is to check for compatibility with a particular version of Tcl, but this may affect other packages.
That then begs the question, what version of Tcl should Jim claim to be equivalent to? There are elements from Tcl 8.6 (e.g. lmap
), but there are also many things in 8.6 that Jim either doesn't support statically or which may be compiled out in the current build (e.g. file normalize
).
Hi,
Really liking jimtcl, and attempting to embed it as the primary shell to my embedded kernel. Is there any documentation on the C api? Or should I roughly take the official TCL c api documentation as a reference?
I want to create some commands that create some objects (which can be garbage collected) that are returned and can be manipulated in a script.
Are there any examples of this? I.e. Other than a string or int object.
James
Hi!
I can't compile the bootstrap version of jim on MinGW 4.5.1 due to the strtod
define in jim-win32compat.h
made in 92aaf45. The compiler gives the following errors:
In file included from jimsh0.c:177:0:
d:\dev\build-env\mingw-tdm-4.5.1\dw2\bin\../lib/gcc/mingw32/4.5.1-dw2/../../../.
./include/stdlib.h:319:1: error: static declaration of '__strtod' follows non-st
atic declaration
d:\dev\build-env\mingw-tdm-4.5.1\dw2\bin\../lib/gcc/mingw32/4.5.1-dw2/../../../.
./include/stdlib.h:312:32: note: previous declaration of '__strtod' was here
I could get the compilation working by including stdlib.h just before the define.
Jim_String has an objPtr->typePtr check.
Should this check also be in JimGetString and Jim_Length?
I'm using this patch.
--- Makefile.in.orig Sun Apr 5 12:22:11 2015
+++ Makefile.in Sun Apr 5 12:24:43 2015
@@ -112,7 +112,7 @@
@endif
test check: $(JIMSH)
- cd @srcdir@/tests; $(DEF_LD_PATH) $(MAKE) jimsh=@builddir@/jimsh
+ cd @srcdir@/tests; $(DEF_LD_PATH) JIMLIB='@top_srcdir@' $(MAKE) jimsh=@builddir@/jimsh
$(OBJS): Makefile $(wildcard *.h)
Hi,
Jakub Wilk (@jwilk) has noticed that jimtcl doesn't respect TMPDIR. A rapid grep shows the following occurences in latest master:
exec2-3.2 now fails for MSYS2 builds on Windows. According to https://ci.appveyor.com/project/msteveb/jimtcl/history, the branch master started to fail after 88d693a.
exec2-3.2 ERR close pipeline return value
At : exec2.test:55
Expected: '1 {child killed*} CHILDKILLED SIGPIPE'
Got : '1 {child process exited abnormally} CHILDSTATUS 1'
Hello,
I was using American Fuzzy Lop (afl-fuzz) to fuzz input the jimsh
program. Is fixing the crashes from these input files something you're interested in? The input files can be found here: https://github.com/rwhitworth/jimtcl-fuzz/tree/master/2017-05-25.
The files can be executed as ./jimsh id_filename
to cause seg faults. They were tested against git commit bd5139c.
Let me know if I can provide any more information to help narrow down this issue.
Also, if you're tired of these reports let me know and I'll cease. I understand this sort of report can be frustrating.
jim.h - "This are"
jim.h - "because In"
jim.h - "bodyoObjPtr"
jim.h - "> 0 If"
README.namespaces - "initialse"
README.sqlite - "this arguments contain"
README.sqlite - "emtpy"
README.sqlite - "arugments"
Hello.
I found a stack-overflow bug in jimtcl.
Please confirm.
Thanks.
OS: CentOS 7 64bit
Version: 88c5e1f
PoC Download: ov_ExprTreeBuildTree.zip
Steps to reproduce:
1.Download the .POC files.
2.Compile the source code with ASan.
3.Execute the following command
: ./jimsh $FILE
=================================================================
==11855==ERROR: AddressSanitizer: stack-overflow on address 0x7ffe19053fe0 (pc 0x000000572269 bp 0x7ffe19054150 sp 0x7ffe19053fe0 T0)
#0 0x572268 in ExprTreeBuildTree /home/karas/jimtcl/jim.c:8827
#1 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#2 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#3 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#4 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#5 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#6 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#7 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#8 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#9 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#10 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#11 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#12 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#13 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#14 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#15 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#16 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#17 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#18 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#19 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#20 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#21 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#22 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#23 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#24 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#25 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#26 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#27 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#28 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#29 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#30 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#31 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#32 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#33 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#34 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#35 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#36 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#37 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#38 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#39 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#40 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#41 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#42 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#43 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#44 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#45 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#46 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#47 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#48 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#49 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#50 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#51 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#52 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#53 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#54 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#55 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#56 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#57 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#58 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#59 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#60 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#61 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#62 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#63 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#64 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#65 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#66 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#67 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#68 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#69 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#70 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#71 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#72 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#73 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#74 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#75 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#76 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#77 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#78 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#79 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#80 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#81 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#82 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#83 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#84 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#85 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#86 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#87 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#88 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#89 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#90 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#91 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#92 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#93 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#94 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#95 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#96 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#97 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#98 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#99 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#100 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#101 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#102 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#103 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#104 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#105 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#106 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#107 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#108 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#109 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#110 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#111 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#112 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#113 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#114 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#115 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#116 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#117 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#118 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#119 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#120 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#121 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#122 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#123 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#124 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#125 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#126 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#127 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#128 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#129 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#130 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#131 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#132 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#133 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#134 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#135 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#136 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#137 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#138 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#139 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#140 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#141 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#142 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#143 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#144 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#145 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#146 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#147 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#148 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#149 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#150 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#151 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#152 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#153 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#154 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#155 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#156 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#157 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#158 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#159 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#160 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#161 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#162 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#163 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#164 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#165 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#166 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#167 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#168 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#169 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#170 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#171 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#172 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#173 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#174 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#175 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#176 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#177 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#178 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#179 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#180 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#181 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#182 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#183 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#184 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#185 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#186 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#187 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#188 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#189 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#190 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#191 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#192 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#193 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#194 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#195 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#196 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#197 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#198 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#199 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#200 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#201 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#202 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#203 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#204 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#205 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#206 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#207 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#208 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#209 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#210 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#211 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#212 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#213 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#214 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#215 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#216 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#217 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#218 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#219 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#220 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#221 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#222 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#223 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#224 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#225 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#226 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#227 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#228 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#229 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#230 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#231 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#232 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#233 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#234 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#235 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#236 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#237 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#238 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#239 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#240 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#241 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#242 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#243 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#244 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#245 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#246 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#247 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#248 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
#249 0x572863 in ExprTreeBuildTree /home/karas/jimtcl/jim.c
SUMMARY: AddressSanitizer: stack-overflow /home/karas/jimtcl/jim.c:8827 in ExprTreeBuildTree
==11855==ABORTING
I have found that the following build sequence fails:
./configure && make
mkdir build2
cd build2
../configure && make
This appears to be due to VPATH confusing the make system and causing it to partially find jimsh.o in the in-tree source directory even when building out-of-tree.
Replacing the VPATH statement with the following seems to fix it:
vpath %.h ..
vpath %.c ..
vpath %.tcl ..
i.e. only search for sources in the source directory - not objects/libs
Regards,
Evan
Hi again. Continued fuzz testing came up with more inputs worth looking at.
See here: https://github.com/rwhitworth/jimtcl-fuzz/tree/master/2017-08-03
I compiled a 'hardened' version of jimsh that includes extra memory protections to catch out of bound reads, double free, and other issues. Some of these inputs may not crash a default build of jimsh, so be aware. I would be glad to help double-check any fixes. These were found with a previous version, and were re-confirmed against commit 59f01cb.
gdb output from a few examples so you know what type of stuff is included:
id:000040,sig:06,src:001944,op:havoc,rep:4
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1 0x00007f0416b043fa in __GI_abort () at abort.c:89
#2 0x00007f0416b40bd0 in __libc_message (do_abort=do_abort@entry=2, fmt=fmt@entry=0x7f0416c35dd0 "*** Error in `%s': %s: 0x%s ***\n")
at ../sysdeps/posix/libc_fatal.c:175
#3 0x00007f0416b46f96 in malloc_printerr (action=3, str=0x7f0416c35f28 "double free or corruption (fasttop)", ptr=<optimized out>, ar_ptr=<optimized out>)
at malloc.c:5049
#4 0x00007f0416b477de in _int_free (av=0x7f0416e69b00 <main_arena>, p=0x1ecd550, have_lock=0) at malloc.c:3905
#5 0x000000000040bdc7 in Jim_Free (ptr=0x2) at jim.c:653
#6 Jim_FreeObj (interp=<optimized out>, objPtr=0x1ed3fb0) at jim.c:2194
#7 Jim_SetResultFormatted (interp=<optimized out>, format=<optimized out>) at jim.c:15466
#8 0x000000000041163a in SetBooleanFromAny (flags=1, interp=<optimized out>, objPtr=<optimized out>) at jim.c:6127
#9 Jim_GetBoolean (interp=0x1eaf010, objPtr=0x1ed3fb0, booleanPtr=0x7ffe970ed3bc) at jim.c:6103
#10 0x00000000004222a4 in ExprBool (obj=0x1ed3fb0, interp=<optimized out>) at jim.c:8250
#11 JimExprGetTermBoolean (interp=0x1eaf010, node=<optimized out>) at jim.c:9220
#12 0x00000000004207e6 in JimExprOpAnd (interp=0x1eaf010, node=0x1eda430) at jim.c:8263
#13 0x0000000000415da2 in JimExprEvalTermNode (interp=0x1eaf010, node=0x7ffe970ecc50) at jim.c:9160
#14 0x00000000004148c2 in Jim_EvalExpression (interp=0x1eaf010, exprObjPtr=<optimized out>) at jim.c:9320
#15 0x0000000000419100 in JimExpandExprSugar (interp=0x1eaf010, objPtr=0x7ffe970ecc50) at jim.c:4933
#16 JimSubstOneToken (interp=<optimized out>, token=<optimized out>, objPtrPtr=<optimized out>) at jim.c:10187
#17 JimInterpolateTokens (interp=<optimized out>, token=<optimized out>, tokens=<optimized out>, flags=<optimized out>) at jim.c:10238
#18 0x000000000041828b in Jim_EvalObj (interp=<optimized out>, scriptObjPtr=<optimized out>) at jim.c:10481
#19 0x000000000041a4c8 in Jim_EvalFile (interp=0x1eaf010, filename=<optimized out>) at jim.c:10928
#20 0x000000000040743d in main (argc=<optimized out>, argv=0x7ffe970ed7f8) at jimsh.c:140
id:000377,sig:11,src:007620,op:ext_AO,pos:476
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1 0x00007f1f7d7073fa in __GI_abort () at abort.c:89
#2 0x00007f1f7d743bd0 in __libc_message (do_abort=do_abort@entry=2, fmt=fmt@entry=0x7f1f7d838dd0 "*** Error in `%s': %s: 0x%s ***\n")
at ../sysdeps/posix/libc_fatal.c:175
#3 0x00007f1f7d749f96 in malloc_printerr (action=3, str=0x7f1f7d838f08 "double free or corruption (top)", ptr=<optimized out>, ar_ptr=<optimized out>)
at malloc.c:5049
#4 0x00007f1f7d74a7de in _int_free (av=0x7f1f7da6cb00 <main_arena>, p=0xd0f660, have_lock=0) at malloc.c:3905
#5 0x000000000041e805 in Jim_Free (ptr=0x2) at jim.c:653
#6 FreeListInternalRep (interp=<optimized out>, objPtr=<optimized out>) at jim.c:6168
#7 0x000000000041d51c in Jim_FreeObj (interp=0xce3010, objPtr=0xd0f340) at jim.c:2190
#8 FreeDictSubstInternalRep (interp=0xce3010, objPtr=0xd0bee0) at jim.c:4875
#9 0x000000000041e2af in Jim_FreeObj (objPtr=0xd0bee0, interp=<optimized out>) at jim.c:2190
#10 JimVariablesHTValDestructor (interp=0xce3010, val=0xd0c0e0) at jim.c:3812
#11 0x0000000000408a81 in Jim_FreeHashTable (ht=<optimized out>) at jim.c:921
#12 0x0000000000410afb in JimFreeCallFrame (interp=<optimized out>, cf=<optimized out>, action=<optimized out>) at jim.c:5031
#13 0x000000000040fabe in Jim_FreeInterp (i=<optimized out>) at jim.c:5539
#14 0x000000000040756c in main (argc=<optimized out>, argv=<optimized out>) at jimsh.c:156
id:000452,sig:06,src:007658,op:havoc,rep:8
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1 0x00007f338e8cf3fa in __GI_abort () at abort.c:89
#2 0x00007f338e90bbd0 in __libc_message (do_abort=do_abort@entry=2, fmt=fmt@entry=0x7f338ea00dd0 "*** Error in `%s': %s: 0x%s ***\n")
at ../sysdeps/posix/libc_fatal.c:175
#3 0x00007f338e911f96 in malloc_printerr (action=3, str=0x7f338ea00f08 "double free or corruption (top)", ptr=<optimized out>, ar_ptr=<optimized out>)
at malloc.c:5049
#4 0x00007f338e9127de in _int_free (av=0x7f338ec34b00 <main_arena>, p=0x23c5ff0, have_lock=0) at malloc.c:3905
#5 0x000000000041d556 in Jim_Free (ptr=0x2) at jim.c:653
#6 Jim_FreeObj (interp=<optimized out>, objPtr=0x23c5cf0) at jim.c:2194
#7 FreeDictSubstInternalRep (interp=0x2396010, objPtr=0x23c4620) at jim.c:4875
#8 0x000000000041e2af in Jim_FreeObj (objPtr=0x23c4620, interp=<optimized out>) at jim.c:2190
#9 JimVariablesHTValDestructor (interp=0x2396010, val=0x23bf160) at jim.c:3812
#10 0x0000000000408a81 in Jim_FreeHashTable (ht=<optimized out>) at jim.c:921
#11 0x0000000000410afb in JimFreeCallFrame (interp=<optimized out>, cf=<optimized out>, action=<optimized out>) at jim.c:5031
#12 0x000000000040fabe in Jim_FreeInterp (i=<optimized out>) at jim.c:5539
#13 0x000000000040756c in main (argc=<optimized out>, argv=<optimized out>) at jimsh.c:156
Untested!
--- jim.c.orig Wed Jun 6 16:05:13 2018
+++ jim.c Wed Jun 6 16:05:27 2018
@@ -11183,7 +11183,7 @@ void Jim_WrongNumArgs(Jim_Interp *interp, int argc, Ji
listObjPtr = Jim_NewListObj(interp, argv, argc);
- if (*msg) {
+ if (msg && *msg) {
Jim_ListAppendElement(interp, listObjPtr, Jim_NewStringObj(interp, msg, -1));
}
Jim_IncrRefCount(listObjPtr);
[jianhong@dhcp-12-125 ~]$ jimsh
Welcome to Jim version 0.77
. puts "}$"
}$
. if 1 { puts "}$" } else { puts x }
$
. if 1 { puts "}$" } else { puts x }
}$
I'm using this patch.
--- tcltest.tcl.orig Sun Apr 5 00:30:30 2015
+++ tcltest.tcl Sun Apr 5 00:33:45 2015
@@ -9,7 +9,7 @@ set testinfo(numskip) 0
set testinfo(numtests) 0
set testinfo(failed) {}
-set testdir [file dirname $::argv0]
+set testdir [file dirname [expr {[info exists ::argv0] ? $::argv0 : $::jim::argv0}]]
set bindir [file dirname [info nameofexecutable]]
if {[lsearch $argv "-verbose"] >= 0 || [info exists env(testverbose)]} {
'
jim-tclprefix.c: In function Jim_TclPrefixCoreCommand': jim-tclprefix.c:163: parse error before
int'
jim-tclprefix.c:165: i' undeclared (first use in this function) jim-tclprefix.c:165: (Each undeclared identifier is reported only once jim-tclprefix.c:165: for each function it appears in.) jim-tclprefix.c:165:
listlen' undeclared (first use in this function)
make[1]: *** [jim-tclprefix.o] Error 1
'
Local variables 'i' and 'listen' are declared in the middle of the code block (C99-style) which results in compilation error with C89-only compiler.
This is a separate issue for the bug I found in #57.
Each of the failed tests involves [exec] appending the output of a command to a file. E.g. (this is the MSYS2 shell),
$ ./jimsh.exe -e 'exec echo "First line" >> new.file' && cat new.file /usr/bin/echo: write error: Bad file descriptor
However, the
>
redirect works:$ ./jimsh.exe -e 'exec echo "First line" > new.file' && cat new.file First line
$? => 1
for example, with wrong test(s):
$ make && echo ok
will be "ok" i.e. make
returns 0
see: GNU make manual
Hi! This audacious request is because asciidoc is needed to build the Jim docs.
On OpenBSD this makes the port pull in asciidoc + a bunch of dependencies and it's slow to generate the docs.
Could you please change the docs to another format?
As I said, this is an audacious request and I don't expect you to change your doc format just because I don't like it so much but this was easier to do at this moment than sending an email. :D
Would you like to add more error handling for return values from functions like the following?
MinGW built jimsh have a non-implemented file normalize
. The reason is that MinGW doesn't have realpath()
function.. It would be nice to implement file normalize for systems without realpath
. file normalize
is such an important command that it deserves an implementation that works widely:)
Hi there:
I wanted to ask a question in the mailing list, and I noticed that the "Jim-devel Archives" link is broken.
The page with the broken link is:
http://jim.tcl.tk:8080/cgi-bin/mailman/listinfo/jim-devel
I am reporting it here, because I do not really know whether the mailing list is working.
Thanks,
rdiez
Whilst I personally find it bad style, TCL states that "true", "false", "yes", "no", "on", "off" should be interpreted as their boolean counterparts. jimtcl does not appear to handle this, and is breaking some legacy code of mine.
The following works using libtcl, but not with jimtcl.
set VAR true
if { $VAR } { puts "$VAR is true" }
Is there some plan to support MySQL database in the future?
SIGPIPE doesn't seem to happen.
Do you have compiled versions available
As explained here, http://utf8everywhere.org, accessing files on Windows with non-ansi filenames requires use "wide" APIs. This means using _wfopen rather than fopen, CreateFileW instead of CreateFile, etc.
Here is a list of known APIs that need to be addressed:
when I tried to build the project
sudo gmake install
the makefile complained that
./jim-nvp.h
did not exist. It was defined in the Makefile.in and generated Makefile, however, the file is not in the project. And when I removed the file from the Makefile(s) it built nicely.
Bug-Debian: https://bugs.debian.org/873048
The 0.77 upload to Debian has revealed that this version has regressed on the hppa
architecture, see https://buildd.debian.org/status/logs.php?pkg=jimtcl&arch=hppa
timer-6.5 ERR Tcl_AfterCmd procedure, ms argument
At : timer.test:192
Expected: 'before after'
Got : 'after after'
timer.test: Total 44 Passed 43 Skipped 0 Failed 1
------------------------------------------------------------
FAILED: 1
timer.test:192 timer-6.5
[...]
=========================================================================
Totals: Total 4722 Passed 4502 Skipped 219 Failed 1
As Aaron highlighted:
I'm not sure if this error stemmed from a random glitch or a
consistent problem, but either way tests should consistently
succeed. ;-) Could you please take a look?
I'm happy to help getting that fixed (I can get access to hppa
developer machines) if you have patches.
Asciidoc documentation for [local] claims that its arguments are concatenated as per [eval], which I believe is not true: it interprets its arguments as separate command words without any additional interpretation, like [tailcall]. See line 12598 of jim.c as of commit 666f15f.
(This also happens to be the most reasonable thing to do in a world with {*}. Sadly, [uplevel] doesn't work like this, and changing it will probably break lots of code in subtle ways.)
The documentation for open and exec suggest I should be able to use a pipeline created by open as a file descriptor with exec. I think both of the following execs should produce a list of numbers from 10 to 1:
humax# seq 1 10 > test_input.txt
humax# jimsh
Welcome to Jim version 0.75
. set f [open "test_input.txt" r]
::aio.handle4
. exec sort -rn <@ $f
10
9
8
7
6
5
4
3
2
1
. set f [open "| seq 1 10" r]
<reference.<functio>.00000000000000000000>
. exec sort -rn <@ $f
Not a filehandle: "<reference.<functio>.00000000000000000000>"
[error] .
The backtrace
(3) function is in the libexecinfo
library (-lexecinfo
).
How to make it detectable? I was trying to specify LIBS=-lexecinfo
but it fails.
After updating jimtcl to e62a1bb (from repo.or.cz), when i exec fossil
i'm getting a warning from sqlite3 which is mangling my autosetup output:
SQLITE_WARNING(28): attempt to open \"/home/stephan/fossil/cwal/.fslckout\" as file descriptor 0"
...
SQLITE_WARNING(28): attempt to open \"/home/stephan/fossil/cwal/.fslckout\" as file descriptor 0 built 2018-11-22 07:03"
That happens from running exec fossil info
. i recall Richard adding that warning to sqlite3 because we had a case in fossil where an assert()
caused output to go to file descriptor 0 or 1 and fossil had opened its db with that file descriptor, so the output from assert
overwrote a random part of the database file. i don't recall the remaining details.
i suspect, without being certain, that some recent jimtcl change (sometime since v77) is closing FD's during exec
, freeing up the ID 0 for re-use in the spawned process. When fossil opens up .fslcheckout
, it's getting FD 0, which is a recipe for db corruption.
If i backrev to jimsh version 77, this doesn't happen... but that one is missing the -gmt
flag for clock
, which was the reason i upgraded to version 78 :/.
The domain tcl.tk has been hijacked. More details can be found at Hacker News.
jim.h: managment => management
jim-pack.c: Ihe => The
Hello,
I was using American Fuzzy Lop (afl-fuzz) to fuzz input the jimsh program. Is fixing the crashes from these input files something you're interested in? The input files can be found here: https://github.com/rwhitworth/jimtcl-fuzz/tree/master/2017-05-08.
The files can be executed as ./jimsh id_filename
to cause seg faults.
Let me know if I can provide any more information to help narrow down this issue.
Hi Steve,
If it interests you, I've made an appveyor setup which can build/test both MinGW32 and Visual C++ builds.
https://ci.appveyor.com/project/evanhunter/jimtcl/build/0.77.0.12
It currently runs from this branch: https://github.com/evanhunter/jimtcl/tree/MSVC_support
Regards,
Evan
% zlib gzip a
Will segfault for me on OpenBSD.
This patch fixes the segfault but now I get an empty error message.
Tcl's zlib code is a bit more elaborate where Z_FINISH is concerned.
--- jim-zlib.c.orig Mon Apr 17 10:37:32 2017
+++ jim-zlib.c Mon Apr 17 10:38:03 2017
@@ -98,7 +98,7 @@ static int Jim_Compress(Jim_Interp *interp, const char
* decompressed data anyway, so there's no reason to do chunked
* decompression */
if (deflate(&strm, Z_FINISH) != Z_STREAM_END) {
- Jim_Free(strm.next_out);
+ Jim_Free(buf);
deflateEnd(&strm);
return JIM_ERR;
}
@@ -106,7 +106,7 @@ static int Jim_Compress(Jim_Interp *interp, const char
deflateEnd(&strm);
if (strm.total_out > INT_MAX) {
- Jim_Free(strm.next_out);
+ Jim_Free(buf);
return JIM_ERR;
}
Hi Steve,
I have found that the --random-hash makes test dict2.test:4.1 fail randomly.
You can see it failing with these commands, which should just give an endless column of "a b c d"
./configure
--random-hash && make
while true; do ./jimsh -e "dict replace {a b c d}"; done`
Instead of "a b c d", fairly often "c d a b" is returned.
Regards,
Evan
Bug-Debian: https://bugs.debian.org/873049
The 0.77 upload to Debian has revealed that this version has regressed on the hurd-i386
architecture, see https://buildd.debian.org/status/logs.php?pkg=jimtcl&arch=hurd-i386
exec-12.1 ERR reaping background processes
At : exec.test:347
Expected: '0'
Got : 'child'
exec.test: Total 76 Passed 75 Skipped 0 Failed 1
------------------------------------------------------------
FAILED: 1
exec.test:347 exec-12.1
[...]
=========================================================================
Totals: Total 4722 Passed 4503 Skipped 218 Failed 1
I'm happy to help getting that fixed (I can get access to hurd-i386
developer machines) if you have patches.
package require
sometimes returns a corrupted version string. It seems that the version string gets garbage collected. ef5f515 fixes this issue for me. At least no further corrupted string appeared in my tests.
I've also removed the forced version number for "compiled tcl extensions" in 6f51a99. The package loader seems to provide the default version '1.0' already for extensions not providing a version number.
Hi
This command in Tcl does not touch origin
% file copy -force origin origin
and this one (in Jim Tcl) does truncate origin
. file copy -force origin origin
If you have no objections tclcomapt.tcl.patch. Sorry for mess with the patch here but I could not subscribe to jim-devel list. Does mailman reject gmail?
Jim does not process line continuations in curly braces, which causes incompatibility with Tcl 8 code.
$ cat demo.tcl
puts "$tcl_platform(engine) [info patchlevel]"
puts "foo\
bar"
set s {lorem\
ipsum}
puts $s
puts [string length [lindex $s 0]]
$ tclsh demo.tcl
Tcl 8.6.8
foo bar
lorem ipsum
5
$ jimsh demo.tcl
Jim 0.77
foo bar
lorem\
ipsum
6
The parser ignores a missing "]" in e.g.:
$>./jimsh -e "puts [string length test"
4
and
$>./jimsh -e "if { [string length test } { puts -nonewline ok }"
ok
and
$>echo "if { [string length test } { puts -nonewline ok }" > test.tcl
$>jimsh test.tcl
ok
whereas
$>echo "puts [string length test" > test.tcl
$>jimsh test.tcl
Runtime Error: tree.tcl:6: unmatched "[" in "test.tcl" at line 1
at file "tree.tcl", line 6
reports the expected error.
Btw: the function prototype for JimParseSubCmd()
is declared twice in jim.c
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.